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

Commit c3b00db

Browse files
committed
fixed case sensitive attribute name
1 parent 92f1126 commit c3b00db

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

expected/pg_pathman.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ INSERT INTO test.hash_rel VALUES (3, 3);
1111
SELECT pathman.create_hash_partitions('test.hash_rel', 'value', 3);
1212
ERROR: Partitioning key 'value' must be NOT NULL
1313
ALTER TABLE test.hash_rel ALTER COLUMN value SET NOT NULL;
14-
SELECT pathman.create_hash_partitions('test.hash_rel', 'value', 3);
14+
SELECT pathman.create_hash_partitions('test.hash_rel', 'Value', 3);
1515
NOTICE: function test.hash_rel_hash_insert_trigger_func() does not exist, skipping
1616
NOTICE: function test.hash_rel_hash_update_trigger_func() does not exist, skipping
1717
NOTICE: Copying data to partitions...
@@ -59,7 +59,7 @@ ERROR: Partitioning key 'dt' must be NOT NULL P0001
5959
ALTER TABLE test.range_rel ALTER COLUMN dt SET NOT NULL;
6060
SELECT pathman.create_range_partitions('test.range_rel', 'dt', '2015-01-01'::DATE, '1 month'::INTERVAL, 2);
6161
ERROR: Not enough partitions to fit all the values of 'dt' P0001
62-
SELECT pathman.create_range_partitions('test.range_rel', 'dt', '2015-01-01'::DATE, '1 month'::INTERVAL);
62+
SELECT pathman.create_range_partitions('test.range_rel', 'DT', '2015-01-01'::DATE, '1 month'::INTERVAL);
6363
NOTICE: sequence "range_rel_seq" does not exist, skipping
6464
NOTICE: Copying data to partitions...
6565
create_range_partitions

hash.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ DECLARE
2121
v_type TEXT;
2222
BEGIN
2323
relation := @extschema@.validate_relname(relation);
24+
attribute := lower(attribute);
2425
PERFORM @extschema@.common_relation_checks(relation, attribute);
2526

2627
v_type := @extschema@.get_attribute_type_name(relation, attribute);

init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ load_relations_hashtable(bool reinitialize)
175175
char sql[] = "SELECT pg_class.relfilenode, pg_attribute.attnum, cfg.parttype, pg_attribute.atttypid "
176176
"FROM %s.pathman_config as cfg "
177177
"JOIN pg_class ON pg_class.relfilenode = cfg.relname::regclass::oid "
178-
"JOIN pg_attribute ON pg_attribute.attname = cfg.attname "
178+
"JOIN pg_attribute ON pg_attribute.attname = lower(cfg.attname) "
179179
"AND attrelid = pg_class.relfilenode";
180180
char *query;
181181

range.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ DECLARE
2626
i INTEGER;
2727
BEGIN
2828
p_relation := @extschema@.validate_relname(p_relation);
29+
p_attribute := lower(p_attribute);
2930
PERFORM @extschema@.common_relation_checks(p_relation, p_attribute);
3031

3132
/* Try to determine partitions count if not set */
@@ -110,6 +111,7 @@ DECLARE
110111
i INTEGER;
111112
BEGIN
112113
p_relation := @extschema@.validate_relname(p_relation);
114+
p_attribute := lower(p_attribute);
113115
PERFORM @extschema@.common_relation_checks(p_relation, p_attribute);
114116

115117
IF p_count <= 0 THEN
@@ -195,6 +197,7 @@ DECLARE
195197
i INTEGER := 0;
196198
BEGIN
197199
p_relation := @extschema@.validate_relname(p_relation);
200+
p_attribute := lower(p_attribute);
198201
PERFORM @extschema@.common_relation_checks(p_relation, p_attribute);
199202

200203
IF p_interval <= 0 THEN
@@ -258,6 +261,7 @@ DECLARE
258261
i INTEGER := 0;
259262
BEGIN
260263
p_relation := @extschema@.validate_relname(p_relation);
264+
p_attribute := lower(p_attribute);
261265
PERFORM @extschema@.common_relation_checks(p_relation, p_attribute);
262266

263267
EXECUTE format('DROP SEQUENCE IF EXISTS %s_seq', p_relation);

sql/pg_pathman.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ INSERT INTO test.hash_rel VALUES (2, 2);
1212
INSERT INTO test.hash_rel VALUES (3, 3);
1313
SELECT pathman.create_hash_partitions('test.hash_rel', 'value', 3);
1414
ALTER TABLE test.hash_rel ALTER COLUMN value SET NOT NULL;
15-
SELECT pathman.create_hash_partitions('test.hash_rel', 'value', 3);
15+
SELECT pathman.create_hash_partitions('test.hash_rel', 'Value', 3);
1616
SELECT COUNT(*) FROM test.hash_rel;
1717
SELECT COUNT(*) FROM ONLY test.hash_rel;
1818
INSERT INTO test.hash_rel VALUES (4, 4);
@@ -31,7 +31,7 @@ SELECT g, md5(g::TEXT) FROM generate_series('2015-01-01', '2015-04-30', '1 day':
3131
SELECT pathman.create_range_partitions('test.range_rel', 'dt', '2015-01-01'::DATE, '1 month'::INTERVAL, 2);
3232
ALTER TABLE test.range_rel ALTER COLUMN dt SET NOT NULL;
3333
SELECT pathman.create_range_partitions('test.range_rel', 'dt', '2015-01-01'::DATE, '1 month'::INTERVAL, 2);
34-
SELECT pathman.create_range_partitions('test.range_rel', 'dt', '2015-01-01'::DATE, '1 month'::INTERVAL);
34+
SELECT pathman.create_range_partitions('test.range_rel', 'DT', '2015-01-01'::DATE, '1 month'::INTERVAL);
3535
SELECT COUNT(*) FROM test.range_rel;
3636
SELECT COUNT(*) FROM ONLY test.range_rel;
3737

0 commit comments

Comments
 (0)