Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

PGPRO 7870 #266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 150 additions & 0 deletions expected/pathman_cache_pranks.out
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,155 @@ ERROR: can't partition table "part_test" with existing children
DROP TABLE part_test CASCADE;
NOTICE: drop cascades to 302 other objects
--
--
-- PGPRO-7870
-- Added error for case executing prepared query after DROP/CREATE EXTENSION.
--
-- DROP/CREATE extension
CREATE TABLE part_test(a INT4 NOT NULL, b INT4);
PREPARE q(int4) AS SELECT * FROM part_test WHERE a > ALL (array[$1, 898]);
SELECT create_range_partitions('part_test', 'a', 1, 100, 10);
create_range_partitions
-------------------------
10
(1 row)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

DROP EXTENSION pg_pathman;
CREATE EXTENSION pg_pathman;
EXECUTE q(1);
ERROR: table "part_test" is not partitioned
DEALLOCATE q;
DROP TABLE part_test CASCADE;
NOTICE: drop cascades to 11 other objects
-- DROP/CREATE disabled extension
CREATE TABLE part_test(a INT4 NOT NULL, b INT4);
PREPARE q(int4) AS SELECT * FROM part_test WHERE a > ALL (array[$1, 898]);
SELECT create_range_partitions('part_test', 'a', 1, 100, 10);
create_range_partitions
-------------------------
10
(1 row)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

SET pg_pathman.enable = f;
NOTICE: RuntimeAppend, RuntimeMergeAppend and PartitionFilter nodes and some other options have been disabled
DROP EXTENSION pg_pathman;
CREATE EXTENSION pg_pathman;
SET pg_pathman.enable = t;
NOTICE: RuntimeAppend, RuntimeMergeAppend and PartitionFilter nodes and some other options have been enabled
EXECUTE q(1);
ERROR: table "part_test" is not partitioned
DEALLOCATE q;
DROP TABLE part_test CASCADE;
NOTICE: drop cascades to 11 other objects
-- DROP/CREATE extension in autonomous transaction
CREATE TABLE part_test(a INT4 NOT NULL, b INT4);
PREPARE q(int4) AS SELECT * FROM part_test WHERE a > ALL (array[$1, 198]);
SELECT create_range_partitions('part_test', 'a', 1, 100, 2);
create_range_partitions
-------------------------
2
(1 row)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

BEGIN;
BEGIN AUTONOMOUS;
DROP EXTENSION pg_pathman;
CREATE EXTENSION pg_pathman;
COMMIT;
COMMIT;
EXECUTE q(1);
ERROR: table "part_test" is not partitioned
DEALLOCATE q;
DROP TABLE part_test CASCADE;
NOTICE: drop cascades to 3 other objects
-- finalize
DROP EXTENSION pg_pathman;
237 changes: 237 additions & 0 deletions expected/pathman_cache_pranks_1.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
\set VERBOSITY terse
-- is pathman (caches, in particular) strong enough to carry out this?
SET search_path = 'public';
-- make sure nothing breaks on disable/enable when nothing was initialized yet
SET pg_pathman.enable = false;
NOTICE: RuntimeAppend, RuntimeMergeAppend and PartitionFilter nodes and some other options have been disabled
SET pg_pathman.enable = true;
NOTICE: RuntimeAppend, RuntimeMergeAppend and PartitionFilter nodes and some other options have been enabled
-- wobble with create-drop ext: tests cached relids sanity
CREATE EXTENSION pg_pathman;
SET pg_pathman.enable = f;
NOTICE: RuntimeAppend, RuntimeMergeAppend and PartitionFilter nodes and some other options have been disabled
DROP EXTENSION pg_pathman;
CREATE EXTENSION pg_pathman;
SET pg_pathman.enable = true;
NOTICE: RuntimeAppend, RuntimeMergeAppend and PartitionFilter nodes and some other options have been enabled
DROP EXTENSION pg_pathman;
CREATE EXTENSION pg_pathman;
DROP EXTENSION pg_pathman;
-- create it for further tests
CREATE EXTENSION pg_pathman;
-- 079797e0d5
CREATE TABLE part_test(val serial);
INSERT INTO part_test SELECT generate_series(1, 30);
SELECT create_range_partitions('part_test', 'val', 1, 10);
create_range_partitions
-------------------------
3
(1 row)

SELECT set_interval('part_test', 100);
set_interval
--------------

(1 row)

DELETE FROM pathman_config WHERE partrel = 'part_test'::REGCLASS;
SELECT drop_partitions('part_test');
ERROR: table "part_test" has no partitions
SELECT disable_pathman_for('part_test');
disable_pathman_for
---------------------

(1 row)

CREATE TABLE wrong_partition (LIKE part_test) INHERITS (part_test);
NOTICE: merging column "val" with inherited definition
SELECT add_to_pathman_config('part_test', 'val', '10');
ERROR: constraint "pathman_wrong_partition_check" of partition "wrong_partition" does not exist
SELECT add_to_pathman_config('part_test', 'val');
ERROR: wrong constraint format for HASH partition "part_test_1"
DROP TABLE part_test CASCADE;
NOTICE: drop cascades to 5 other objects
--
-- 85fc5ccf121
CREATE TABLE part_test(val serial);
INSERT INTO part_test SELECT generate_series(1, 3000);
SELECT create_range_partitions('part_test', 'val', 1, 10);
create_range_partitions
-------------------------
300
(1 row)

SELECT append_range_partition('part_test');
append_range_partition
------------------------
part_test_301
(1 row)

DELETE FROM part_test;
SELECT create_single_range_partition('part_test', NULL::INT4, NULL); /* not ok */
ERROR: cannot create partition with range (-inf, +inf)
DELETE FROM pathman_config WHERE partrel = 'part_test'::REGCLASS;
SELECT create_hash_partitions('part_test', 'val', 2, partition_names := ARRAY[]::TEXT[]); /* not ok */
ERROR: can't partition table "part_test" with existing children
DROP TABLE part_test CASCADE;
NOTICE: drop cascades to 302 other objects
--
--
-- PGPRO-7870
-- Added error for case executing prepared query after DROP/CREATE EXTENSION.
--
-- DROP/CREATE extension
CREATE TABLE part_test(a INT4 NOT NULL, b INT4);
PREPARE q(int4) AS SELECT * FROM part_test WHERE a > ALL (array[$1, 898]);
SELECT create_range_partitions('part_test', 'a', 1, 100, 10);
create_range_partitions
-------------------------
10
(1 row)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

DROP EXTENSION pg_pathman;
CREATE EXTENSION pg_pathman;
EXECUTE q(1);
ERROR: table "part_test" is not partitioned
DEALLOCATE q;
DROP TABLE part_test CASCADE;
NOTICE: drop cascades to 11 other objects
-- DROP/CREATE disabled extension
CREATE TABLE part_test(a INT4 NOT NULL, b INT4);
PREPARE q(int4) AS SELECT * FROM part_test WHERE a > ALL (array[$1, 898]);
SELECT create_range_partitions('part_test', 'a', 1, 100, 10);
create_range_partitions
-------------------------
10
(1 row)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

SET pg_pathman.enable = f;
NOTICE: RuntimeAppend, RuntimeMergeAppend and PartitionFilter nodes and some other options have been disabled
DROP EXTENSION pg_pathman;
CREATE EXTENSION pg_pathman;
SET pg_pathman.enable = t;
NOTICE: RuntimeAppend, RuntimeMergeAppend and PartitionFilter nodes and some other options have been enabled
EXECUTE q(1);
ERROR: table "part_test" is not partitioned
DEALLOCATE q;
DROP TABLE part_test CASCADE;
NOTICE: drop cascades to 11 other objects
-- DROP/CREATE extension in autonomous transaction
CREATE TABLE part_test(a INT4 NOT NULL, b INT4);
PREPARE q(int4) AS SELECT * FROM part_test WHERE a > ALL (array[$1, 198]);
SELECT create_range_partitions('part_test', 'a', 1, 100, 2);
create_range_partitions
-------------------------
2
(1 row)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

EXECUTE q(1);
a | b
---+---
(0 rows)

BEGIN;
BEGIN AUTONOMOUS;
ERROR: syntax error at or near "AUTONOMOUS" at character 7
DROP EXTENSION pg_pathman;
ERROR: current transaction is aborted, commands ignored until end of transaction block
CREATE EXTENSION pg_pathman;
ERROR: current transaction is aborted, commands ignored until end of transaction block
COMMIT;
COMMIT;
WARNING: there is no transaction in progress
EXECUTE q(1);
a | b
---+---
(0 rows)

DEALLOCATE q;
DROP TABLE part_test CASCADE;
NOTICE: drop cascades to 3 other objects
-- finalize
DROP EXTENSION pg_pathman;
Loading