Re: ERROR: null value in column "id" violates not-null constraint - Mailing list pgsql-sql

From Tom Lane
Subject Re: ERROR: null value in column "id" violates not-null constraint
Date
Msg-id 17323.1255200405@sss.pgh.pa.us
Whole thread Raw
In response to ERROR: null value in column "id" violates not-null constraint  (Robert Paulsen <robert@paulsenonline.net>)
Responses Re: ERROR: null value in column "id" violates not-null constraint  (Robert Paulsen <robert@paulsenonline.net>)
List pgsql-sql
Robert Paulsen <robert@paulsenonline.net> writes:
> I have a database with a sequence field as a primary key in a table and can no 
> longer insert data into it as it gets the subject error message.

Does the table actually have a default for id anymore?  (Try looking
at it with psql's \d command.)

> POSSIBLE REASON FOR THE PROBLEM:
> I dumped the data, restored it into postgresql-8.2.13-0.1. dumped it from 
> there and restored it back to postgresql-server-8.0.13-1.1. I now get the 
> same failure from both 8.0 and 8.2.

pg_dump does not guarantee to produce backward-transportable dumps.
Did you pay attention to whether you got any errors while loading the
8.2 dump into 8.0?  I don't have time to test it right now, but what
I'm thinking is that an ALTER TABLE ADD DEFAULT type of command failed
during the load because of some syntax issue or other.

Another possible foot-gun is to have tried to dump from the 8.2 server
using 8.0 pg_dump.  This will generally not work; pg_dump cannot be
expected to understand system catalog layouts that are newer than it
is.  You can force it to try with the -i switch, but usually that
doesn't result in anything better than a busted dump.
        regards, tom lane


pgsql-sql by date:

Previous
From: Robert Paulsen
Date:
Subject: ERROR: null value in column "id" violates not-null constraint
Next
From: Robert Paulsen
Date:
Subject: Re: ERROR: null value in column "id" violates not-null constraint