Re: plpgsql: Bush becomes a null, can not execute null query

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Josh Goldberg <josh(at)4dmatrix(dot)com>
Cc: Mauri(dot)Sahlberg(at)pretax(dot)net, pgsql-admin(at)postgresql(dot)org
Subject: Re: plpgsql: Bush becomes a null, can not execute null query
Date: 2003-08-28 21:17:43
Message-ID: Pine.GSO.4.56.0308290117300.1651@ra.sai.msu.su
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Thu, 28 Aug 2003, Josh Goldberg wrote:

> Concatenating a null value makes the string null. try:
> SELECT 'foo'||NULL||'bar';
>
> Just add a condition to check rivi.suoritus for null before making an
> assignment.

or better use coalesce

>
>
>
> Mauri Sahlberg wrote:
>
> >returns nothing - bush becomes null and everything fails. I do not
> >undestand why bush becomes null when the query returns nothing.
> >
> >
>
> > bush:=''select * from PaivanLeimat('' ||
> > quote_literal(aYritys) ||
> > ''::varchar,'' ||
> > quote_literal(nyt) ||
> > ''::date,''||
> > quote_literal(aKtunnus) ||
> > ''::varchar,'' ||
> > latest
> > ||'')'';
> >
> >
> <snip>
>
> > latest:=rivi.suoritus;
> >
> >
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Mehrab Erfani 2003-08-28 22:40:37 Hi, I have a question regarding the postgresql scripting
Previous Message Mauri Sahlberg 2003-08-28 18:57:36 Re: plpgsql: Bush becomes a null,