Re: BUG #14748: Invalid statement should raise parse error, but ignores invalid part instead

From: Andres Freund <andres(at)anarazel(dot)de>
To: johnthuss(at)gmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14748: Invalid statement should raise parse error, but ignores invalid part instead
Date: 2017-07-17 14:58:11
Message-ID: 20170717145811.x3ijoylzgoqmc5uo@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2017-07-17 14:51:26 +0000, johnthuss(at)gmail(dot)com wrote:
> The following bug has been logged on the website:
>
> Bug reference: 14748
> Logged by: John Huss
> Email address: johnthuss(at)gmail(dot)com
> PostgreSQL version: 9.6.1
> Operating system: Linux
> Description:
>
> This statement is invalid because the 'AND' should be a WHERE or a comma:
>
> update mytable set active = false and foreign_ID = 18984
>
> But when executed it doesn't raise a parse error and simply ignores the
> 'and' and everything after it.
>
> The result of the statement is that every row in the table is updated with
> active=false.
>
> I would expect this to throw a parse error.

What happens is that you're assigning the result of the expression
'false and foreign_ID = 18984'.

- Andres

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Chris Pacejo 2017-07-17 15:56:39 Re: BUG #14691: Isolation failure in deferrable transaction concurrent with schema change
Previous Message johnthuss 2017-07-17 14:51:26 BUG #14748: Invalid statement should raise parse error, but ignores invalid part instead