Re: ERROR: null value in column "id" violates not-null constraint

From: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>
To: Robert Paulsen <robert(at)paulsenonline(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: ERROR: null value in column "id" violates not-null constraint
Date: 2009-10-11 08:32:05
Message-ID: b4399d110910110132q58e7f211v9ba204cb47239d3c@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

2009/10/11 Robert Paulsen <robert(at)paulsenonline(dot)net>

> On Saturday 10 October 2009 4:12 pm, Tom Lane wrote:
> > Robert Paulsen <robert(at)paulsenonline(dot)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?
> >
> > That's all there is in 8.0 ...
> >
> > regards, tom lane
>
> Thanks!
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Robert Paulsen 2009-10-11 12:35:58 Re: ERROR: null value in column "id" violates not-null constraint
Previous Message Robert Paulsen 2009-10-10 22:36:46 Re: ERROR: null value in column "id" violates not-null constraint