Reject MERGE in CTEs and COPY
authorAlvaro Herrera <[email protected]>
Fri, 12 Aug 2022 10:05:50 +0000 (12:05 +0200)
committerAlvaro Herrera <[email protected]>
Fri, 12 Aug 2022 10:05:50 +0000 (12:05 +0200)
commit92af9143f13df8c54362ebbd4397cb53f207ff2d
tree910a3a67d8aeb757872f24578c7052a9698fd09f
parente7a552f303c56788d52ca4e46490236845662734
Reject MERGE in CTEs and COPY

The grammar added for MERGE inadvertently made it accepted syntax in
places that were not prepared to deal with it -- namely COPY and inside
CTEs, but invoking these things with MERGE currently causes assertion
failures or weird misbehavior in non-assertion builds.  Protect those
places by checking for it explicitly until somebody decides to implement
it.

Reported-by: Alexey Borzov <[email protected]>
Discussion: https://postgr.es/m/17579-82482cd7b267b862@postgresql.org
src/backend/commands/copy.c
src/backend/parser/parse_cte.c
src/test/regress/expected/merge.out
src/test/regress/sql/merge.sql