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

Commit6b87455

Browse files
committed
Merge branch 'rel_future_expressions' into rel_future_beta
2 parents72f59d4 +3ec09c7 commit6b87455

39 files changed

+2282
-1004
lines changed

‎.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@ regression.out
1010
*.gcno
1111
*.gcov
1212
pg_pathman--*.sql
13-
14-
/cscope*
15-
/tags
13+
tags
14+
cscope*

‎Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ REGRESS = pathman_basic \
4242
pathman_runtime_nodes\
4343
pathman_update_trigger\
4444
pathman_updates\
45-
pathman_utility_stmt
45+
pathman_utility_stmt\
46+
pathman_expressions
4647

4748

4849
EXTRA_REGRESS_OPTS=--temp-config=$(top_srcdir)/$(subdir)/conf.add

‎expected/pathman_basic.out

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ CREATE INDEX ON test.range_rel (dt);
130130
INSERT INTO test.range_rel (dt, txt)
131131
SELECT g, md5(g::TEXT) FROM generate_series('2015-01-01', '2015-04-30', '1 day'::interval) as g;
132132
SELECT pathman.create_range_partitions('test.range_rel', 'dt', '2015-01-01'::DATE, '1 month'::INTERVAL, 2);
133+
ERROR: not enough partitions to fit all values of "dt"
134+
SELECT pathman.create_range_partitions('test.range_rel', 'dt', '2015-01-01'::DATE, '1 month'::INTERVAL);
133135
ERROR: partitioning key "dt" must be marked NOT NULL
134136
ALTER TABLE test.range_rel ALTER COLUMN dt SET NOT NULL;
135-
SELECT pathman.create_range_partitions('test.range_rel', 'dt', '2015-01-01'::DATE, '1 month'::INTERVAL, 2);
136-
ERROR: not enough partitions to fit all values of "dt"
137137
SELECT pathman.create_range_partitions('test.range_rel', 'DT', '2015-01-01'::DATE, '1 month'::INTERVAL);
138138
NOTICE: sequence "range_rel_seq" does not exist, skipping
139139
create_range_partitions
@@ -1328,7 +1328,7 @@ Indexes:
13281328
Indexes:
13291329
"hash_rel_extern_pkey" PRIMARY KEY, btree (id)
13301330
Check constraints:
1331-
"pathman_hash_rel_extern_2_check" CHECK (pathman.get_hash_part_idx(hashint4(value), 3) = 0)
1331+
"pathman_hash_rel_extern_check" CHECK (pathman.get_hash_part_idx(hashint4(value), 3) = 0)
13321332
Inherits: test.hash_rel
13331333

13341334
INSERT INTO test.hash_rel SELECT * FROM test.hash_rel_0;
@@ -1461,16 +1461,16 @@ INSERT INTO test.range_rel (dt) VALUES ('2015-06-01');
14611461
*/
14621462
ALTER TABLE test.range_rel DROP COLUMN data;
14631463
SELECT * FROM pathman.pathman_config;
1464-
partrel | attname | parttype | range_interval
1465-
----------------+---------+----------+----------------
1466-
test.range_rel | dt | 2 | @ 10 days
1464+
partrel | attname | parttype | range_interval| expression_p | atttype
1465+
----------------+---------+----------+----------------+-------------------------------------------------------------------------------------------------------------------------+---------
1466+
test.range_rel | dt | 2 | @ 10 days | {VAR :varno 1 :varattno 2 :vartype 1114 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 2 :location 8} | 1114
14671467
(1 row)
14681468

14691469
DROP TABLE test.range_rel CASCADE;
14701470
NOTICE: drop cascades to 20 other objects
14711471
SELECT * FROM pathman.pathman_config;
1472-
partrel | attname | parttype | range_interval
1473-
---------+---------+----------+----------------
1472+
partrel | attname | parttype | range_interval| expression_p | atttype
1473+
---------+---------+----------+----------------+--------------+---------
14741474
(0 rows)
14751475

14761476
/* Check overlaps */
@@ -1632,9 +1632,9 @@ SELECT pathman.create_partitions_from_range('test."RangeRel"', 'dt', '2015-01-01
16321632
DROP TABLE test."RangeRel" CASCADE;
16331633
NOTICE: drop cascades to 5 other objects
16341634
SELECT * FROM pathman.pathman_config;
1635-
partrel | attname | parttype | range_interval
1636-
--------------------+---------+----------+----------------
1637-
test.num_range_rel | id | 2 | 1000
1635+
partrel | attname | parttype | range_interval| expression_p | atttype
1636+
--------------------+---------+----------+----------------+------------------------------------------------------------------------------------------------------------------------+---------
1637+
test.num_range_rel | id | 2 | 1000 | {VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location -1} | 23
16381638
(1 row)
16391639

16401640
CREATE TABLE test."RangeRel" (

‎expected/pathman_calamity.out

Lines changed: 20 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ ERROR: no hash function for type calamity.part_test
250250
SELECT build_range_condition(NULL, 'val', 10, 20);/* not ok */
251251
ERROR: 'partition_relid' should not be NULL
252252
SELECT build_range_condition('calamity.part_test', NULL, 10, 20);/* not ok */
253-
ERROR: 'attribute' should not be NULL
253+
ERROR: 'expression' should not be NULL
254254
SELECT build_range_condition('calamity.part_test', 'val', 10, 20);/* OK */
255255
build_range_condition
256256
------------------------------
@@ -270,17 +270,15 @@ SELECT build_range_condition('calamity.part_test', 'val', NULL, 10);/* OK */
270270
(1 row)
271271

272272
/* check function validate_interval_value() */
273-
SELECT validate_interval_value(NULL, 'val', 2, '1 mon');/* not ok */
274-
ERROR: 'partrel' should not be NULL
275-
SELECT validate_interval_value('calamity.part_test', NULL, 2, '1 mon');/* not ok */
276-
ERROR: 'attname' should not be NULL
277-
SELECT validate_interval_value('calamity.part_test', 'val', NULL, '1 mon');/* not ok */
273+
SELECT validate_interval_value(NULL, 2, '1 mon');/* not ok */
274+
ERROR: 'atttype' should not be NULL
275+
SELECT validate_interval_value('interval'::regtype, NULL, '1 mon');/* not ok */
278276
ERROR: 'parttype' should not be NULL
279-
SELECT validate_interval_value('calamity.part_test', 'val',2, '1 mon');/* not ok */
277+
SELECT validate_interval_value('int4'::regtype,2, '1 mon');/* not ok */
280278
ERROR: invalid input syntax for integer: "1 mon"
281-
SELECT validate_interval_value('calamity.part_test', 'val', 1, '1 mon');/* not ok */
279+
SELECT validate_interval_value('interval'::regtype, 1, '1 mon');/* not ok */
282280
ERROR: interval should be NULL for HASH partitioned table
283-
SELECT validate_interval_value('calamity.part_test', 'val', 2, NULL);/* OK */
281+
SELECT validate_interval_value('interval'::regtype, 2, NULL);/* OK */
284282
validate_interval_value
285283
-------------------------
286284
t
@@ -350,59 +348,16 @@ SELECT get_partition_key_type(NULL) IS NULL;
350348
t
351349
(1 row)
352350

353-
/* check functionbuild_check_constraint_name_attnum() */
354-
SELECT build_check_constraint_name('calamity.part_test', 1::int2);/* OK */
351+
/* check functionbuild_check_constraint_name() */
352+
SELECT build_check_constraint_name('calamity.part_test');/* OK */
355353
build_check_constraint_name
356354
-----------------------------
357-
pathman_part_test_1_check
355+
pathman_part_test_check
358356
(1 row)
359357

360-
SELECT build_check_constraint_name(0::REGCLASS, 1::int2);/* not ok */
358+
SELECT build_check_constraint_name(0::REGCLASS);/* not ok */
361359
ERROR: relation "0" does not exist
362-
SELECT build_check_constraint_name('calamity.part_test', -1::int2);/* not ok */
363-
ERROR: invalid attribute number -1
364-
SELECT build_check_constraint_name('calamity.part_test', NULL::int2) IS NULL;
365-
?column?
366-
----------
367-
t
368-
(1 row)
369-
370-
SELECT build_check_constraint_name(NULL, 1::int2) IS NULL;
371-
?column?
372-
----------
373-
t
374-
(1 row)
375-
376-
SELECT build_check_constraint_name(NULL, NULL::int2) IS NULL;
377-
?column?
378-
----------
379-
t
380-
(1 row)
381-
382-
/* check function build_check_constraint_name_attname() */
383-
SELECT build_check_constraint_name('calamity.part_test', 'val');/* OK */
384-
build_check_constraint_name
385-
-----------------------------
386-
pathman_part_test_1_check
387-
(1 row)
388-
389-
SELECT build_check_constraint_name(0::REGCLASS, 'val');/* not ok */
390-
ERROR: relation "0" does not exist
391-
SELECT build_check_constraint_name('calamity.part_test', 'nocol');/* not ok */
392-
ERROR: relation "part_test" has no column "nocol"
393-
SELECT build_check_constraint_name('calamity.part_test', NULL::text) IS NULL;
394-
?column?
395-
----------
396-
t
397-
(1 row)
398-
399-
SELECT build_check_constraint_name(NULL, 'val') IS NULL;
400-
?column?
401-
----------
402-
t
403-
(1 row)
404-
405-
SELECT build_check_constraint_name(NULL, NULL::text) IS NULL;
360+
SELECT build_check_constraint_name(NULL) IS NULL;
406361
?column?
407362
----------
408363
t
@@ -599,9 +554,9 @@ ERROR: 'parent_relid' should not be NULL
599554
SELECT add_to_pathman_config(0::REGCLASS, 'val');/* no table (oid) */
600555
ERROR: relation "0" does not exist
601556
SELECT add_to_pathman_config('calamity.part_test', NULL);/* no column */
602-
ERROR: 'attname' should not be NULL
557+
ERROR: 'expression' should not be NULL
603558
SELECT add_to_pathman_config('calamity.part_test', 'V_A_L');/* wrong column */
604-
ERROR:relation "part_test" has no column "V_A_L"
559+
ERROR:cannot find type name for attribute "v_a_l" of relation "part_test"
605560
SELECT add_to_pathman_config('calamity.part_test', 'val');/* OK */
606561
add_to_pathman_config
607562
-----------------------
@@ -638,7 +593,7 @@ SELECT create_hash_partitions('calamity.part_ok', 'val', 4);
638593
CREATE TABLE calamity.wrong_partition (LIKE calamity.part_test) INHERITS (calamity.part_test); /* wrong partition w\o constraints */
639594
NOTICE: merging column "val" with inherited definition
640595
SELECT add_to_pathman_config('calamity.part_test', 'val');
641-
ERROR: constraint "pathman_wrong_partition_1_check" of partition "wrong_partition" does not exist
596+
ERROR: constraint "pathman_wrong_partition_check" of partition "wrong_partition" does not exist
642597
EXPLAIN (COSTS OFF) SELECT * FROM calamity.part_ok; /* check that pathman is enabled */
643598
QUERY PLAN
644599
-----------------------------
@@ -650,7 +605,7 @@ EXPLAIN (COSTS OFF) SELECT * FROM calamity.part_ok; /* check that pathman is ena
650605
(5 rows)
651606

652607
SELECT add_to_pathman_config('calamity.part_test', 'val', '10');
653-
ERROR: constraint "pathman_wrong_partition_1_check" of partition "wrong_partition" does not exist
608+
ERROR: constraint "pathman_wrong_partition_check" of partition "wrong_partition" does not exist
654609
EXPLAIN (COSTS OFF) SELECT * FROM calamity.part_ok; /* check that pathman is enabled */
655610
QUERY PLAN
656611
-----------------------------
@@ -662,7 +617,7 @@ EXPLAIN (COSTS OFF) SELECT * FROM calamity.part_ok; /* check that pathman is ena
662617
(5 rows)
663618

664619
ALTER TABLE calamity.wrong_partition
665-
ADD CONSTRAINTpathman_wrong_partition_1_check
620+
ADD CONSTRAINTpathman_wrong_partition_check
666621
CHECK (val = 1 OR val = 2); /* wrong constraint */
667622
SELECT add_to_pathman_config('calamity.part_test', 'val', '10');
668623
ERROR: wrong constraint format for RANGE partition "wrong_partition"
@@ -676,9 +631,9 @@ EXPLAIN (COSTS OFF) SELECT * FROM calamity.part_ok; /* check that pathman is ena
676631
-> Seq Scan on part_ok_3
677632
(5 rows)
678633

679-
ALTER TABLE calamity.wrong_partition DROP CONSTRAINTpathman_wrong_partition_1_check;
634+
ALTER TABLE calamity.wrong_partition DROP CONSTRAINTpathman_wrong_partition_check;
680635
ALTER TABLE calamity.wrong_partition
681-
ADD CONSTRAINTpathman_wrong_partition_1_check
636+
ADD CONSTRAINTpathman_wrong_partition_check
682637
CHECK (val >= 10 AND val = 2); /* wrong constraint */
683638
SELECT add_to_pathman_config('calamity.part_test', 'val', '10');
684639
ERROR: wrong constraint format for RANGE partition "wrong_partition"
@@ -692,7 +647,7 @@ EXPLAIN (COSTS OFF) SELECT * FROM calamity.part_ok; /* check that pathman is ena
692647
-> Seq Scan on part_ok_3
693648
(5 rows)
694649

695-
ALTER TABLE calamity.wrong_partition DROP CONSTRAINTpathman_wrong_partition_1_check;
650+
ALTER TABLE calamity.wrong_partition DROP CONSTRAINTpathman_wrong_partition_check;
696651
/* check GUC variable */
697652
SHOW pg_pathman.enable;
698653
pg_pathman.enable

‎expected/pathman_column_type.out

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,26 @@ SELECT context, entries FROM pathman_cache_stats ORDER BY context;
3131

3232
/* change column's type (should flush caches) */
3333
ALTER TABLE test_column_type.test ALTER val TYPE NUMERIC;
34+
/* check that parsed expression was cleared */
35+
SELECT * FROM pathman_config;
36+
partrel | attname | parttype | range_interval | expression_p | atttype
37+
-----------------------+---------+----------+----------------+--------------+---------
38+
test_column_type.test | val | 2 | 10 | |
39+
(1 row)
40+
3441
/* make sure that everything works properly */
3542
SELECT * FROM test_column_type.test;
3643
val
3744
-----
3845
(0 rows)
3946

47+
/* check that expression, atttype is changed */
48+
SELECT * FROM pathman_config;
49+
partrel | attname | parttype | range_interval | expression_p | atttype
50+
-----------------------+---------+----------+----------------+-------------------------------------------------------------------------------------------------------------------------+---------
51+
test_column_type.test | val | 2 | 10 | {VAR :varno 1 :varattno 1 :vartype 1700 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location 8} | 1700
52+
(1 row)
53+
4054
SELECT context, entries FROM pathman_cache_stats ORDER BY context;
4155
context | entries
4256
--------------------------+---------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp