Adrian Klaver <adrian.klaver@aklaver.com> writes:
> On 9/12/19 6:44 AM, Tom Lane wrote:
>> No, it's *exactly* as if that. UPDATE is an unreserved
>> keyword so it's fully legitimate as a table name.
> I am not following.
Sure, the WITH thing works too. The point is that given
"SELECT ... FROM (UPDATE ...)", there is a workable parse
path where UPDATE is treated as a table name. So if you
try to put an UPDATE command there, the syntax error
isn't thrown till a couple tokens later, where the
table-name syntax no longer matches. The OP's question
was about why the error was thrown where it was, not about
how to do this correctly.
regards, tom lane