"Greg Sabino Mullane" <greg@turnstep.com> writes:
>> Perhaps have quote_nullable() then as well?
>>
>> You then use quote_nullable() in INSERT and UPDATE SET clauses and
>> quote_literal() in SELECT WHERE clauses.
> I still don't see the use case. Wouldn't your app still need to check
> for nullability anyway, to avoid " = NULL"?
Well, it's clearly useful in INSERT and UPDATE. For WHERE cases, you
might or might not be able to use it, but I note that quote_nullable()
would work much more like what happens if you use a parameter symbol
and then bind NULL as the actual parameter value ...
In hindsight we should probably have done quote_literal the way the OP
suggests, but I concur that it's too late to change it. An additional
function seems a reasonable compromise.
regards, tom lane