On Tue, Mar 08, 2005 at 04:30:54PM -0600, Guy Rouillier wrote:
> This is such a common usage pattern that I'm pretty sure I'm missing
> something basic. Pgsql provides quote_literal to aid with inserting a
> literal string into a dynamically prepared statement. My opinion is
> that quote_literal should handle nulls as well, but if quote_literal
> can't be changed for historical reasons, then providing another function
> like check_null below would be very useful. Basically, such a function
> should supply the value NULL if the incoming value is null, or the
> incoming value otherwise.
Lookup the COALESCE and NULLIF functions.
Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.