From: Robert Paulsen <robert@paulsenonline.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: ERROR: null value in column "id" violates not-null constraint
Date: Sat, 10 Oct 2009 14:00:46 -0500
Message-ID: <200910101400.47182.robert@paulsenonline.net> (raw)
In-Reply-To: <17323.1255200405@sss.pgh.pa.us>
References: <200910101056.24051.robert@paulsenonline.net>
<17323.1255200405@sss.pgh.pa.us>
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 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: robert@paulsenonline.net, tgl@sss.pgh.pa.us
Subject: Re: ERROR: null value in column "id" violates not-null constraint
In-Reply-To: <200910101400.47182.robert@paulsenonline.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox