From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Andrus <kobruleht2(at)hot(dot)ee>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Duplicate key error |
Date: | 2021-03-03 15:42:20 |
Message-ID: | 5b68b4b3-b957-5009-cf3e-4bbc9dcbd0d9@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 3/3/21 7:23 AM, Andrus wrote:
> Hi!
>
> Sometimes duplicate key error
>
> duplicate key value violates unique constraint "session_pkey"
> Key (workplace)=(WIN-N9BSKUNKBC8 ) already exists.
>
> occurs in script:
>
> delete from session where workplace='WIN-N9BSKUNKBC8' ;
> INSERT INTO session (workplace,ipaddress,logintime,loggeduser)
> SELECT 'WIN-N9BSKUNKBC8' ,
> inet_client_addr()::CHAR(14),current_timestamp::CHAR(28),CURRENT_USER
> WHERE NOT EXISTS (SELECT 1 FROM session WHERE workplace='WIN-N9BSKUNKBC8' )
>
> Sript is running form windows task scheduler on every 10 minutes. Error
> occurs only sometimes.
There is no other process inserting to this table?
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Tobias Lott | 2021-03-03 16:02:21 | Re: permission denied for pg_temp_XX when vacuuming |
Previous Message | Andrus | 2021-03-03 15:23:35 | Duplicate key error |