On Thu, Aug 15, 2019 at 6:28 AM PG Bug reporting form
<noreply(at)postgresql(dot)org> wrote:
> Using upsert in stored procedure ON CONFLICT(id, ...) trows "ERROR: column
> reference "id" is ambiguous" where id used as column name and as variable,
> but ON CONFLICT can't use variables
This is not a bug. You must resolve the ambiguity by using a plpgsql
variable whose name isn't exactly the same as a column name.
In principle you can have an index on a simple constant, which is
occasionally useful (e.g. using a unique index to enforce that you can
either have zero or one rows in some particular table).
--
Peter Geoghegan