| From: | Rory Campbell-Lange <rory(at)campbell-lange(dot)net> |
|---|---|
| To: | Filip Rembiałkowski <plk(dot)zuber(at)gmail(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Strange primary key error on insertion |
| Date: | 2011-10-06 13:52:18 |
| Message-ID: | 20111006135218.GD29101@campbell-lange.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On 06/10/11, Filip Rembiałkowski (plk(dot)zuber(at)gmail(dot)com) wrote:
> 2011/10/6 Rory Campbell-Lange <rory(at)campbell-lange(dot)net>
> > => insert into s_tbls (select * from s_tbl_import);
> >
> > ERROR: duplicate key value violates unique constraint "s_tbls_pkey"
> >
> >
> Looks like you had duplicates in s_tbl_import. Try this:
> SELECT * FROM s_tbl_import WHERE n_id IN (
> SELECT n_id from s_tbl_import group by n_id HAVING count(*)>1
> );
Hi Filip
You were right! Thanks for catching my silly error.
Rory
| From | Date | Subject | |
|---|---|---|---|
| Next Message | David Johnston | 2011-10-06 13:55:10 | Re: Selecting All Columns Associated With Maximum Value of One Column |
| Previous Message | Vincent de Phily | 2011-10-06 13:39:02 | Re: Never-idle autovacuum, and does (auto)vacuuming fill the OS cache ? |