Received: from sss2.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.10.1/8.10.1) with ESMTP id e7MHFVT44661 for ; Tue, 22 Aug 2000 13:15:31 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss2.sss.pgh.pa.us (8.9.3/8.9.3) with ESMTP id NAA09390; Tue, 22 Aug 2000 13:15:20 -0400 (EDT) To: "Graham Vickrage" cc: "postgresql" Subject: Re: Null function parameters In-reply-to: References: Comments: In-reply-to "Graham Vickrage" message dated "Tue, 22 Aug 2000 16:37:09 +0100" Date: Tue, 22 Aug 2000 13:15:20 -0400 Message-ID: <9387.966964520@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200008/231 "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'. Not sure what you think you meant by that, but a null is a null. If you declared the table column as NOT NULL then Postgres is doing exactly what it should. You may wish to code the insert along the lines of INSERT INTO table VALUES (..., COALESCE($1, suitable-default), ...) COALESCE is a handy notation for "value1 unless it's NULL, in which case value2". regards, tom lane