Re: trapping a NULL querystring error

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: trapping a NULL querystring error
Date: 2008-11-14 10:55:40
Message-ID: 20081114105540.GF3634@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Sabin Coanda 2008-11-14 13:17:39 Re: uuid on windows
Previous Message Richard Huxton 2008-11-14 10:39:42 Re: uuid on windows