Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UXv4X-0001Za-C9 for pgsql-bugs@arkaria.postgresql.org; Thu, 02 May 2013 15:05:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UXv4W-0008LW-Pt for pgsql-bugs@arkaria.postgresql.org; Thu, 02 May 2013 15:05:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UXv4W-0008LR-9I for pgsql-bugs@postgresql.org; Thu, 02 May 2013 15:05:24 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UXv4O-0002NH-1j for pgsql-bugs@postgresql.org; Thu, 02 May 2013 15:05:23 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id r42F5Bq0025037; Thu, 2 May 2013 11:05:11 -0400 (EDT) From: Tom Lane To: Hajo@Lemcke.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #8132: Not Null column should set default value when inserting or setting null In-reply-to: References: Comments: In-reply-to Hajo@Lemcke.com message dated "Thu, 02 May 2013 08:18:38 -0000" Date: Thu, 02 May 2013 11:05:11 -0400 Message-ID: <25036.1367507111@sss.pgh.pa.us> X-Pg-Spam-Score: -4.4 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Hajo@Lemcke.com writes: > I would like to have the default value replace a given null value if the > column is specified with not null and default. > The SQL specification only requires to set the default value when the column > is omitted on insert or update. > I think this is a flaw in the specification because it requires developers > to create multiple statements for inserts and updates for all combinations > of default not null columns. This may be a flaw in the specification, but you'd need to talk to the SQL standards committee to get it changed, not us. We're quite unlikely to change away from standard-mandated behavior. If you really need such behavior to support broken application logic, you can implement it with a BEFORE INSERT/UPDATE trigger. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs