• Tom Lane's avatar
    Behave correctly if INSERT ... VALUES is decorated with additional clauses. · 3a13f12b
    Tom Lane authored
    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.
    3a13f12b
analyze.c 68.6 KB