From 3a18286a5c6837d8d0d772cff569db06d1fca694 Mon Sep 17 00:00:00 2001 From: Julien Rouhaud Date: Sat, 17 Nov 2018 12:01:11 +0100 Subject: [PATCH] Add specific regression tests for pg10- versions --- Makefile | 14 +++++++++++--- expected/hypo_no_table.out | 28 ++++++++++++++++++++++++++++ test/sql/hypo_no_table.sql | 16 ++++++++++++++++ 3 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 expected/hypo_no_table.out create mode 100644 test/sql/hypo_no_table.sql diff --git a/Makefile b/Makefile index 2f629d6..31e2b5f 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,11 @@ EXTENSION = hypopg EXTVERSION = $(shell grep default_version $(EXTENSION).control | sed -e "s/default_version[[:space:]]*=[[:space:]]*'\([^']*\)'/\1/") TESTS = $(wildcard test/sql/*.sql) + +# more test are added later, after including pgxs REGRESS = hypo_setup \ - hypo_index \ - hypo_table \ - hypo_index_table + hypo_index + REGRESS_OPTS = --inputdir=test @@ -32,6 +33,13 @@ DATA = $(wildcard *--*.sql) PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) +ifeq ($(MAJORVERSION),$(filter $(MAJORVERSION),9.2 9.3 9.4 9.5 9.6)) + REGRESS += hypo_no_table +else + REGRESS += hypo_table \ + hypo_index_table +endif + DEBUILD_ROOT = /tmp/$(EXTENSION) deb: release-zip diff --git a/expected/hypo_no_table.out b/expected/hypo_no_table.out new file mode 100644 index 0000000..2f7484c --- /dev/null +++ b/expected/hypo_no_table.out @@ -0,0 +1,28 @@ +-- Test for pg versions that don't support declarative partitioning +-- ================================================================ +-- 0. Dropping any hypothetical object +SELECT * FROM hypopg_reset(); + hypopg_reset +-------------- + +(1 row) + +-- 1. partition test +CREATE TABLE hypo_part_range (id integer, val text); +SELECT * FROM hypopg_partition_table('hypo_part_range', 'PARTITION BY RANGE (id)'); +ERROR: hypopg: Hypothetical partitioning requires PostgreSQl 10 or above +SELECT tablename FROM hypopg_add_partition('hypo_part_range_1_10000', 'PARTITION OF hypo_part_range FOR VALUES FROM (1) TO (10000)'); +ERROR: hypopg: Hypothetical partitioning requires PostgreSQl 10 or above +-- 2. other functions +SELECT * FROM hypopg_reset_table(); +ERROR: hypopg: Hypothetical partitioning requires PostgreSQl 10 or above +SELECT * FROM hypopg_drop_table('hypo_part_range'::regclass); +ERROR: hypopg: Hypothetical partitioning requires PostgreSQl 10 or above +SELECT * FROM hypopg_table(); +ERROR: hypopg: Hypothetical partitioning requires PostgreSQl 10 or above +SELECT * FROM hypopg_analyze('hypo_part_range'); +ERROR: hypopg: Hypothetical partitioning requires PostgreSQl 10 or above +SELECT * FROM hypopg_statistic(); +ERROR: hypopg: Hypothetical partitioning requires PostgreSQl 10 or above +SELECT * FROM hypopg_stats; +ERROR: hypopg: Hypothetical partitioning requires PostgreSQl 10 or above diff --git a/test/sql/hypo_no_table.sql b/test/sql/hypo_no_table.sql new file mode 100644 index 0000000..f459955 --- /dev/null +++ b/test/sql/hypo_no_table.sql @@ -0,0 +1,16 @@ +-- Test for pg versions that don't support declarative partitioning +-- ================================================================ + +-- 0. Dropping any hypothetical object +SELECT * FROM hypopg_reset(); +-- 1. partition test +CREATE TABLE hypo_part_range (id integer, val text); +SELECT * FROM hypopg_partition_table('hypo_part_range', 'PARTITION BY RANGE (id)'); +SELECT tablename FROM hypopg_add_partition('hypo_part_range_1_10000', 'PARTITION OF hypo_part_range FOR VALUES FROM (1) TO (10000)'); +-- 2. other functions +SELECT * FROM hypopg_reset_table(); +SELECT * FROM hypopg_drop_table('hypo_part_range'::regclass); +SELECT * FROM hypopg_table(); +SELECT * FROM hypopg_analyze('hypo_part_range'); +SELECT * FROM hypopg_statistic(); +SELECT * FROM hypopg_stats;