Re: EXECUTE INSERT BUGS? - Mailing list pgsql-general

From Tom Lane
Subject Re: EXECUTE INSERT BUGS?
Date
Msg-id 3108.1162875718@sss.pgh.pa.us
Whole thread Raw
In response to Re: EXECUTE INSERT BUGS?  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: EXECUTE INSERT BUGS?
List pgsql-general
Jeff Davis <pgsql@j-davis.com> writes:
> On Mon, 2006-11-06 at 16:40 -0800, Matthew Peter wrote:
>> v_value text := null;
>> -- ^^^ right here, NULL makes the querystring fail by setting cmd =
>> null
>> BEGIN
>> cmd := 'INSERT INTO test (
>> col
>> ) values ( '
>> || quote_literal(v_value) ||  ');';
>> EXECUTE cmd;

> Concatenation with NULL yields NULL, which is the correct behavior.

Hm.  I wonder whether we should redefine quote_literal as a non-strict
function that delivers "NULL" (*without* any quotes) when fed a null
input.  While that would do the Right Thing in this particular example,
I'm worried that it might do the wrong thing in other contexts...
Comments?

            regards, tom lane

pgsql-general by date:

Previous
From: "Sandeep Kumar Jakkaraju"
Date:
Subject: Re: PostGIS Binary RPM for Red Hat Linux
Next
From: "Gurjeet Singh"
Date:
Subject: Re: Cannot rename file pg_xlog\0000.....