Re: plpgsql: ambiguous column reference in ON CONFLICT clause

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Torsten Förtsch <tfoertsch123(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: plpgsql: ambiguous column reference in ON CONFLICT clause
Date: 2023-02-06 18:26:50
Message-ID: CAFj8pRBCQDeGozZfczABn3ri=u9_mB+n8SKfaWQOSWr8wuQz3w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

po 6. 2. 2023 v 19:02 odesílatel David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> napsal:

> On Monday, February 6, 2023, Torsten Förtsch <tfoertsch123(at)gmail(dot)com>
> wrote:
>
>>
>> After reading this I am wondering if the current behavior is actually a
>> bug.
>>
>
> Arguably it is a bug, and a known one at that if you want some light
> reading, but regardless there is presently no proposal to get rid of the
> POLA violation and little chance for any solution to be back-patched since
> the issue is lack of good existing technical options.
>
> https://www.postgresql.org/message-id/1990141.1638388378%40sss.pgh.pa.us
>
>
> https://www.postgresql.org/message-id/flat/15533-ac9506ee433a0d18%40postgresql.org
>

This is an interesting issue. I fully agree, so it is very pretty
unintuitive, but when you start calculating with possibility of expression
indexes, it is probably the best that is possible. I don't think it is a
bug. Unfortunately, at this moment we have no information about single or
double braces usage. So there is not any possibility to say so there should
not be an expression's index. And if there can be a functional index, then
using a possible variable can be really confusing without unique meaning.

This is probably only one case, where you can specify an index in a query,
so there are not any other similar cases, and this special case should be
documented and explained in plpgsql doc.

Regards

Pavel

>
> David J.
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message veem v 2023-02-06 18:31:42 Re: Sequence vs UUID
Previous Message Sebastien Flaesch 2023-02-06 18:11:25 Re: Get the sequence name corresponding to a GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY column