Skip to content

Commit b19f72c

Browse files
committed
Define compatible version for RelationDefine routine
1 parent c436b29 commit b19f72c

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

src/include/compat/pg_compat.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,21 @@
6868
#endif
6969

7070

71+
/*
72+
* DefineRelation()
73+
*
74+
* for v10 set NULL on 'queryString' parameter as it uses only under vanilla
75+
* partition creating
76+
*/
77+
#if PG_VERSION_NUM >= 100000
78+
#define DefineRelationCompat(createstmt, relkind, ownerId, typaddress) \
79+
DefineRelation((createstmt), (relkind), (ownerId), (typaddress), NULL)
80+
#elif PG_VERSION_NUM >= 90500
81+
#define DefineRelationCompat(createstmt, relkind, ownerId, typaddress) \
82+
DefineRelation((createstmt), (relkind), (ownerId), (typaddress))
83+
#endif
84+
85+
7186
/*
7287
* CatalogIndexInsert()
7388
*/

src/partition_creation.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -858,11 +858,8 @@ create_table_using_stmt(CreateStmt *create_stmt, Oid relowner)
858858
GUC_ACTION_SAVE, true, 0, false);
859859

860860
/* Create new partition owned by parent's posessor */
861-
#if PG_VERSION_NUM >= 100000
862-
table_addr = DefineRelation(create_stmt, RELKIND_RELATION, relowner, NULL, NULL);
863-
#else
864-
table_addr = DefineRelation(create_stmt, RELKIND_RELATION, relowner, NULL);
865-
#endif
861+
table_addr = DefineRelationCompat(create_stmt, RELKIND_RELATION, relowner,
862+
NULL);
866863

867864
/* Save data about a simple DDL command that was just executed */
868865
EventTriggerCollectSimpleCommand(table_addr,

0 commit comments

Comments
 (0)