From: | Robert Paulsen <robert(at)paulsenonline(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: ERROR: null value in column "id" violates not-null constraint |
Date: | 2009-10-10 19:00:46 |
Message-ID: | 200910101400.47182.robert@paulsenonline.net |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Saturday 10 October 2009 1:46 pm, Tom Lane wrote:
> Robert Paulsen <robert(at)paulsenonline(dot)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 null
archived | boolean | default false
service | character varying(256) | not null
category | character varying(16) |
userid | character varying(256) | not null
passwd | character varying(256) | not null
url | 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 | name
last_value | bigint
increment_by | bigint
max_value | bigint
min_value | bigint
cache_value | bigint
log_cnt | bigint
is_cycled | boolean
is_called | boolean
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Paulsen | 2009-10-10 19:05:26 | Re: ERROR: null value in column "id" violates not-null constraint |
Previous Message | Tom Lane | 2009-10-10 18:46:45 | Re: ERROR: null value in column "id" violates not-null constraint |