BUG #14327: UPSERT requires full path to column

From: egor(dot)pugin(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #14327: UPSERT requires full path to column
Date: 2016-09-19 08:06:53
Message-ID: 20160919080653.1348.83028@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14327
Logged by: Egor Pugin
Email address: egor(dot)pugin(at)gmail(dot)com
PostgreSQL version: 9.5.4
Operating system: win10
Description:

Hi,

I've noticed upsert query won't work if I do not write 'schema.TABLE.column'
instead of simple 'column' in 'on conflict do update set' query.

Working:

insert into statistics."MostPopularDependencies"
(id, indirect, downloads_week)
values ($1, $2, 1)
on conflict (id, indirect) do update
set downloads_week = statistics."MostPopularDependencies".downloads_week +
1
where statistics."MostPopularDependencies".id = $1 and
statistics."MostPopularDependencies".indirect = $2;

Not working:

insert into statistics."MostPopularDependencies"
(id, indirect, downloads_week)
values ($1, $2, 1)
on conflict
(id, indirect) -- also w/out this, it does not work too, but isn't it
optional element?
do update
set downloads_week = downloads_week + 1
where id = $1 and indirect = $2;

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Geoghegan 2016-09-19 10:06:19 Re: BUG #14327: UPSERT requires full path to column
Previous Message marco.nenciarini 2016-09-16 09:54:48 BUG #14326: Unexpected status after crash during exclusive backup