Re: Postgres mystery

From: Klint Gore <kg(at)kgb(dot)une(dot)edu(dot)au>
To: Shaun Clements <ShaunC(at)relyant(dot)co(dot)za>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Postgres mystery
Date: 2005-03-30 07:35:11
Message-ID: 424A56AF34F.C15DKG@129.180.47.120
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 30 Mar 2005 09:11:09 +0200, Shaun Clements <ShaunC(at)relyant(dot)co(dot)za> wrote:
> Can anyone tell me what the problem is here:
> I am inserting into a table via a stored procedure, to a few columns within
> the table and postgres is throwing a
> CANNOT EXECUTE NULL QUERY.
>
> <code snip>
> EXECUTE ''INSERT INTO table (column1, column2, column3,
> ''||quote_ident(column4)||'') values
> (''||quote_literal(RECORDNAME.column1)||'',''||quote_literal(RECORDNAME.colu
> mn2)||'',''''stringvalue'''',''||quote_literal(RECORDNAME.column2)||'')'';
> </code snip>
>
> Is this a bug, as I am ensuring that the NOT NULL columns are supplied, as
> well as one other.

At least one of column4, recordname.column1, recordname.column2,
recordname.column2 is null. If you append a null to a string, the
result is null.

klint.

+---------------------------------------+-----------------+
: Klint Gore : "Non rhyming :
: EMail : kg(at)kgb(dot)une(dot)edu(dot)au : slang - the :
: Snail : A.B.R.I. : possibilities :
: Mail University of New England : are useless" :
: Armidale NSW 2351 Australia : L.J.J. :
: Fax : +61 2 6772 5376 : :
+---------------------------------------+-----------------+

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2005-03-30 07:41:22 Re: Postgres mystery
Previous Message Richard Huxton 2005-03-30 07:33:41 Re: Upgrade data