Re: BUG #12950: Update problem - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: BUG #12950: Update problem
Date
Msg-id CAKFQuwZUrCxZDR9xT7Nnicz+hRVQzsiPf+KKJzBOts3UEQ2ARg@mail.gmail.com
Whole thread Raw
In response to BUG #12950: Update problem  (robert.uradin@gmail.com)
List pgsql-bugs
On Thursday, April 2, 2015, <robert.uradin@gmail.com> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      12950
> Logged by:          Robert
> Email address:      robert.uradin@gmail.com <javascript:;>
> PostgreSQL version: 9.3.6
> Operating system:   Win 7
> Description:
>
> not executing like none UPDATE command, colleagues with the same username
> and password entered and executed from another computer without any
> problem,
> can you help me what is the problem, thanks!
>
>
> error:
>
> ERROR:  syntax error at or near "set"
> LINE 1: SELECT COUNT(*) AS total FROM (UPDATE belot_user set permane...
>                                                          ^
> In statement:
> SELECT COUNT(*) AS total FROM (UPDATE belot_user set permanent_ban=1 where
> fb_last_used_name='Robert Uradin') AS sub
>
>
If you put the UPDATE in a WITH (cte) and add a RETURNING you can make this
work.  If your colleague got this to work as written, on PostgreSQL, you
shoud probably ask them what you are doing wrong/different.  The update,
especially without returning, is not a valid relation so cannot be placed
in the FROM clause.  I'm somewhat surprised the parser made it to the word
set before choking as I would have thought the update would be
rejected...but unlike the sql standard Postgresql has managed to leave
update unreserved.

David J.

pgsql-bugs by date:

Previous
From: Peter Slavov
Date:
Subject: Re: BUG #12910: Memory leak with logical decoding
Next
From: Michael Paquier
Date:
Subject: Re: src/port/getopt_long.c lossy with arguments having no option characters