pgsql: Behave correctly if INSERT ... VALUES is decorated with addition

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Behave correctly if INSERT ... VALUES is decorated with addition
Date: 2010-10-03 00:03:33
Message-ID: E1P2C3B-0006t2-W5@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
REL8_4_STABLE

Details
-------
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=9e718e6116d2ace2faff8cce3d907fcf69bb6416

Modified Files
--------------
src/backend/parser/analyze.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message User Achernow 2010-10-03 21:01:43 libpqtypes - libpqtypes: Fixed crash bug in events.c during PQreset
Previous Message Tom Lane 2010-10-02 22:43:05 pgsql: Remove excess argument to open(2).