BUG #12950: Update problem
BUG #12950: Update problem
От:
robert.uradin@gmail.com
Дата:
The following bug has been logged on the website:
Bug reference: 12950
Logged by: Robert
Email address: robert.uradin@gmail.com
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 subRe: BUG #12950: Update problem
От:
"David G. Johnston" <david.g.johnston@gmail.com>
Дата:
On Thursday, April 2, 2015, wrote: > The following bug has been logged on the website: > > Bug reference: 12950 > Logged by: Robert > Email address: robert.uradin@gmail.com > 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.