Skip to content

Commit 4de7727

Browse files
committed
Adapt to 3737965249c fix of CREATE TABLE LIKE with inheritance.
Since it LIKE must be handled after DefineRelation -- do it so. (added ifdef won't work for current dev branches as PG_VERSION_NUM is not bumped yet, but will do its job after releases)
1 parent bf0a84c commit 4de7727

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/partition_creation.c

+31
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,37 @@ create_single_partition_internal(Oid parent_relid,
854854
{
855855
elog(ERROR, "FDW partition creation is not implemented yet");
856856
}
857+
/*
858+
* 3737965249cd fix (since 12.5, 11.10, etc) reworked LIKE handling
859+
* to process it after DefineRelation.
860+
*/
861+
#if (PG_VERSION_NUM >= 130000) || \
862+
((PG_VERSION_NUM < 130000) && (PG_VERSION_NUM >= 120005)) || \
863+
((PG_VERSION_NUM < 120000) && (PG_VERSION_NUM >= 110010)) || \
864+
((PG_VERSION_NUM < 110000) && (PG_VERSION_NUM >= 100015)) || \
865+
((PG_VERSION_NUM < 100000) && (PG_VERSION_NUM >= 90620)) || \
866+
((PG_VERSION_NUM < 90600) && (PG_VERSION_NUM >= 90524))
867+
else if (IsA(cur_stmt, TableLikeClause))
868+
{
869+
/*
870+
* Do delayed processing of LIKE options. This
871+
* will result in additional sub-statements for us
872+
* to process. We can just tack those onto the
873+
* to-do list.
874+
*/
875+
TableLikeClause *like = (TableLikeClause *) cur_stmt;
876+
RangeVar *rv = create_stmt.relation;
877+
List *morestmts;
878+
879+
morestmts = expandTableLikeClause(rv, like);
880+
create_stmts = list_concat(create_stmts, morestmts);
881+
882+
/*
883+
* We don't need a CCI now
884+
*/
885+
continue;
886+
}
887+
#endif
857888
else
858889
{
859890
/*

0 commit comments

Comments
 (0)