Re: plpgsql: Bush becomes a null, can not execute null query - Mailing list pgsql-admin

From Tom Lane
Subject Re: plpgsql: Bush becomes a null, can not execute null query
Date
Msg-id 10442.1062077597@sss.pgh.pa.us
Whole thread Raw
In response to plpgsql: Bush becomes a null, can not execute null query  (Mauri Sahlberg <Mauri.Sahlberg@claymountain.com>)
Responses Re: plpgsql: Bush becomes a null,  ("Mauri Sahlberg" <mos@iki.fi>)
List pgsql-admin
Mauri Sahlberg <Mauri.Sahlberg@claymountain.com> writes:
> If the following is executed in context, where the dynamic query returns
> data with every iteration everythin goes fine. If the the dynamic query
> returns nothing - bush becomes null and everything fails. I do not
> undestand why bush becomes null when the query returns nothing.

If "latest" is null then the result of the series of concatenations is
also null.  Perhaps what you really want is to assign to "latest" inside
the inner FOR-loop.

            regards, tom lane

pgsql-admin by date:

Previous
From: Daniel Michał
Date:
Subject: postgresql and lock an row
Next
From: Bruno LEVEQUE
Date:
Subject: Re: How do i get the location or -D paramter to accept a windows