|
| 1 | +\set VERBOSITY terse |
| 2 | +-- is pathman (caches, in particular) strong enough to carry out this? |
| 3 | +SET search_path = 'public'; |
| 4 | +-- make sure nothing breaks on disable/enable when nothing was initialized yet |
| 5 | +SET pg_pathman.enable = false; |
| 6 | +NOTICE: RuntimeAppend, RuntimeMergeAppend and PartitionFilter nodes and some other options have been disabled |
| 7 | +SET pg_pathman.enable = true; |
| 8 | +NOTICE: RuntimeAppend, RuntimeMergeAppend and PartitionFilter nodes and some other options have been enabled |
| 9 | +-- wobble with create-drop ext: tests cached relids sanity |
| 10 | +CREATE EXTENSION pg_pathman; |
| 11 | +SET pg_pathman.enable = f; |
| 12 | +NOTICE: RuntimeAppend, RuntimeMergeAppend and PartitionFilter nodes and some other options have been disabled |
| 13 | +DROP EXTENSION pg_pathman; |
| 14 | +CREATE EXTENSION pg_pathman; |
| 15 | +SET pg_pathman.enable = true; |
| 16 | +NOTICE: RuntimeAppend, RuntimeMergeAppend and PartitionFilter nodes and some other options have been enabled |
| 17 | +DROP EXTENSION pg_pathman; |
| 18 | +CREATE EXTENSION pg_pathman; |
| 19 | +DROP EXTENSION pg_pathman; |
| 20 | +-- create it for further tests |
| 21 | +CREATE EXTENSION pg_pathman; |
| 22 | +-- 079797e0d5 |
| 23 | +CREATE TABLE part_test(val serial); |
| 24 | +INSERT INTO part_test SELECT generate_series(1, 30); |
| 25 | +SELECT create_range_partitions('part_test', 'val', 1, 10); |
| 26 | + create_range_partitions |
| 27 | +------------------------- |
| 28 | + 3 |
| 29 | +(1 row) |
| 30 | + |
| 31 | +SELECT set_interval('part_test', 100); |
| 32 | + set_interval |
| 33 | +-------------- |
| 34 | + |
| 35 | +(1 row) |
| 36 | + |
| 37 | +DELETE FROM pathman_config WHERE partrel = 'part_test'::REGCLASS; |
| 38 | +SELECT drop_partitions('part_test'); |
| 39 | +ERROR: table "part_test" has no partitions |
| 40 | +SELECT disable_pathman_for('part_test'); |
| 41 | + disable_pathman_for |
| 42 | +--------------------- |
| 43 | + |
| 44 | +(1 row) |
| 45 | + |
| 46 | +CREATE TABLE wrong_partition (LIKE part_test) INHERITS (part_test); |
| 47 | +NOTICE: merging column "val" with inherited definition |
| 48 | +SELECT add_to_pathman_config('part_test', 'val', '10'); |
| 49 | +ERROR: constraint "pathman_wrong_partition_check" of partition "wrong_partition" does not exist |
| 50 | +SELECT add_to_pathman_config('part_test', 'val'); |
| 51 | +ERROR: wrong constraint format for HASH partition "part_test_1" |
| 52 | +DROP TABLE part_test CASCADE; |
| 53 | +NOTICE: drop cascades to 5 other objects |
| 54 | +-- |
| 55 | +-- 85fc5ccf121 |
| 56 | +CREATE TABLE part_test(val serial); |
| 57 | +INSERT INTO part_test SELECT generate_series(1, 3000); |
| 58 | +SELECT create_range_partitions('part_test', 'val', 1, 10); |
| 59 | + create_range_partitions |
| 60 | +------------------------- |
| 61 | + 300 |
| 62 | +(1 row) |
| 63 | + |
| 64 | +SELECT append_range_partition('part_test'); |
| 65 | + append_range_partition |
| 66 | +------------------------ |
| 67 | + part_test_301 |
| 68 | +(1 row) |
| 69 | + |
| 70 | +DELETE FROM part_test; |
| 71 | +SELECT create_single_range_partition('part_test', NULL::INT4, NULL); /* not ok */ |
| 72 | +ERROR: cannot create partition with range (-inf, +inf) |
| 73 | +DELETE FROM pathman_config WHERE partrel = 'part_test'::REGCLASS; |
| 74 | +SELECT create_hash_partitions('part_test', 'val', 2, partition_names := ARRAY[]::TEXT[]); /* not ok */ |
| 75 | +ERROR: can't partition table "part_test" with existing children |
| 76 | +DROP TABLE part_test CASCADE; |
| 77 | +NOTICE: drop cascades to 302 other objects |
| 78 | +-- |
| 79 | +-- |
| 80 | +-- PGPRO-7870 |
| 81 | +-- Added error for case executing prepared query after DROP/CREATE EXTENSION. |
| 82 | +-- |
| 83 | +-- DROP/CREATE extension |
| 84 | +CREATE TABLE part_test(a INT4 NOT NULL, b INT4); |
| 85 | +PREPARE q(int4) AS SELECT * FROM part_test WHERE a > ALL (array[$1, 898]); |
| 86 | +SELECT create_range_partitions('part_test', 'a', 1, 100, 10); |
| 87 | + create_range_partitions |
| 88 | +------------------------- |
| 89 | + 10 |
| 90 | +(1 row) |
| 91 | + |
| 92 | +EXECUTE q(1); |
| 93 | + a | b |
| 94 | +---+--- |
| 95 | +(0 rows) |
| 96 | + |
| 97 | +EXECUTE q(1); |
| 98 | + a | b |
| 99 | +---+--- |
| 100 | +(0 rows) |
| 101 | + |
| 102 | +EXECUTE q(1); |
| 103 | + a | b |
| 104 | +---+--- |
| 105 | +(0 rows) |
| 106 | + |
| 107 | +EXECUTE q(1); |
| 108 | + a | b |
| 109 | +---+--- |
| 110 | +(0 rows) |
| 111 | + |
| 112 | +EXECUTE q(1); |
| 113 | + a | b |
| 114 | +---+--- |
| 115 | +(0 rows) |
| 116 | + |
| 117 | +EXECUTE q(1); |
| 118 | + a | b |
| 119 | +---+--- |
| 120 | +(0 rows) |
| 121 | + |
| 122 | +DROP EXTENSION pg_pathman; |
| 123 | +CREATE EXTENSION pg_pathman; |
| 124 | +EXECUTE q(1); |
| 125 | +ERROR: table "part_test" is not partitioned |
| 126 | +DEALLOCATE q; |
| 127 | +DROP TABLE part_test CASCADE; |
| 128 | +NOTICE: drop cascades to 11 other objects |
| 129 | +-- DROP/CREATE disabled extension |
| 130 | +CREATE TABLE part_test(a INT4 NOT NULL, b INT4); |
| 131 | +PREPARE q(int4) AS SELECT * FROM part_test WHERE a > ALL (array[$1, 898]); |
| 132 | +SELECT create_range_partitions('part_test', 'a', 1, 100, 10); |
| 133 | + create_range_partitions |
| 134 | +------------------------- |
| 135 | + 10 |
| 136 | +(1 row) |
| 137 | + |
| 138 | +EXECUTE q(1); |
| 139 | + a | b |
| 140 | +---+--- |
| 141 | +(0 rows) |
| 142 | + |
| 143 | +EXECUTE q(1); |
| 144 | + a | b |
| 145 | +---+--- |
| 146 | +(0 rows) |
| 147 | + |
| 148 | +EXECUTE q(1); |
| 149 | + a | b |
| 150 | +---+--- |
| 151 | +(0 rows) |
| 152 | + |
| 153 | +EXECUTE q(1); |
| 154 | + a | b |
| 155 | +---+--- |
| 156 | +(0 rows) |
| 157 | + |
| 158 | +EXECUTE q(1); |
| 159 | + a | b |
| 160 | +---+--- |
| 161 | +(0 rows) |
| 162 | + |
| 163 | +EXECUTE q(1); |
| 164 | + a | b |
| 165 | +---+--- |
| 166 | +(0 rows) |
| 167 | + |
| 168 | +SET pg_pathman.enable = f; |
| 169 | +NOTICE: RuntimeAppend, RuntimeMergeAppend and PartitionFilter nodes and some other options have been disabled |
| 170 | +DROP EXTENSION pg_pathman; |
| 171 | +CREATE EXTENSION pg_pathman; |
| 172 | +SET pg_pathman.enable = t; |
| 173 | +NOTICE: RuntimeAppend, RuntimeMergeAppend and PartitionFilter nodes and some other options have been enabled |
| 174 | +EXECUTE q(1); |
| 175 | +ERROR: table "part_test" is not partitioned |
| 176 | +DEALLOCATE q; |
| 177 | +DROP TABLE part_test CASCADE; |
| 178 | +NOTICE: drop cascades to 11 other objects |
| 179 | +-- DROP/CREATE extension in autonomous transaction |
| 180 | +CREATE TABLE part_test(a INT4 NOT NULL, b INT4); |
| 181 | +PREPARE q(int4) AS SELECT * FROM part_test WHERE a > ALL (array[$1, 198]); |
| 182 | +SELECT create_range_partitions('part_test', 'a', 1, 100, 2); |
| 183 | + create_range_partitions |
| 184 | +------------------------- |
| 185 | + 2 |
| 186 | +(1 row) |
| 187 | + |
| 188 | +EXECUTE q(1); |
| 189 | + a | b |
| 190 | +---+--- |
| 191 | +(0 rows) |
| 192 | + |
| 193 | +EXECUTE q(1); |
| 194 | + a | b |
| 195 | +---+--- |
| 196 | +(0 rows) |
| 197 | + |
| 198 | +EXECUTE q(1); |
| 199 | + a | b |
| 200 | +---+--- |
| 201 | +(0 rows) |
| 202 | + |
| 203 | +EXECUTE q(1); |
| 204 | + a | b |
| 205 | +---+--- |
| 206 | +(0 rows) |
| 207 | + |
| 208 | +EXECUTE q(1); |
| 209 | + a | b |
| 210 | +---+--- |
| 211 | +(0 rows) |
| 212 | + |
| 213 | +EXECUTE q(1); |
| 214 | + a | b |
| 215 | +---+--- |
| 216 | +(0 rows) |
| 217 | + |
| 218 | +BEGIN; |
| 219 | + BEGIN AUTONOMOUS; |
| 220 | +ERROR: syntax error at or near "AUTONOMOUS" at character 7 |
| 221 | + DROP EXTENSION pg_pathman; |
| 222 | +ERROR: current transaction is aborted, commands ignored until end of transaction block |
| 223 | + CREATE EXTENSION pg_pathman; |
| 224 | +ERROR: current transaction is aborted, commands ignored until end of transaction block |
| 225 | + COMMIT; |
| 226 | +COMMIT; |
| 227 | +WARNING: there is no transaction in progress |
| 228 | +EXECUTE q(1); |
| 229 | + a | b |
| 230 | +---+--- |
| 231 | +(0 rows) |
| 232 | + |
| 233 | +DEALLOCATE q; |
| 234 | +DROP TABLE part_test CASCADE; |
| 235 | +NOTICE: drop cascades to 3 other objects |
| 236 | +-- finalize |
| 237 | +DROP EXTENSION pg_pathman; |
0 commit comments