Received: from trantor.eads-dsn.com (trantor.eads-dsn.com [194.117.220.38]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f33703K08512 for ; Tue, 3 Apr 2001 03:00:04 -0400 (EDT) (envelope-from cyril.picard@eads-dsn.com) Received: by trantor.eads-dsn.com; id IAA13176; Tue, 3 Apr 2001 08:59:54 +0200 (MET DST) Received: from unknown(172.29.64.4) by trantor.eads-dsn.com via smap (4.5) id xma013160; Tue, 3 Apr 2001 08:59:52 +0200 Received: from edsnsrvbda01.edsn.com (edsnsrvbda01 [172.29.64.12]) by hermes.eads-dsn.com (8.11.0/8.11.0) with ESMTP id f336kFG04604 for ; Tue, 3 Apr 2001 08:46:15 +0200 Received: from pmrmnc.edsn.com ([131.129.4.201]) by edsnsrvbda01.edsn.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id G30X6SGK; Tue, 3 Apr 2001 08:57:09 +0200 Received: from pmrpass.edsn.com (PMRPASS [192.168.4.3]) by pmrmnc.edsn.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id GRF3FZ2M; Tue, 3 Apr 2001 08:55:45 +0200 Received: from pmrmsg.edsn.com ([130.10.50.9]) by pmrpass.edsn.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id G3020XHR; Tue, 3 Apr 2001 08:56:44 +0200 Received: by pmrmsg.edsn.com with Internet Mail Service (5.5.2650.21) id ; Tue, 3 Apr 2001 09:00:27 +0200 Message-ID: From: "Picard, Cyril" To: pgsql-sql@postgresql.org Subject: passing null parameter to plpgsq functions Date: Tue, 3 Apr 2001 09:00:26 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain X-Archive-Number: 200104/22 X-Sequence-Number: 2361 Hello I wrote a plpgsql function with few parameters ; when I call the function, some of the parameters can be null. In this case, all the parameters are considered as null in the function's body ! is it a feature ? how can I work around this ? Example : CREATE FUNCTION foo(text, text) RETURNS bool AS ' begin IF ($1 IS NULL) AND ($2 IS NULL) THEN RETURN FALSE; ELSE RETURN TRUE; END IF; end; ' LANGUAGE 'plpgsql'; SELECT foo(null,'bouh') => false (I expected true) SELECT foo('schfk',null) => false (I expected true) SELECT foo(null,null) => false (OK) SELECT foo('schfk','bouh') => true (OK)