From: Lars Erik Thorsplass <thorsplass@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Fwd: Inserts with incomplete rows... NOT NULL constraints
Date: Wed, 11 Aug 2004 22:19:30 +0200
Message-ID: <7eeb33a0408111319791e88a5@mail.gmail.com> (raw)
In-Reply-To: <7eeb33a04081113184f268cf@mail.gmail.com>
References: <7eeb33a040811053563894d7b@mail.gmail.com>
<200408111502.08030.peter_e@gmx.net>
<7eeb33a04081113184f268cf@mail.gmail.com>
Sorry about that, forgot to send to the list.
---------- Forwarded message ----------
From: Lars Erik Thorsplass <thorsplass@gmail.com>
Date: Wed, 11 Aug 2004 22:18:24 +0200
Subject: Re: [SQL] Inserts with incomplete rows... NOT NULL constraints
To: Peter Eisentraut <peter_e@gmx.net>
> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: thorsplass@gmail.com
Subject: Re: Fwd: Inserts with incomplete rows... NOT NULL constraints
In-Reply-To: <7eeb33a0408111319791e88a5@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox