Re: BUG #17532: Prepared statements and insert on conflict can fail on the 6th execution

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Jack Christensen <jack(at)jackchristensen(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #17532: Prepared statements and insert on conflict can fail on the 6th execution
Date: 2022-06-25 15:56:44
Message-ID: CAKFQuwbsepgM=Q6-Y9cFcJGm1GzDwWvsFv7gnmGEqUB69K2+yQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sat, Jun 25, 2022, 08:25 PG Bug reporting form <noreply(at)postgresql(dot)org>
wrote:

> The following bug has been logged on the website:
>
> Bug reference: 17532
> Logged by: Jack Christensen
> Email address: jack(at)jackchristensen(dot)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.

https://www.postgresql.org/message-id/17445-fb74db6348391e85%40postgresql.org

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

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Jiří Ledvinka 2022-06-25 16:00:33 server closed the connection unexpectedly - bug report
Previous Message PG Bug reporting form 2022-06-25 15:38:14 BUG #17533: run benchmarksql test failed