This seems to answer my question.  I completely forgot about the behavior of 
NULL  value in the text concatenation.



http://www.postgresql.org/docs/9.1/static/plpgsql-statements.html#PLPGSQL-QUOTE-LITERAL-EXAMPLE

 

Because quote_literal is labelled STRICT, it
will always return null when called with a null argument. In the above example,
if newvalue or keyvalue were null, the
entire dynamic query string would become null, leading to an error from 
EXECUTE. You
can avoid this problem by using the quote_nullable function,
which works the same as quote_literal except that
when called with a null argument it returns the string NULL. For
example,



                                          

Reply via email to