Re: EXECUTE INSERT BUGS?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Matthew Peter <survivedsushi(at)yahoo(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: EXECUTE INSERT BUGS?
Date: 2006-11-07 05:01:58
Message-ID: 3108.1162875718@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jeff Davis <pgsql(at)j-davis(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sandeep Kumar Jakkaraju 2006-11-07 05:03:07 what version of Postgis should i install for Postgres-8.1.5 RHEL 4 -AS RPM
Previous Message Ben 2006-11-07 05:00:32 Re: R and postgres