aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_relation.c
diff options
context:
space:
mode:
authorSimon Riggs <simon@2ndQuadrant.com>2018-04-02 21:12:47 +0100
committerSimon Riggs <simon@2ndQuadrant.com>2018-04-02 21:12:47 +0100
commit354f13855e6381d288dfaa52bcd4f2cb0fd4a5eb (patch)
tree92710660450acee59be62dea485cc26ab147f332 /src/backend/parser/parse_relation.c
parente6597dc3533946b98acba7871bd4ca1f7a3d4c1d (diff)
downloadpostgresql-354f13855e6381d288dfaa52bcd4f2cb0fd4a5eb.tar.gz
postgresql-354f13855e6381d288dfaa52bcd4f2cb0fd4a5eb.zip
Modified files for MERGE
Diffstat (limited to 'src/backend/parser/parse_relation.c')
-rw-r--r--src/backend/parser/parse_relation.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c
index 053ae02c9fe..f7e11f969c0 100644
--- a/src/backend/parser/parse_relation.c
+++ b/src/backend/parser/parse_relation.c
@@ -728,6 +728,16 @@ scanRTEForColumn(ParseState *pstate, RangeTblEntry *rte, const char *colname,
colname),
parser_errposition(pstate, location)));
+ /* In MERGE WHEN AND condition, no system column is allowed except tableOid or OID */
+ if (pstate->p_expr_kind == EXPR_KIND_MERGE_WHEN_AND &&
+ attnum < InvalidAttrNumber &&
+ !(attnum == TableOidAttributeNumber || attnum == ObjectIdAttributeNumber))
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
+ errmsg("system column \"%s\" reference in WHEN AND condition is invalid",
+ colname),
+ parser_errposition(pstate, location)));
+
if (attnum != InvalidAttrNumber)
{
/* now check to see if column actually is defined */