我如何在postgres上将日期参数传递给dblink?
SELECT * FROM dblink
(
'my connection'
,
'SELECT s.dtcreated FROM realvida.tbstudente s ' ||
' WHERE s.dtcreated' = $1 -- my parameter pass '02-01-2017'
) as result2( dtcreated date )
这样它就给我一个错误:
运算符不存在:date = integer
答案 0 :(得分:1)
更改'SELECT s.dtcreated FROM realvida.tbstudente s ' ||
' WHERE s.dtcreated' = $1
到
format('SELECT s.dtcreated FROM realvida.tbstudente s WHERE s.dtcreated = %L',$1)