Handle AT_CookedColumnDefault in process_utility

Postgres added a new alter table subcommand in a bugfix for
CREATE TABLE LIKE with inheritance which got backported to previous
versions. We check for presence of the subcommand with cmake so
we can support building on snapshot versions which also fixes the
ABI breakage test.

5028981923
This commit is contained in:
Sven Klemm 2020-08-27 20:08:02 +02:00 committed by Sven Klemm
parent d19f93e191
commit 509e48ea9a
2 changed files with 12 additions and 0 deletions

View File

@ -37,6 +37,15 @@ if(APACHE_ONLY)
add_definitions(-DAPACHE_ONLY) add_definitions(-DAPACHE_ONLY)
endif() endif()
# AT_CookedColumnDefault was backported to PG12 but is not yet in a released version.
# To be able to build against snapshots and REL_12_STABLE branch we check header file
# for existance. Once PG 12.5 is out this can safely be turned into a version check.
file(READ ${PG_INCLUDEDIR_SERVER}/nodes/parsenodes.h PG_PARSENODES_H)
string(REGEX MATCH "AT_CookedColumnDefault" PG_HAS_COOKEDCOLUMNDEFAULT ${PG_CONFIG_H})
if (PG_HAS_COOKEDCOLUMNDEFAULT)
add_definitions(-DPG_HAS_COOKEDCOLUMNDEFAULT)
endif()
include_directories(${PROJECT_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/src) include_directories(${PROJECT_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/src)
include_directories(SYSTEM ${PG_INCLUDEDIR_SERVER}) include_directories(SYSTEM ${PG_INCLUDEDIR_SERVER})

View File

@ -2948,6 +2948,9 @@ process_altertable_end_subcmd(Hypertable *ht, Node *parsetree, ObjectAddress *ob
case AT_SetLogged: case AT_SetLogged:
case AT_SetStorage: case AT_SetStorage:
case AT_ColumnDefault: case AT_ColumnDefault:
#ifdef PG_HAS_COOKEDCOLUMNDEFAULT
case AT_CookedColumnDefault:
#endif
case AT_SetNotNull: case AT_SetNotNull:
#if PG12_GE #if PG12_GE
case AT_CheckNotNull: case AT_CheckNotNull: