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

From Robert Paulsen
Subject Re: ERROR: null value in column "id" violates not-null constraint
Date
Msg-id 200910101400.47182.robert@paulsenonline.net
Whole thread Raw
In response to Re: ERROR: null value in column "id" violates not-null constraint  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: ERROR: null value in column "id" violates not-null constraint  (Robert Paulsen <robert@paulsenonline.net>)
List pgsql-sql
On Saturday 10 October 2009 1:46 pm, Tom Lane wrote:
> 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.)

pwvault=# \d vault               Table "public.vault" Column  |          Type           |   Modifiers
----------+-------------------------+---------------id       | integer                 | not nullarchived | boolean
           | default falseservice  | character varying(256)  | not nullcategory | character varying(16)   |userid   |
charactervarying(256)  | not nullpasswd   | character varying(256)  | not nullurl      | character varying(4096) |notes
  | text                    |
 
Indexes:   "vault_pkey" PRIMARY KEY, btree (id)

So no default for id. What should it be?

Something like one of this?
default nextval('vault_id_seq')

pwvault=# \d vault_id_seq
Sequence "public.vault_id_seq"   Column     |  Type
---------------+---------sequence_name | namelast_value    | bigintincrement_by  | bigintmax_value     |
bigintmin_value    | bigintcache_value   | bigintlog_cnt       | bigintis_cycled     | booleanis_called     | boolean
 



pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: 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