| From: | 邓尧 <torshie(at)gmail(dot)com> |
|---|---|
| To: | Jon Nelson <jnelson+pgsql(at)jamponi(dot)net> |
| Cc: | pgsql <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Duplicated entries are not ignored even if a "do instead nothing" rule is added. |
| Date: | 2012-01-09 09:49:25 |
| Message-ID: | CAOb3iuh9GeJQGNPSXCv8YCjpfL8L2VrXrq+yeeQ18+C-ryfioQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Mon, Jan 9, 2012 at 9:53 AM, Jon Nelson <jnelson+pgsql(at)jamponi(dot)net>wrote:
> On Sun, Jan 8, 2012 at 7:13 PM, 邓尧 <torshie(at)gmail(dot)com> wrote:
> > I have enabled the autocommit feature of psycopg2, and removed all the
> > transactions in source code, also changed the sql statement to the
> > following:
> >
> > insert into ACCOUNT(HOME)
> > select "v1" as HOME
> > where not exists (select 1 from ACCOUNT where HOME = "v1")
> >
> > Surprisingly, I still got the unique constraint violation error, but much
> > fewer than before ( only 3 during the last 3 days).
> > Any suggestions? Could it be a bug in psycopg2 or postgresql?
>
> Presumably, you need to add a distinct.
> insert into ... select DISTINCT .... where not exists.
>
I don't think so. The the statement "select .. as .. where not exists" will
never return more than one row.
>
>
> --
> Jon
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Stefan Keller | 2012-01-09 11:06:24 | Re: Binary Large Objects (LOB/BLOB) in Hibernate and JDBC: Unresolved issues |
| Previous Message | Damiano ALBANI | 2012-01-09 08:56:00 | Re: Supporting SQL/MED DATALINK |