diff options
Diffstat (limited to 'src/backend/parser/parse_utilcmd.c')
-rw-r--r-- | src/backend/parser/parse_utilcmd.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c index 6e5768c66cf..ee475476248 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -1023,11 +1023,13 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla attmap[parent_attno - 1] = list_length(cxt->columns); /* - * Copy default, if present and the default has been requested + * Copy default, if present and it should be copied. We have separate + * options for plain default expressions and GENERATED defaults. */ if (attribute->atthasdef && - (table_like_clause->options & CREATE_TABLE_LIKE_DEFAULTS || - table_like_clause->options & CREATE_TABLE_LIKE_GENERATED)) + (attribute->attgenerated ? + (table_like_clause->options & CREATE_TABLE_LIKE_GENERATED) : + (table_like_clause->options & CREATE_TABLE_LIKE_DEFAULTS))) { Node *this_default = NULL; AttrDefault *attrdef; @@ -1065,9 +1067,7 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla attributeName, RelationGetRelationName(relation)))); - if (attribute->attgenerated && - (table_like_clause->options & CREATE_TABLE_LIKE_GENERATED)) - def->generated = attribute->attgenerated; + def->generated = attribute->attgenerated; } /* |