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

Commitbe7afb2

Browse files
committed
pathman: support for case-sensitive table names
1 parentea6564c commitbe7afb2

File tree

5 files changed

+566
-219
lines changed

5 files changed

+566
-219
lines changed

‎contrib/pg_pathman/expected/pg_pathman.out

Lines changed: 183 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,185 @@ SELECT pathman.check_overlap('test.num_range_rel'::regclass::oid, 0, 1001);
924924
t
925925
(1 row)
926926

927+
/* CaMeL cAsE table names and attributes */
928+
CREATE TABLE test."TeSt" (a INT NOT NULL, b INT);
929+
SELECT pathman.create_hash_partitions('test.TeSt', 'a', 3);
930+
ERROR: relation "test.test" does not exist at character 39
931+
SELECT pathman.create_hash_partitions('test."TeSt"', 'a', 3);
932+
NOTICE: function test.TeSt_insert_trigger_func() does not exist, skipping
933+
NOTICE: function test.TeSt_update_trigger_func() does not exist, skipping
934+
NOTICE: Copying data to partitions...
935+
create_hash_partitions
936+
------------------------
937+
3
938+
(1 row)
939+
940+
INSERT INTO test."TeSt" VALUES (1, 1);
941+
INSERT INTO test."TeSt" VALUES (2, 2);
942+
INSERT INTO test."TeSt" VALUES (3, 3);
943+
SELECT * FROM test."TeSt";
944+
a | b
945+
---+---
946+
3 | 3
947+
1 | 1
948+
2 | 2
949+
(3 rows)
950+
951+
SELECT pathman.create_hash_update_trigger('test."TeSt"');
952+
create_hash_update_trigger
953+
----------------------------
954+
955+
(1 row)
956+
957+
UPDATE test."TeSt" SET a = 1;
958+
SELECT * FROM test."TeSt";
959+
a | b
960+
---+---
961+
1 | 3
962+
1 | 1
963+
1 | 2
964+
(3 rows)
965+
966+
SELECT * FROM test."TeSt" WHERE a = 1;
967+
a | b
968+
---+---
969+
1 | 3
970+
1 | 1
971+
1 | 2
972+
(3 rows)
973+
974+
EXPLAIN (COSTS OFF) SELECT * FROM test."TeSt" WHERE a = 1;
975+
QUERY PLAN
976+
----------------------------
977+
Append
978+
-> Seq Scan on "TeSt_1"
979+
Filter: (a = 1)
980+
(3 rows)
981+
982+
SELECT pathman.drop_hash_partitions('test."TeSt"');
983+
NOTICE: drop cascades to trigger test_TeSt_insert_trigger on table test."TeSt"
984+
NOTICE: drop cascades to 3 other objects
985+
NOTICE: 0 rows copied from test."TeSt_2"
986+
NOTICE: 3 rows copied from test."TeSt_1"
987+
NOTICE: 0 rows copied from test."TeSt_0"
988+
drop_hash_partitions
989+
----------------------
990+
3
991+
(1 row)
992+
993+
SELECT * FROM test."TeSt";
994+
a | b
995+
---+---
996+
1 | 3
997+
1 | 1
998+
1 | 2
999+
(3 rows)
1000+
1001+
CREATE TABLE test."RangeRel" (
1002+
idSERIAL PRIMARY KEY,
1003+
dtTIMESTAMP NOT NULL,
1004+
txtTEXT);
1005+
INSERT INTO test."RangeRel" (dt, txt)
1006+
SELECT g, md5(g::TEXT) FROM generate_series('2015-01-01', '2015-01-03', '1 day'::interval) as g;
1007+
SELECT pathman.create_range_partitions('test."RangeRel"', 'dt', '2015-01-01'::DATE, '1 day'::INTERVAL);
1008+
NOTICE: sequence "RangeRel_seq" does not exist, skipping
1009+
NOTICE: Copying data to partitions...
1010+
create_range_partitions
1011+
-------------------------
1012+
3
1013+
(1 row)
1014+
1015+
SELECT pathman.append_range_partition('test."RangeRel"');
1016+
NOTICE: Appending new partition...
1017+
NOTICE: Done!
1018+
append_range_partition
1019+
------------------------
1020+
test."RangeRel_4"
1021+
(1 row)
1022+
1023+
SELECT pathman.prepend_range_partition('test."RangeRel"');
1024+
NOTICE: Prepending new partition...
1025+
NOTICE: Done!
1026+
prepend_range_partition
1027+
-------------------------
1028+
test."RangeRel_5"
1029+
(1 row)
1030+
1031+
SELECT pathman.merge_range_partitions('test."RangeRel_1"', 'test."RangeRel_' || currval('test."RangeRel_seq"') || '"');
1032+
NOTICE: Altering first partition...
1033+
NOTICE: Copying data...
1034+
NOTICE: Dropping second partition...
1035+
NOTICE: Done!
1036+
merge_range_partitions
1037+
------------------------
1038+
1039+
(1 row)
1040+
1041+
SELECT pathman.split_range_partition('test."RangeRel_1"', '2015-01-01'::DATE);
1042+
NOTICE: Creating new partition...
1043+
NOTICE: Copying data to new partition...
1044+
NOTICE: Altering original partition...
1045+
NOTICE: Done!
1046+
split_range_partition
1047+
-------------------------
1048+
{12-31-2014,01-02-2015}
1049+
(1 row)
1050+
1051+
SELECT pathman.drop_range_partitions('test."RangeRel"');
1052+
NOTICE: 1 rows copied from test."RangeRel_6"
1053+
NOTICE: 0 rows copied from test."RangeRel_4"
1054+
NOTICE: 1 rows copied from test."RangeRel_3"
1055+
NOTICE: 1 rows copied from test."RangeRel_2"
1056+
NOTICE: 0 rows copied from test."RangeRel_1"
1057+
drop_range_partitions
1058+
-----------------------
1059+
5
1060+
(1 row)
1061+
1062+
SELECT pathman.create_partitions_from_range('test."RangeRel"', 'dt', '2015-01-01'::DATE, '2015-01-05'::DATE, '1 day'::INTERVAL);
1063+
NOTICE: Copying data to partitions...
1064+
create_partitions_from_range
1065+
------------------------------
1066+
5
1067+
(1 row)
1068+
1069+
DROP TABLE test."RangeRel" CASCADE;
1070+
NOTICE: drop cascades to 5 other objects
1071+
SELECT * FROM pathman.pathman_config;
1072+
id | relname | attname | parttype | range_interval
1073+
----+--------------------+---------+----------+----------------
1074+
6 | test.num_range_rel | id | 2 | 1000
1075+
(1 row)
1076+
1077+
CREATE TABLE test."RangeRel" (
1078+
idSERIAL PRIMARY KEY,
1079+
dtTIMESTAMP NOT NULL,
1080+
txtTEXT);
1081+
SELECT pathman.create_range_partitions('test."RangeRel"', 'id', 1, 100, 3);
1082+
NOTICE: Copying data to partitions...
1083+
create_range_partitions
1084+
-------------------------
1085+
3
1086+
(1 row)
1087+
1088+
SELECT pathman.drop_range_partitions('test."RangeRel"');
1089+
NOTICE: 0 rows copied from test."RangeRel_3"
1090+
NOTICE: 0 rows copied from test."RangeRel_2"
1091+
NOTICE: 0 rows copied from test."RangeRel_1"
1092+
drop_range_partitions
1093+
-----------------------
1094+
3
1095+
(1 row)
1096+
1097+
SELECT pathman.create_partitions_from_range('test."RangeRel"', 'id', 1, 300, 100);
1098+
NOTICE: Copying data to partitions...
1099+
create_partitions_from_range
1100+
------------------------------
1101+
3
1102+
(1 row)
1103+
1104+
DROP TABLE test."RangeRel" CASCADE;
1105+
NOTICE: drop cascades to 3 other objects
9271106
DROP EXTENSION pg_pathman;
9281107
/* Test that everithing works fine without schemas */
9291108
CREATE EXTENSION pg_pathman;
@@ -933,8 +1112,8 @@ CREATE TABLE hash_rel (
9331112
valueINTEGER NOT NULL);
9341113
INSERT INTO hash_rel (value) SELECT g FROM generate_series(1, 10000) as g;
9351114
SELECT create_hash_partitions('hash_rel', 'value', 3);
936-
NOTICE: function hash_rel_insert_trigger_func() does not exist, skipping
937-
NOTICE: function hash_rel_update_trigger_func() does not exist, skipping
1115+
NOTICE: functionpublic.hash_rel_insert_trigger_func() does not exist, skipping
1116+
NOTICE: functionpublic.hash_rel_update_trigger_func() does not exist, skipping
9381117
NOTICE: Copying data to partitions...
9391118
create_hash_partitions
9401119
------------------------
@@ -1134,8 +1313,8 @@ CREATE TABLE replies(id SERIAL PRIMARY KEY, message_id INTEGER REFERENCES messag
11341313
INSERT INTO messages SELECT g, md5(g::text) FROM generate_series(1, 10) as g;
11351314
INSERT INTO replies SELECT g, g, md5(g::text) FROM generate_series(1, 10) as g;
11361315
SELECT create_range_partitions('messages', 'id', 1, 100, 2);
1137-
WARNING: Foreign key 'replies_message_id_fkey' references to the relation 'public.messages'
1138-
ERROR: Relation 'public.messages' is referenced from other relations P0001
1316+
WARNING: Foreign key 'replies_message_id_fkey' references to the relation 'messages'
1317+
ERROR: Relation 'messages' is referenced from other relations P0001
11391318
ALTER TABLE replies DROP CONSTRAINT replies_message_id_fkey;
11401319
SELECT create_range_partitions('messages', 'id', 1, 100, 2);
11411320
NOTICE: sequence "messages_seq" does not exist, skipping

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp