]> granicus.if.org Git - postgresql/commit
Behave correctly if INSERT ... VALUES is decorated with additional clauses.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 3 Oct 2010 00:02:41 +0000 (20:02 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 3 Oct 2010 00:02:41 +0000 (20:02 -0400)
commit9e718e6116d2ace2faff8cce3d907fcf69bb6416
treed4b80712492df38397fda1699a145b7097f57389
parent4b1501cb119f90892c0e0c2fabbd368baf7a106e
Behave correctly if INSERT ... VALUES is decorated with additional clauses.

In versions 8.2 and up, the grammar allows attaching ORDER BY, LIMIT,
FOR UPDATE, or WITH to VALUES, and hence to INSERT ... VALUES.  But the
special-case code for VALUES in transformInsertStmt() wasn't expecting any
of those, and just ignored them, leading to unexpected results.  Rather
than complicate the special-case path, just ensure that the presence of any
of those clauses makes us treat the query as if it had a general SELECT.
Per report from Hitoshi Harada.
src/backend/parser/analyze.c