Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XR0ug-0008VM-45 for pgsql-bugs@arkaria.postgresql.org; Mon, 08 Sep 2014 15:31:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XR0uf-0006j4-KH for pgsql-bugs@arkaria.postgresql.org; Mon, 08 Sep 2014 15:31:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XR0Gc-00089s-Uz for pgsql-bugs@postgresql.org; Mon, 08 Sep 2014 14:50:07 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XR0GZ-0004xW-Fl for pgsql-bugs@postgresql.org; Mon, 08 Sep 2014 14:50:05 +0000 MIME-Version: 1.0 Subject: BUG #11381: Inherited NOT NULL to NULLABLE column: backup restore error. To: pgsql-bugs@postgresql.org From: m.winkel@w2solutions.nl Date: Mon, 08 Sep 2014 14:49:13 +0000 Message-ID: <20140908144913.2936.63756@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.1 (-) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 The following bug has been logged on the website: Bug reference: 11381 Logged by: Martin Winkel Email address: m.winkel@w2solutions.nl PostgreSQL version: 9.3.5 Operating system: Ubuntu 14.04 X64 Description: Dummy case to reproduce the error: Create tables: CREATE TABLE base ( id serial NOT NULL, name character varying(127) NOT NULL, nickname character varying(127) NOT NULL, email_address character varying(512) NOT NULL, useless_but_required_field text NOT NULL, CONSTRAINT base_pkey PRIMARY KEY (id) ) WITH ( OIDS=FALSE ); CREATE TABLE inherited ( CONSTRAINT inherited_pkey PRIMARY KEY (id) ) INHERITS (base) WITH ( OIDS=FALSE ); ALTER TABLE inherited ALTER COLUMN useless_but_required_field DROP NOT NULL; According to the documentation, it is not clear if this should work. But it is allowed by version 9.3.5 on ubuntu X64. In the inherited colum I can insert columns with "useless_but_required_field" NULL. The problem is, when I back-up this database using the pg_dump command, I cannot restore it using pg_restore (or the PgAdmin GUI). It gives me the following error: DETAIL: Failing row contains (1, Martin W, storeman, xx, null). CONTEXT: COPY inherited, line 1: "1 Martin W storeman xx \N Two solutions possible (as far as i can see): 1. Don't allow for children to be nullable if parent isn't 2. Update pg_dump/pg_restore to work with the nullable child columns -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs