Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6d9494d

Browse files
committed
Fix some tests
1 parent44dce9d commit6d9494d

File tree

5 files changed

+34
-67
lines changed

5 files changed

+34
-67
lines changed

‎expected/pathman_calamity.out

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -206,31 +206,6 @@ NOTICE: function calamity.part_test_upd_trig_func() does not exist, skipping
206206
(1 row)
207207

208208
DELETE FROM calamity.part_test;
209-
/* check function build_hash_condition() */
210-
SELECT build_hash_condition('int4', 'val', 10, 1);
211-
build_hash_condition
212-
-------------------------------------------------
213-
public.get_hash_part_idx(hashint4(val), 10) = 1
214-
(1 row)
215-
216-
SELECT build_hash_condition('text', 'val', 10, 1);
217-
build_hash_condition
218-
-------------------------------------------------
219-
public.get_hash_part_idx(hashtext(val), 10) = 1
220-
(1 row)
221-
222-
SELECT build_hash_condition('int4', 'val', 1, 1);
223-
ERROR: 'partition_index' must be lower than 'partitions_count'
224-
SELECT build_hash_condition('int4', 'val', 10, 20);
225-
ERROR: 'partition_index' must be lower than 'partitions_count'
226-
SELECT build_hash_condition('text', 'val', 10, NULL) IS NULL;
227-
?column?
228-
----------
229-
t
230-
(1 row)
231-
232-
SELECT build_hash_condition('calamity.part_test', 'val', 10, 1);
233-
ERROR: no hash function for type calamity.part_test
234209
/* check function build_range_condition() */
235210
SELECT build_range_condition('calamity.part_test', 'val', 10, 20);
236211
build_range_condition
@@ -318,7 +293,7 @@ SELECT get_partition_key_type(NULL) IS NULL;
318293
SELECT build_check_constraint_name('calamity.part_test', 1::int2);
319294
build_check_constraint_name
320295
-----------------------------
321-
pathman_part_test_1_check
296+
pathman_part_test_check
322297
(1 row)
323298

324299
SELECT build_check_constraint_name('calamity.part_test', NULL::int2) IS NULL;
@@ -343,7 +318,7 @@ SELECT build_check_constraint_name(NULL, NULL::int2) IS NULL;
343318
SELECT build_check_constraint_name('calamity.part_test', 'val');
344319
build_check_constraint_name
345320
-----------------------------
346-
pathman_part_test_1_check
321+
pathman_part_test_check
347322
(1 row)
348323

349324
SELECT build_check_constraint_name('calamity.part_test', NULL::text) IS NULL;
@@ -469,9 +444,9 @@ DROP FUNCTION calamity.dummy_cb(arg jsonb);
469444
SELECT add_to_pathman_config(NULL, 'val');/* no table */
470445
ERROR: 'parent_relid' should not be NULL
471446
SELECT add_to_pathman_config('calamity.part_test', NULL);/* no column */
472-
ERROR: 'attname' should not be NULL
447+
ERROR: 'expression' should not be NULL
473448
SELECT add_to_pathman_config('calamity.part_test', 'V_A_L');/* wrong column */
474-
ERROR:relation "part_test" has no column "V_A_L"
449+
ERROR:Cannot find type name for attribute "v_a_l" of relation "part_test"
475450
SELECT add_to_pathman_config('calamity.part_test', 'val');/* OK */
476451
add_to_pathman_config
477452
-----------------------
@@ -510,7 +485,7 @@ SELECT create_hash_partitions('calamity.part_ok', 'val', 4);
510485
CREATE TABLE calamity.wrong_partition (LIKE calamity.part_test) INHERITS (calamity.part_test); /* wrong partition w\o constraints */
511486
NOTICE: merging column "val" with inherited definition
512487
SELECT add_to_pathman_config('calamity.part_test', 'val');
513-
ERROR: constraint "pathman_wrong_partition_1_check" of partition "wrong_partition" does not exist
488+
ERROR: constraint "pathman_wrong_partition_check" of partition "wrong_partition" does not exist
514489
EXPLAIN (COSTS OFF) SELECT * FROM calamity.part_ok; /* check that pathman is enabled */
515490
QUERY PLAN
516491
-----------------------------
@@ -522,7 +497,7 @@ EXPLAIN (COSTS OFF) SELECT * FROM calamity.part_ok; /* check that pathman is ena
522497
(5 rows)
523498

524499
SELECT add_to_pathman_config('calamity.part_test', 'val', '10');
525-
ERROR: constraint "pathman_wrong_partition_1_check" of partition "wrong_partition" does not exist
500+
ERROR: constraint "pathman_wrong_partition_check" of partition "wrong_partition" does not exist
526501
EXPLAIN (COSTS OFF) SELECT * FROM calamity.part_ok; /* check that pathman is enabled */
527502
QUERY PLAN
528503
-----------------------------
@@ -534,7 +509,7 @@ EXPLAIN (COSTS OFF) SELECT * FROM calamity.part_ok; /* check that pathman is ena
534509
(5 rows)
535510

536511
ALTER TABLE calamity.wrong_partition
537-
ADD CONSTRAINTpathman_wrong_partition_1_check
512+
ADD CONSTRAINTpathman_wrong_partition_check
538513
CHECK (val = 1 OR val = 2); /* wrong constraint */
539514
SELECT add_to_pathman_config('calamity.part_test', 'val', '10');
540515
ERROR: wrong constraint format for RANGE partition "wrong_partition"
@@ -548,9 +523,9 @@ EXPLAIN (COSTS OFF) SELECT * FROM calamity.part_ok; /* check that pathman is ena
548523
-> Seq Scan on part_ok_3
549524
(5 rows)
550525

551-
ALTER TABLE calamity.wrong_partition DROP CONSTRAINTpathman_wrong_partition_1_check;
526+
ALTER TABLE calamity.wrong_partition DROP CONSTRAINTpathman_wrong_partition_check;
552527
ALTER TABLE calamity.wrong_partition
553-
ADD CONSTRAINTpathman_wrong_partition_1_check
528+
ADD CONSTRAINTpathman_wrong_partition_check
554529
CHECK (val >= 10 AND val = 2); /* wrong constraint */
555530
SELECT add_to_pathman_config('calamity.part_test', 'val', '10');
556531
ERROR: wrong constraint format for RANGE partition "wrong_partition"
@@ -564,7 +539,7 @@ EXPLAIN (COSTS OFF) SELECT * FROM calamity.part_ok; /* check that pathman is ena
564539
-> Seq Scan on part_ok_3
565540
(5 rows)
566541

567-
ALTER TABLE calamity.wrong_partition DROP CONSTRAINTpathman_wrong_partition_1_check;
542+
ALTER TABLE calamity.wrong_partition DROP CONSTRAINTpathman_wrong_partition_check;
568543
/* check GUC variable */
569544
SHOW pg_pathman.enable;
570545
pg_pathman.enable

‎expected/pathman_interval.out

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ SELECT set_interval('test_interval.abc', 1000);
3838

3939
INSERT INTO test_interval.abc VALUES (250);
4040
SELECT * FROM pathman_config;
41-
partrel | attname | parttype | range_interval
42-
-------------------+---------+----------+----------------
43-
test_interval.abc | id | 2 | 1000
41+
partrel | attname | parttype | range_interval| expression_p | atttype
42+
-------------------+---------+----------+----------------+-----------------------------------------------------------------------------------------------------------------------+---------
43+
test_interval.abc | id | 2 | 1000 | {VAR :varno 1 :varattno 1 :vartype 21 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location 8} | 21
4444
(1 row)
4545

4646
DROP TABLE test_interval.abc CASCADE;
@@ -81,9 +81,9 @@ SELECT set_interval('test_interval.abc', 1000);
8181

8282
INSERT INTO test_interval.abc VALUES (250);
8383
SELECT * FROM pathman_config;
84-
partrel | attname | parttype | range_interval
85-
-------------------+---------+----------+----------------
86-
test_interval.abc | id | 2 | 1000
84+
partrel | attname | parttype | range_interval| expression_p | atttype
85+
-------------------+---------+----------+----------------+-----------------------------------------------------------------------------------------------------------------------+---------
86+
test_interval.abc | id | 2 | 1000 | {VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location 8} | 23
8787
(1 row)
8888

8989
DROP TABLE test_interval.abc CASCADE;
@@ -124,9 +124,9 @@ SELECT set_interval('test_interval.abc', 1000);
124124

125125
INSERT INTO test_interval.abc VALUES (250);
126126
SELECT * FROM pathman_config;
127-
partrel | attname | parttype | range_interval
128-
-------------------+---------+----------+----------------
129-
test_interval.abc | id | 2 | 1000
127+
partrel | attname | parttype | range_interval| expression_p | atttype
128+
-------------------+---------+----------+----------------+-----------------------------------------------------------------------------------------------------------------------+---------
129+
test_interval.abc | id | 2 | 1000 | {VAR :varno 1 :varattno 1 :vartype 20 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location 8} | 20
130130
(1 row)
131131

132132
DROP TABLE test_interval.abc CASCADE;
@@ -157,9 +157,9 @@ SELECT set_interval('test_interval.abc', '1 month'::INTERVAL);
157157
(1 row)
158158

159159
SELECT * FROM pathman_config;
160-
partrel | attname | parttype | range_interval
161-
-------------------+---------+----------+----------------
162-
test_interval.abc | dt | 2 | @ 1 mon
160+
partrel | attname | parttype | range_interval| expression_p | atttype
161+
-------------------+---------+----------+----------------+-------------------------------------------------------------------------------------------------------------------------+---------
162+
test_interval.abc | dt | 2 | @ 1 mon | {VAR :varno 1 :varattno 1 :vartype 1082 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location 8} | 1082
163163
(1 row)
164164

165165
DROP TABLE test_interval.abc CASCADE;

‎expected/pathman_permissions.out

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ NOTICE: sequence "user1_table_seq" does not exist, skipping
3333
/* Should be able to see */
3434
SET ROLE user2;
3535
SELECT * FROM pathman_config;
36-
partrel | attname | parttype | range_interval
37-
-------------------------+---------+----------+----------------
38-
permissions.user1_table | id | 2 | 10
36+
partrel | attname | parttype | range_interval| expression_p | atttype
37+
-------------------------+---------+----------+----------------+-----------------------------------------------------------------------------------------------------------------------+---------
38+
permissions.user1_table | id | 2 | 10 | {VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location 8} | 23
3939
(1 row)
4040

4141
SELECT * FROM pathman_config_params;

‎expected/pathman_utility_stmt.out

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ SELECT * FROM copy_stmt_hooking.test WHERE val > 20;
159159

160160
/* COPY FROM (partitioned column is not specified) */
161161
COPY copy_stmt_hooking.test(comment) FROM stdin;
162-
ERROR:partitioned column's value should not be NULL
162+
ERROR:partition expression's value should not be NULL
163163
/* COPY FROM (we don't support FREEZE) */
164164
COPY copy_stmt_hooking.test FROM stdin WITH (FREEZE);
165165
ERROR: freeze is not supported for partitioned tables
@@ -278,7 +278,7 @@ ALTER TABLE rename.test_0 RENAME TO test_one;
278278
a | integer | not null default nextval('rename.test_a_seq'::regclass) | plain | |
279279
b | integer | | plain | |
280280
Check constraints:
281-
"pathman_test_one_1_check" CHECK (get_hash_part_idx(hashint4(a), 3) = 0)
281+
"pathman_test_one_check" CHECK (get_hash_part_idx(hashint4(a), 3) = 0)
282282
Inherits: rename.test
283283

284284
/* Generates check constraint for relation */
@@ -313,7 +313,7 @@ ALTER TABLE rename.test_inh_1 RENAME TO test_inh_one;
313313
a | integer | not null default nextval('rename.test_a_seq'::regclass) | plain | |
314314
b | integer | | plain | |
315315
Check constraints:
316-
"pathman_test_inh_1_1_check" CHECK (a < 100)
316+
"pathman_test_inh_1_check" CHECK (a < 100)
317317
Inherits: rename.test_inh
318318

319319
/* Check that plain tables are not affected too */
@@ -332,7 +332,7 @@ SELECT add_constraint('rename.plain_test_renamed', 'a');
332332
a | integer | not null default nextval('rename.plain_test_a_seq'::regclass) | plain | |
333333
b | integer | | plain | |
334334
Check constraints:
335-
"pathman_plain_test_renamed_1_check" CHECK (a < 100)
335+
"pathman_plain_test_renamed_check" CHECK (a < 100)
336336

337337
ALTER TABLE rename.plain_test_renamed RENAME TO plain_test;
338338
\d+ rename.plain_test
@@ -342,7 +342,7 @@ ALTER TABLE rename.plain_test_renamed RENAME TO plain_test;
342342
a | integer | not null default nextval('rename.plain_test_a_seq'::regclass) | plain | |
343343
b | integer | | plain | |
344344
Check constraints:
345-
"pathman_plain_test_renamed_1_check" CHECK (a < 100)
345+
"pathman_plain_test_renamed_check" CHECK (a < 100)
346346

347347
DROP SCHEMA rename CASCADE;
348348
NOTICE: drop cascades to 7 other objects

‎sql/pathman_calamity.sql

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,6 @@ SELECT drop_partitions('calamity.part_test', true);
9090
DELETEFROMcalamity.part_test;
9191

9292

93-
/* check function build_hash_condition()*/
94-
SELECT build_hash_condition('int4','val',10,1);
95-
SELECT build_hash_condition('text','val',10,1);
96-
SELECT build_hash_condition('int4','val',1,1);
97-
SELECT build_hash_condition('int4','val',10,20);
98-
SELECT build_hash_condition('text','val',10,NULL) ISNULL;
99-
SELECT build_hash_condition('calamity.part_test','val',10,1);
100-
10193
/* check function build_range_condition()*/
10294
SELECT build_range_condition('calamity.part_test','val',10,20);
10395
SELECT build_range_condition('calamity.part_test','val',10,NULL);
@@ -204,18 +196,18 @@ SELECT add_to_pathman_config('calamity.part_test', 'val', '10');
204196
EXPLAIN (COSTS OFF)SELECT*FROMcalamity.part_ok;/* check that pathman is enabled*/
205197

206198
ALTERTABLEcalamity.wrong_partition
207-
ADDCONSTRAINTpathman_wrong_partition_1_check
199+
ADDCONSTRAINTpathman_wrong_partition_check
208200
CHECK (val=1OR val=2);/* wrong constraint*/
209201
SELECT add_to_pathman_config('calamity.part_test','val','10');
210202
EXPLAIN (COSTS OFF)SELECT*FROMcalamity.part_ok;/* check that pathman is enabled*/
211-
ALTERTABLEcalamity.wrong_partition DROPCONSTRAINTpathman_wrong_partition_1_check;
203+
ALTERTABLEcalamity.wrong_partition DROPCONSTRAINTpathman_wrong_partition_check;
212204

213205
ALTERTABLEcalamity.wrong_partition
214-
ADDCONSTRAINTpathman_wrong_partition_1_check
206+
ADDCONSTRAINTpathman_wrong_partition_check
215207
CHECK (val>=10AND val=2);/* wrong constraint*/
216208
SELECT add_to_pathman_config('calamity.part_test','val','10');
217209
EXPLAIN (COSTS OFF)SELECT*FROMcalamity.part_ok;/* check that pathman is enabled*/
218-
ALTERTABLEcalamity.wrong_partition DROPCONSTRAINTpathman_wrong_partition_1_check;
210+
ALTERTABLEcalamity.wrong_partition DROPCONSTRAINTpathman_wrong_partition_check;
219211

220212
/* check GUC variable*/
221213
SHOWpg_pathman.enable;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp