Re: Odd Update Behaviour

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Harry Ambrose <harry(dot)ambrose(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Odd Update Behaviour
Date: 2019-06-20 21:16:50
Message-ID: CAKFQuwZdkSWaSLBY_19ESL7BctrWtVEyXfqSyprsGT0y+3YS3Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jun 20, 2019 at 2:13 PM Harry Ambrose <harry(dot)ambrose(at)gmail(dot)com>
wrote:

> Hi,
>
> I noticed some weird update behaviour today in one of our development
> environments. In my opinion this appears to be a bug, but before reporting
> it I thought I should seek the opinions of others in the community. Maybe
> this is known and/or seen before?
>

Yep, seen before, even has an FAQ entry:

https://wiki.postgresql.org/wiki/FAQ#Why_doesn.27t_PostgreSQL_report_a_column_not_found_error_when_using_the_wrong_name_in_a_subquery.3F

> The behaviour is visible when a subquery is used in an update. More
> specifically when a subquery is rejected by the parser when executed on
> it's own. This causes the where condition to be ignored entirely and thus
> the whole table updated rather than the parser throwing an error.
>

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Gauthier 2019-06-20 21:32:56 Need create table statements from metadata
Previous Message Harry Ambrose 2019-06-20 21:13:14 Odd Update Behaviour