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 7C2ECD1BA8C for ; Thu, 28 Aug 2003 21:21:08 +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 07212-02 for ; Thu, 28 Aug 2003 18:20:39 -0300 (ADT) Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2]) by svr1.postgresql.org (Postfix) with ESMTP id 51699D1B574 for ; Thu, 28 Aug 2003 18:18:11 -0300 (ADT) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.9.3/8.9.3) with ESMTP id BAA06812; Fri, 29 Aug 2003 01:17:43 +0400 (MSD) Date: Fri, 29 Aug 2003 01:17:43 +0400 (MSD) From: Oleg Bartunov X-X-Sender: megera@ra.sai.msu.su To: Josh Goldberg Cc: Mauri.Sahlberg@pretax.net, pgsql-admin@postgresql.org Subject: Re: plpgsql: Bush becomes a null, can not execute null query In-Reply-To: <3F4E422E.7050709@4dmatrix.com> Message-ID: References: <1062056068.19315.24.camel@taekwondo.intra.pretax.net> <3F4E422E.7050709@4dmatrix.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/345 X-Sequence-Number: 10065 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 > > ||'')''; > > > > > > > > latest:=rivi.suoritus; > > > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > Regards, Oleg _____________________________________________________________ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83