Re: trapping a NULL querystring error - Mailing list pgsql-sql

From A. Kretschmer
Subject Re: trapping a NULL querystring error
Date
Msg-id 20081114105540.GF3634@a-kretschmer.de
Whole thread Raw
In response to trapping a NULL querystring error  (Gerardo Herzig <gherzig@fmed.uba.ar>)
List pgsql-sql
am  Fri, dem 14.11.2008, um  7:29:32 -0300 mailte Gerardo Herzig folgendes:
> Hi all. Inside a plpgsql function, i have a EXECUTE statement, which
> sometimes seems to be receiving a null querystring.
> 
> Can i check that condition in a BEGIN..EXCEPTION block? Under which
> condition?
> 
> Or should just check if that string is null?

I think, you should prevent NULL-strings. To ensure that you can use
coalesce. For instance:

sql:='SELECT FROM foo WHERE col = ' || coalesce(var, default-value)

Other way: you check if your sql-string is NULL or not


Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net


pgsql-sql by date:

Previous
From: Gerardo Herzig
Date:
Subject: trapping a NULL querystring error
Next
From: "Sabin Coanda"
Date:
Subject: Re: uuid on windows