1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Add partitioned table support to sepgsql

The new partitioned table capability added a new relkind, namely
RELKIND_PARTITIONED_TABLE. Update sepgsql to treat this new relkind
exactly the same way it does RELKIND_RELATION.

In addition, add regression test coverage for partitioned tables.

Issue raised by Stephen Frost and initial patch by Mike Palmiotto.
Review by Tom Lane and Robert Haas, and editorializing by me.

Discussion: https://postgr.es/m/flat/623bcaae-112e-ced0-8c22-a84f75ae0c53%40joeconway.com
This commit is contained in:
Joe Conway
2017-04-09 14:01:58 -07:00
parent eef8c0069e
commit 25542d77dd
13 changed files with 1154 additions and 69 deletions

View File

@ -10,17 +10,31 @@ LOAD '$libdir/sepgsql'; -- failed
CREATE TABLE t1 (x int, y text);
INSERT INTO t1 (SELECT x, md5(x::text) FROM generate_series(1,100) x);
CREATE TABLE t1p (o int, p text) PARTITION BY RANGE (o);
CREATE TABLE t1p_ones PARTITION OF t1p FOR VALUES FROM ('0') TO ('10');
CREATE TABLE t1p_tens PARTITION OF t1p FOR VALUES FROM ('10') TO ('100');
INSERT INTO t1p (SELECT x, md5(x::text) FROM generate_series(0,99) x);
SET sepgsql.debug_audit = on;
SET client_min_messages = log;
-- regular function and operators
SELECT * FROM t1 WHERE x > 50 AND y like '%64%';
SELECT * FROM t1p WHERE o > 50 AND p like '%64%';
SELECT * FROM t1p_ones WHERE o > 50 AND p like '%64%';
SELECT * FROM t1p_tens WHERE o > 50 AND p like '%64%';
-- aggregate function
SELECT MIN(x), AVG(x) FROM t1;
SELECT MIN(o), AVG(o) FROM t1p;
SELECT MIN(o), AVG(o) FROM t1p_ones;
SELECT MIN(o), AVG(o) FROM t1p_tens;
-- window function
SELECT row_number() OVER (order by x), * FROM t1 WHERE y like '%86%';
SELECT row_number() OVER (order by o), * FROM t1p WHERE p like '%86%';
SELECT row_number() OVER (order by o), * FROM t1p_ones WHERE p like '%86%';
SELECT row_number() OVER (order by o), * FROM t1p_tens WHERE p like '%86%';
RESET sepgsql.debug_audit;
RESET client_min_messages;
@ -28,3 +42,4 @@ RESET client_min_messages;
-- Cleanup
--
DROP TABLE IF EXISTS t1 CASCADE;
DROP TABLE IF EXISTS t1p CASCADE;