Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fe70668

Browse files
committed
Add test files for declarative syntax
1 parent 722ddb0 commit fe70668

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -67,9 +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
71+
7072
ifdef USE_PGXS
7173
PG_CONFIG = pg_config
7274
PGXS := $(shell $(PG_CONFIG) --pgxs)
75+
VNUM := $(shell $(PG_CONFIG) --version | awk '{print $$2}')
76+
ifeq ($(VNUM),$(filter $(VNUM), $(DECL_CHECK_VERSIONS)))
77+
REGRESS += pathman_declarative
78+
endif
7379
include $(PGXS)
7480
else
7581
subdir = contrib/pg_pathman

expected/pathman_declarative.out

Whitespace-only changes.

sql/pathman_declarative.sql

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
\set VERBOSITY terse
2+
3+
SET search_path = 'public';
4+
CREATE SCHEMA pathman;
5+
CREATE EXTENSION pg_pathman SCHEMA pathman;
6+
CREATE SCHEMA test;
7+
8+
CREATE TABLE test.range_rel (
9+
id SERIAL PRIMARY KEY,
10+
dt DATE NOT NULL
11+
);
12+
13+
INSERT INTO test.range_rel (dt)
14+
SELECT g FROM generate_series('2015-01-01', '2015-04-30', '1 day'::interval) AS g;
15+
SELECT pathman.create_range_partitions('test.range_rel', 'dt',
16+
'2015-01-01'::DATE, '1 month'::INTERVAL);
17+
18+
SELECT * FROM pathman_partition_list;
19+
CREATE TABLE test.r2 LIKE (test.range_rel);
20+
ALTER TABLE test.range_rel ATTACH PARTITION test.r2
21+
FOR VALUES FROM ('2015-05-01') TO ('2015-06-01');
22+
SELECT * FROM pathman_partition_list;
23+
\d+ test.r2;
24+
ALTER TABLE test.range_rel DETACH PARTITION test.r2;
25+
SELECT * FROM pathman_partition_list;
26+
\d+ test.r2;
27+
28+
DROP SCHEMA test CASCADE;
29+
DROP EXTENSION pg_pathman CASCADE;
30+
DROP SCHEMA pathman CASCADE;

0 commit comments

Comments
 (0)