Search Postgresql Archives

Strange primary key error on insertion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a strange issue (postgres 8.4) trying to insert old rows back
into the s_tbls table. A check on the primary key (n_id) between
s_tbl_import and s_tbls yields no matches, yet the index on s_tbls.n_id
yields an error when attempting to insert:

=> select n_id from s_tbl_import where n_id IN (
    select n_id from s_tbls);

     n_id 
    ------
    (0 rows)

=> insert into s_tbls (select * from s_tbl_import);

    ERROR:  duplicate key value violates unique constraint "s_tbls_pkey"

Table "s_tbls"
      Column      |            Type             |                       Modifiers                        
------------------+-----------------------------+--------------------------------------------------------
 n_id             | integer                     | not null default nextval('s_tbls_n_id_seq'::regclass)
 dt_created       | timestamp without time zone | default now()
 dt_modified      | timestamp without time zone | default now()
 t_node           | text                        | 
...
Indexes:
    "s_tbls_pkey" PRIMARY KEY, btree (n_id)


Thanks for any assistance
Rory







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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux