inserting data with unique index

Поиск
Список
Период
Сортировка
От Johnson, Shaunn
Тема inserting data with unique index
Дата
Msg-id 73309C2FDD95D11192E60008C7B1D5BB04C744FB@snt452.corp.bcbsm.com
обсуждение исходный текст
Ответы Re: inserting data with unique index  (Andrew Sullivan <andrew@libertyrms.info>)
Список pgsql-general

Running PostgreSQL 7.2.1 on RedHat Linux 7.2.

I have a small table where I wanted to make changes,
update the columns and insert new data.  Because it
was small, I just did a:

pg_dump -t table -U joe_user -d database > out.sql

and edit the out.sql file to add two more columns and
put 'null' in the areas where data matching to the column
would go.

That seemed to work well.

However, when I want to insert a new record into the
table, I get this:

[snip error]

ERROR:  Cannot insert a duplicate key into unique index trend_load_id_key

[/snip error]

Initially, I thought that I had to drop and create my sequence
id for the column 'load_id' ; then I tried it after I recreated
the table.  Neither worked.

[snip table info]

bcn=> \z trend
       Access privileges for database "bcn"
           Table            |  Access privileges
----------------------------+----------------------
        trend             | {=rw,shaunn=arwdRxt}
        trend_load_id_seq |
(2 rows)

  Column  |           Type           |                           Modifiers
----------+--------------------------+----------------------------------------------------------------
 load_id  | integer                  | not null default nextval('"trend_load_id_seq"'::text)
 sum_2000 | numeric(12,2)            |
 cnt_2000 | double precision         |
 sum_2001 | numeric(12,2)            |
 cnt_2001 | double precision         |
 sum_2002 | numeric(12,2)            |
 cnt_2002 | double precision         |
 sum_2003 | numeric(12,2)            |
 cnt_2003 | double precision         |
 count_dt | timestamp with time zone |
Unique keys: trend_load_id_key

[/snip table info]

How does this work?  Do I have to specify an increment starting point
when I reload data or recreate the sequence id?

Thanks!

-X

В списке pgsql-general по дате отправления:

Предыдущее
От: "Ragnar Garli"
Дата:
Сообщение: Re: pg_dump fail beacuse of oid larger than int32
Следующее
От: "Al Bean"
Дата:
Сообщение: postgres on a PDA