Re: BUG #17532: Prepared statements and insert on conflict can fail on the 6th execution - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: BUG #17532: Prepared statements and insert on conflict can fail on the 6th execution
Date
Msg-id CAKFQuwbsepgM=Q6-Y9cFcJGm1GzDwWvsFv7gnmGEqUB69K2+yQ@mail.gmail.com
Whole thread Raw
In response to BUG #17532: Prepared statements and insert on conflict can fail on the 6th execution  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs


On Sat, Jun 25, 2022, 08:25 PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:

Bug reference:      17532
Logged by:          Jack Christensen
Email address:      jack@jackchristensen.com
PostgreSQL version: 14.4
Operating system:   MacOS
Description:       

A user of the Go driver pgx reported a strange bug
(https://github.com/jackc/pgx/issues/1234). After investigating the issue I
was able to duplicate it in directly in psql. The problem occurs when a
prepared statement has an INSERT ... ON CONFLICT. The statement works the
first 5 times and fails on the 6th time with ERROR:  there is no unique or
exclusion constraint matching the ON CONFLICT specification. I would guess
this has to do with the planner choosing a generic or custom plan.

See existing bug 17445 for discussion on this.


In short, you have written a query that probably should always fails and just fails to do so in some instances.

David J.

pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17533: run benchmarksql test failed
Next
From: Jiří Ledvinka
Date:
Subject: server closed the connection unexpectedly - bug report