diff options
author | Pavan Deolasee | 2017-08-18 08:47:35 +0000 |
---|---|---|
committer | Pavan Deolasee | 2017-08-18 08:47:35 +0000 |
commit | 72fdde3af5005f5a88e3f216dcd830537acdc53f (patch) | |
tree | a9abb693043175061d9e85b9cc439e7f705279be | |
parent | 6ffaa68d613944030771c8c7c7f40dd306dd3dea (diff) |
Generate a DEFAULT clause for identity columns
Recent changes in PG 10 generates a nextval() expression (there was no support
for NextValExpr in ruleutils before that). But that fails on the datanode side
because only DEFAULT values are accepted for identity columns, unless
overridden. This patch restores the XL behaviour, thus helping the regression.
-rw-r--r-- | src/backend/utils/adt/ruleutils.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index adc56bb7d3..347a481274 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -8893,6 +8893,22 @@ get_rule_expr(Node *node, deparse_context *context, } break; + case T_NextValueExpr: + { + /* + * This gets invoked by Fast Query Shipping code to deparse a + * query. It seems enough to just generate a "DEFAULT" clause + * and let the remote datanode handle finding the correct + * sequence for replica identity. + * + * XXX PG10MERGE: If we do see issues with this, it might be + * worthwhile to consider generating an expression such as, + * nextval('sequence_name'::regclass) + */ + appendStringInfoString(buf, "DEFAULT"); + } + break; + case T_XmlExpr: { XmlExpr *xexpr = (XmlExpr *) node; @@ -9176,22 +9192,6 @@ get_rule_expr(Node *node, deparse_context *context, } break; - case T_NextValueExpr: - { - NextValueExpr *nvexpr = (NextValueExpr *) node; - - /* - * This isn't exactly nextval(), but that seems close enough - * for EXPLAIN's purposes. - */ - appendStringInfoString(buf, "nextval("); - simple_quote_literal(buf, - generate_relation_name(nvexpr->seqid, - NIL)); - appendStringInfoChar(buf, ')'); - } - break; - case T_InferenceElem: { InferenceElem *iexpr = (InferenceElem *) node; |