Re: ERROR: null value in column "id" violates not-null constraint
От | Dmitriy Igrishin |
---|---|
Тема | Re: ERROR: null value in column "id" violates not-null constraint |
Дата | |
Msg-id | b4399d110910110622s7b98a96fk52416b080e9b33a@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: ERROR: null value in column "id" violates not-null constraint (Robert Paulsen <robert@paulsenonline.net>) |
Ответы |
Re: ERROR: null value in column "id" violates not-null constraint
|
Список | pgsql-sql |
Hello!<br /><br />Please, read pg_dump(1) manual page. You will find this text in it:<br />"It is not guaranteed that pg_dump'soutput can be loaded into a server of<br />an older major version -- not even if the dump was taken from a server<br/> of that version. Loading a dump file into an older server may require<br />manual editing of the dump fileto remove syntax not understood by the<br />older server."<br /><br />Regards,<br />Dmitry Igrishin<br /><br /><divclass="gmail_quote"> 2009/10/11 Robert Paulsen <span dir="ltr"><<a href="mailto:robert@paulsenonline.net">robert@paulsenonline.net</a>></span><br/><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">On Sunday11 October 2009 3:32 am, Dmitriy Igrishin wrote:<br /> > Hello.<br /> > Note, that you may use SERIAL data typeand PostgreSQL will implicitly<br /> > create sequence for you column, for example,<br /> > CREATE table test(<br /> > id SERIAL NOT NULL PRIMARY KEY, -- PostgreSQL will implicitly<br /> > create 'test_id_seq'<br/> > dat text<br /> > );<br /> ><br /> > Regards,<br /> > Dmitiy Igrishin<br />><br /><br /></div>I believe that's how I started, not knowing any other way, but the pg_dump<br /> utility spits thingsout in all the gory details!<br /><br /> Somewhere along the line the default value for the id field was lost. I at<br/> first suspected it happened in the dump/restore cycle when I restored the<br /> data back into 8.0 after dumpingit with 8.2 but I reran that scenario and<br /> something else happened: It would NOT restore back into 8.0 at all,so that<br /> must not be what I actually did to get into the "lost default" situation.<br /><br /> Below is what 8.2dumps out. 8.0 refuses imported that. I suppose if I had<br /> originally edited the 8.2 dump data to "fix" this I mighthave gotten into<br /> the mess I was in but I sure don't remember doing that.<br /><br /> 8.2 dump data:<br /> id integerDEFAULT nextval(('auth_id_seq'::text)::regclass) NOT NULL,<br /><br /> What 8.0 is happy with:<br /><div class="im">idinteger DEFAULT nextval('vault_id_seq'::text) NOT NULL,<br /><br /></div>Bob<br /></blockquote></div><br />
В списке pgsql-sql по дате отправления: