X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DF4E914B2869 for ; Wed, 11 Aug 2004 09:35:38 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70244-02 for ; Wed, 11 Aug 2004 12:35:30 +0000 (GMT) Received: from mproxy.gmail.com (rproxy.gmail.com [64.233.170.207]) by svr1.postgresql.org (Postfix) with ESMTP id BA49B14B27FC for ; Wed, 11 Aug 2004 09:35:28 -0300 (ADT) Received: by mproxy.gmail.com with SMTP id 76so182913rnl for ; Wed, 11 Aug 2004 05:35:32 -0700 (PDT) Received: by 10.38.11.79 with SMTP id 79mr1926921rnk; Wed, 11 Aug 2004 05:35:32 -0700 (PDT) Message-ID: <7eeb33a040811053563894d7b@mail.gmail.com> Date: Wed, 11 Aug 2004 14:35:32 +0200 From: Lars Erik Thorsplass To: pgsql-sql@postgresql.org Subject: Inserts with incomplete rows... NOT NULL constraints Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/82 X-Sequence-Number: 18579 Am trying to migrate some old data to a new database schema. I have dumped the old data as SQL statements. The new datastructure just contains some added fields to a few tables. My plan was to just create a new database with the new structure, dump the content only as SQL insert statements. And just run the statements contained in the dump on the new database. The problem am now facing is that postgres will try to insert a NULL value for fields not specified in the insert query and that are defined as NOT NULL in the table structure. Is this the correct behaviour? 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. Am loosing my mind in this heat but, you should be able to insert just half the fields of a table record if the datastructure would allow it? Wouldnt you? I feel like a such a noob :( Please advise.. -- L.E.Thorsplass