Received: from digitalplanit.wdi.co.uk (root@[195.13.87.250]) by hub.org (8.10.1/8.10.1) with ESMTP id e7NC9aT70538 for ; Wed, 23 Aug 2000 08:09:36 -0400 (EDT) Received: from Graham (th-access2-4.gw.cerbernet.net [195.13.86.132]) by digitalplanit.wdi.co.uk (8.9.3/8.9.3) with SMTP id NAA12717; Wed, 23 Aug 2000 13:14:10 GMT From: "Graham Vickrage" To: "Anatoly K. Lasareff" , "Tom Lane" Cc: "postgresql" Subject: RE: Null function parameters Date: Wed, 23 Aug 2000 13:07:31 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-reply-to: <86ya1o8ak9.fsf@tolikus.hq.aaanet.ru> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 X-Archive-Number: 200008/239 Thanks Anatoly So if I understand you correctly you can't pass more than one NULL int into a function? Therefore Newbe DBA type question: - Is this a shortcoming in postgres or is it to be expected when dealing with transactions? If it is a shotcoming are there any plans to include it in future releases? Regards Graham -----Original Message----- From: tolik@tolikus.hq.aaanet.ru [mailto:tolik@tolikus.hq.aaanet.ru]On Behalf Of Anatoly K. Lasareff Sent: 23 August 2000 12:46 To: Tom Lane Cc: Graham Vickrage; postgresql Subject: Re: [SQL] Null function parameters >>>>> "TL" == Tom Lane writes: TL> "Graham Vickrage" writes: >> However my understanding was that if the default value is SQL NULL then any >> values passed into the function that are null would be treated as 'NULL'. TL> Not sure what you think you meant by that, but a null is a null. If you TL> declared the table column as NOT NULL then Postgres is doing exactly TL> what it should. You may wish to code the insert along the lines of TL> INSERT INTO table VALUES (..., COALESCE($1, suitable-default), ...) TL> COALESCE is a handy notation for "value1 unless it's NULL, in which case TL> value2". TL> regards, tom lane But unfortunately we have no answer for primary question: | Why if we pass to function ONLY ONE null agument all the oters | | argumenta in function's boby are null too? | | Or: is it possible to pass null arguments into plpgsql functions? | Example. create function a(int, int) returns int as ' begin raise notice ''1: % 2: %'', $1, $2; if $1 is null then return $2; end if; return $1; end; ' language 'plpgsql'; tolik=# select a(1,2); NOTICE: 1: 1 2: 2 a --- 1 (1 row) tolik=# select a(null,2); NOTICE: 1: 2: a --- (1 row) -- Anatoly K. Lasareff Email: tolik@aaanet.ru