Re: Pgsql dynamic statements and null values - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Pgsql dynamic statements and null values
Date
Msg-id 20050309105046.GD1239@svana.org
Whole thread Raw
In response to Pgsql dynamic statements and null values  ("Guy Rouillier" <guyr@masergy.com>)
List pgsql-general
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.

Attachment

pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: Re: Disabling triggers in a transaction
Next
From: Howard Cole
Date:
Subject: Re: postgresql vs mysql performance comparison