Re: [SQL] ERROR: null value in column id violates not-null constraint

2009-10-11 Thread Dmitriy Igrishin
Hello. Note, that you may use SERIAL data type and PostgreSQL will implicitly create sequence for you column, for example, CREATE table test ( id SERIAL NOT NULL PRIMARY KEY, -- PostgreSQL will implicitly create 'test_id_seq' dat text ); Regards, Dmitiy Igrishin

Re: [SQL] ERROR: null value in column id violates not-null constraint

2009-10-11 Thread Robert Paulsen
On Sunday 11 October 2009 3:32 am, Dmitriy Igrishin wrote: Hello. Note, that you may use SERIAL data type and PostgreSQL will implicitly create sequence for you column, for example, CREATE table test ( id SERIAL NOT NULL PRIMARY KEY, -- PostgreSQL will implicitly create

Re: [SQL] ERROR: null value in column id violates not-null constraint

2009-10-11 Thread Dmitriy Igrishin
Hello! Please, read pg_dump(1) manual page. You will find this text in it: It is not guaranteed that pg_dump's output can be loaded into a server of an older major version -- not even if the dump was taken from a server of that version. Loading a dump file into an older server may require

Re: [SQL] ERROR: null value in column id violates not-null constraint

2009-10-11 Thread Robert Paulsen
On Sunday 11 October 2009 8:22 am, Dmitriy Igrishin wrote: Hello! Please, read pg_dump(1) manual page. You will find this text in it: It is not guaranteed that pg_dump's output can be loaded into a server of an older major version -- not even if the dump was taken from a server of that

[SQL] ERROR: null value in column id violates not-null constraint

2009-10-10 Thread Robert Paulsen
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. This database has been in use for well over two years without any problems using postgresql-server-8.0.13-1.1. Suddenly, when I attempt to add a new

Re: [SQL] ERROR: null value in column id violates not-null constraint

2009-10-10 Thread Tom Lane
Robert Paulsen rob...@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.)

Re: [SQL] ERROR: null value in column id violates not-null constraint

2009-10-10 Thread Robert Paulsen
On Saturday 10 October 2009 1:46 pm, Tom Lane wrote: Robert Paulsen rob...@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

Re: [SQL] ERROR: null value in column id violates not-null constraint

2009-10-10 Thread Robert Paulsen
On Saturday 10 October 2009 2:00 pm, Robert Paulsen wrote: So no default for id. What should it be? Something like one of this? default nextval('vault_id_seq') Should have tried that before posting last message -- it worked. Thanks! -- Sent via pgsql-sql mailing list

Re: [SQL] ERROR: null value in column id violates not-null constraint

2009-10-10 Thread Tom Lane
Robert Paulsen rob...@paulsenonline.net writes: On Saturday 10 October 2009 2:00 pm, Robert Paulsen wrote: So no default for id. What should it be? default nextval('vault_id_seq') Should have tried that before posting last message -- it worked. Thanks! So the next question is just what

Re: [SQL] ERROR: null value in column id violates not-null constraint

2009-10-10 Thread Robert Paulsen
On Saturday 10 October 2009 3:16 pm, Tom Lane wrote: Robert Paulsen rob...@paulsenonline.net writes: On Saturday 10 October 2009 2:00 pm, Robert Paulsen wrote: So no default for id. What should it be? default nextval('vault_id_seq') Should have tried that before posting last message --

Re: [SQL] ERROR: null value in column id violates not-null constraint

2009-10-10 Thread Tom Lane
Robert Paulsen rob...@paulsenonline.net writes: I do have a question, though, I fixed things as indicated above: id integer DEFAULT nextval('vault_id_seq') NOT NULL, Dump gave back id integer DEFAULT nextval('vault_id_seq'::text) NOT NULL, That text seems odd. Should I change it?

Re: [SQL] ERROR: null value in column id violates not-null constraint

2009-10-10 Thread Robert Paulsen
On Saturday 10 October 2009 4:12 pm, Tom Lane wrote: Robert Paulsen rob...@paulsenonline.net writes: I do have a question, though, I fixed things as indicated above: id integer DEFAULT nextval('vault_id_seq') NOT NULL, Dump gave back id integer DEFAULT