Sorry about that, forgot to send to the list.
---------- Forwarded message ---------- From: Lars Erik Thorsplass <[EMAIL PROTECTED]> Date: Wed, 11 Aug 2004 22:18:24 +0200 Subject: Re: [SQL] Inserts with incomplete rows... NOT NULL constraints To: Peter Eisentraut <[EMAIL PROTECTED]> > Am Mittwoch, 11. August 2004 14:35 schrieb Lars Erik Thorsplass: > > I would expect NULL fields not specified in the insert to get NULL > > inserted automatically. But that fields which are NOT NULL in the > > table structure gets inserted a NULL value too seems odd. > > More accurately, the default value is inserted, which in turn is null if you > didn't specify one. You might find it odd that default values that are > inconsistent with constraints are allowed, but I don't see any reasonable > alternative. Thanks for clearing that up. Guess I'll work around my migration problems with placeholder default values. I tried another approach at the same time. I tried to alter the tables that had changed between versions of the sql structure. The problem with this is that postgres is unable to add a field to a table with a NOT NULL constraint. You can add a NOT NULL constraint to the field afterwards but now all records in the table have a NULL value in the field. So you wont be able to do that until you change all the values. No default value was specified for the new field. As with the other approach this might also work if I enter some default values. Best regards, L.E.Thorsplass -- L.E.Thorsplass ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings