Re: BUG #15826: BUG: Where-Clause referring to iso-8859-1 column in CTEis ignored in Update-statement - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: BUG #15826: BUG: Where-Clause referring to iso-8859-1 column in CTEis ignored in Update-statement
Date
Msg-id CAKFQuwZoWShttJ-zz357Kn+cdtkVBDhj+Ta+gqnR7gvvbnqavA@mail.gmail.com
Whole thread Raw
In response to Re: BUG #15826: BUG: Where-Clause referring to iso-8859-1 column in CTEis ignored in Update-statement  (Pantelis Theodosiou <ypercube@gmail.com>)
List pgsql-bugs
On Fri, May 31, 2019 at 4:06 AM Pantelis Theodosiou <ypercube@gmail.com> wrote:
On Fri, May 31, 2019 at 11:55 AM PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:

Bug reference:      15826
Logged by:          Thomas Hantel
Email address:      tom.hantel@googlemail.com
PostgreSQL version: 11.3
Operating system:   Fedora Linux
Description:       

We are currently seeing the following unexpected effect:

In one of our services there is a statement that first sets up a CTE to
filter the data and then an UPDATE-statement that refers to that data. If
the WHERE-clause in the update refers to a column that is not selected in
the CTE, the whole clause is ignored so that all of the rows in the table
get updated.
[..]
We would expect an error to be thrown in all cases where undefined columns
are referenced.

This is not a bug. It may seem weird but it is expected behaviour under scope resolution.
The cte does not have an id column but dummy has, so it is used.

See also the FAQ entry for this question:


David J.
 

pgsql-bugs by date:

Previous
From: Pantelis Theodosiou
Date:
Subject: Re: BUG #15826: BUG: Where-Clause referring to iso-8859-1 column in CTEis ignored in Update-statement
Next
From: Juan José Santamaría Flecha
Date:
Subject: Re: BUG #15789: libpq compilation with OpenSSL 1.1.1b fails onWindows with Visual Studio 2017