On Saturday 10 October 2009 1:46 pm, Tom Lane wrote:
> Robert Paulsen <rob...@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


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Reply via email to