Re: doc: Clarify what "excluded" represents for INSERT ON CONFLICT

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Peter Geoghegan <pg(at)bowt(dot)ie>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: doc: Clarify what "excluded" represents for INSERT ON CONFLICT
Date: 2022-07-01 13:40:42
Message-ID: 717439.1656682842@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> I think that the issue here is simply that because both the updated
> table and the "excluded" pseudo-table are visible here, and have the
> same columns, an unqualified name is ambiguous. I don't really think
> that it's worth documenting. The error message you get if you fail to
> do it is actually pretty good:

> ERROR: column reference "b" is ambiguous

> Now you could read that and not understand that the ambiguity is
> between the target table and the "excluded" pseudo-table, for sure.

Agreed. It doesn't help that there's no explicit use of "excluded"
anywhere, as there is in more usual ambiguous-column cases.

> What would probably help more is adding something like this to the
> error message:
> HINT: column "b" could refer to any of these relations: "foo", "excluded"

+1, that seems like it could be handy across the board.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Przemysław Sztoch 2022-07-01 13:43:05 Re: generate_series for timestamptz and time zone problem
Previous Message Tom Lane 2022-07-01 13:37:59 Re: Refactor construct_array() and deconstruct_array() for built-in types