X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 6290ED1D888 for ; Thu, 28 Aug 2003 13:33:47 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 14954-05 for ; Thu, 28 Aug 2003 10:33:18 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 6F65CD1B8AE for ; Thu, 28 Aug 2003 10:33:14 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h7SDXI5H010443; Thu, 28 Aug 2003 09:33:18 -0400 (EDT) To: Mauri.Sahlberg@pretax.net Cc: pgsql-admin@postgresql.org Subject: Re: plpgsql: Bush becomes a null, can not execute null query In-reply-to: <1062056068.19315.24.camel@taekwondo.intra.pretax.net> References: <1062056068.19315.24.camel@taekwondo.intra.pretax.net> Comments: In-reply-to Mauri Sahlberg message dated "28 Aug 2003 10:34:28 +0300" Date: Thu, 28 Aug 2003 09:33:17 -0400 Message-ID: <10442.1062077597@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/334 X-Sequence-Number: 10054 Mauri Sahlberg 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