pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #14748: Invalid statement should raise parse error, but ignores invalid part instead
2+ messages / 2 participants
[nested] [flat]

* BUG #14748: Invalid statement should raise parse error, but ignores invalid part instead
@ 2017-07-17 14:51  johnthuss@gmail.com
  0 siblings, 1 reply; 2+ messages in thread

From: johnthuss@gmail.com @ 2017-07-17 14:51 UTC (permalink / raw)
  To: pgsql-bugs; +Cc: johnthuss@gmail.com

The following bug has been logged on the website:

Bug reference:      14748
Logged by:          John Huss
Email address:      johnthuss@gmail.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.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #14748: Invalid statement should raise parse error, but ignores invalid part instead
@ 2017-07-17 14:58  Andres Freund <andres@anarazel.de>
  parent: johnthuss@gmail.com
  0 siblings, 0 replies; 2+ messages in thread

From: Andres Freund @ 2017-07-17 14:58 UTC (permalink / raw)
  To: johnthuss@gmail.com; +Cc: pgsql-bugs

On 2017-07-17 14:51:26 +0000, johnthuss@gmail.com wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      14748
> Logged by:          John Huss
> Email address:      johnthuss@gmail.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


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2017-07-17 14:58 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-07-17 14:51 BUG #14748: Invalid statement should raise parse error, but ignores invalid part instead johnthuss@gmail.com
2017-07-17 14:58 ` Andres Freund <andres@anarazel.de>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox