Skip to content

Commit e426c71

Browse files
committed
Enable compilation of declarative syntax only for pg10+
1 parent ca9f9eb commit e426c71

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ OBJS = src/init.o src/relation_info.o src/utils.o src/partition_filter.o \
88
src/hooks.o src/nodes_common.o src/xact_handling.o src/utility_stmt_hooking.o \
99
src/planner_tree_modification.o src/debug_print.o src/partition_creation.o \
1010
src/compat/pg_compat.o src/compat/rowmarks_fix.o src/partition_router.o \
11-
src/partition_overseer.o src/declarative.o $(WIN32RES)
11+
src/partition_overseer.o $(WIN32RES)
1212

1313
ifdef USE_PGXS
1414
override PG_CPPFLAGS += -I$(CURDIR)/src/include
@@ -67,14 +67,15 @@ EXTRA_REGRESS_OPTS=--temp-config=$(top_srcdir)/$(subdir)/conf.add
6767

6868
EXTRA_CLEAN = pg_pathman--$(EXTVERSION).sql ./isolation_output
6969

70-
DECL_CHECK_VERSIONS = 10beta1
70+
DECL_CHECK_VERSIONS = 10 11
7171

7272
ifdef USE_PGXS
7373
PG_CONFIG = pg_config
7474
PGXS := $(shell $(PG_CONFIG) --pgxs)
7575
VNUM := $(shell $(PG_CONFIG) --version | awk '{print $$2}')
7676
ifeq ($(VNUM),$(filter $(VNUM), $(DECL_CHECK_VERSIONS)))
7777
REGRESS += pathman_declarative
78+
OBJS += src/declarative.o
7879
endif
7980
include $(PGXS)
8081
else

src/hooks.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,13 @@ pathman_post_parse_analyze_hook(ParseState *pstate, Query *query)
818818
return;
819819
}
820820

821+
#if PG_VERSION_NUM >= 100000
822+
/*
823+
* for now this call works only for declarative partitioning so
824+
* we disabled it
825+
*/
821826
pathman_post_analyze_query(query);
827+
#endif
822828
}
823829

824830
/*
@@ -956,6 +962,7 @@ pathman_process_utility_hook(Node *first_arg,
956962
get_attname_compat(relation_oid, attr_number),
957963
get_rel_name(relation_oid))));
958964
}
965+
#if PG_VERSION_NUM >= 100000
959966
else if (is_pathman_related_partitioning_cmd(parsetree))
960967
{
961968
/* we can handle all the partitioning commands */
@@ -981,6 +988,7 @@ pathman_process_utility_hook(Node *first_arg,
981988
}
982989
}
983990
}
991+
#endif
984992
}
985993

986994
/* Finally call process_utility_hook_next or standard_ProcessUtility */

src/include/declarative.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
#include "nodes/nodes.h"
66
#include "nodes/parsenodes.h"
77

8-
typedef enum DeclarativeCommandType {
9-
DP_ATTACH, /* ALTER TABLE .. ATTACH PARTITION */
10-
DP_DETACH /* ALTER TABLE .. DETACH PARTITION */
11-
} DeclarativeCommandType;
12-
138
void modify_declative_partitioning_query(Query *query);
149
bool is_pathman_related_partitioning_cmd(Node *parsetree);
1510

src/planner_tree_modification.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,9 @@ pathman_post_analyze_query_walker(Node *node, void *context)
429429
Query *query = (Query *) node;
430430

431431
/* Make changes for declarative syntax */
432+
#if PG_VERSION_NUM >= 100000
432433
modify_declative_partitioning_query(query);
434+
#endif
433435

434436
/* Handle Query node */
435437
return query_tree_walker(query,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy