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 1866CD1B8A8 for ; Thu, 28 Aug 2003 18:00:00 +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 60654-06 for ; Thu, 28 Aug 2003 14:59:30 -0300 (ADT) Received: from mail.4dmatrix.com (unknown [208.248.151.248]) by svr1.postgresql.org (Postfix) with ESMTP id 8BC76D1B8BC for ; Thu, 28 Aug 2003 14:59:28 -0300 (ADT) Received: from 4dmatrix.com (fw.4dmatrix.com [208.248.151.220]) by mail.4dmatrix.com (8.9.3/8.9.3) with ESMTP id KAA00564; Thu, 28 Aug 2003 10:50:52 -0700 Message-ID: <3F4E422E.7050709@4dmatrix.com> Date: Thu, 28 Aug 2003 10:55:58 -0700 From: Josh Goldberg User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, ja, en MIME-Version: 1.0 To: Mauri.Sahlberg@pretax.net Cc: pgsql-admin@postgresql.org Subject: Re: plpgsql: Bush becomes a null, can not execute null query References: <1062056068.19315.24.camel@taekwondo.intra.pretax.net> In-Reply-To: <1062056068.19315.24.camel@taekwondo.intra.pretax.net> X-Enigmail-Version: 0.76.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/343 X-Sequence-Number: 10063 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. 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; > >