Peter Eisentraut <peter_e@gmx.net> writes:
> Am Mittwoch, 7. November 2007 schrieb Heikki Linnakangas:
>> Why would you run a query like that in the first place? It seems like a
>> useless query as it is. Is there a bigger story behind it?
> The "1" is substituted from somewhere else.
Seems like textual substitution is not the optimal approach for such a
thing anyway --- why aren't they using a parameter? This is hardly the
only gotcha, as an unadorned numeric literal might be taken as either
int, bigint, or numeric depending on its value. I am sure there are
contexts in which a bigint might cause some surprising choices.
If they really want to stick with textual substitution, an explicit cast
inserted into the query seems the safest bet.
regards, tom lane