Skip to content

Commit 7d45123

Browse files
committed
passing regression tests, minor code fix
1 parent 79466c6 commit 7d45123

File tree

2 files changed

+11
-67
lines changed

2 files changed

+11
-67
lines changed

expected/pg_pathman.out

Lines changed: 10 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ 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;
1414
SELECT pathman.create_hash_partitions('test.hash_rel', 'Value', 3);
15-
NOTICE: Copying data to partitions...
1615
create_hash_partitions
1716
------------------------
1817
3
@@ -549,7 +548,7 @@ WHERE j1.dt < '2015-03-01' AND j2.dt >= '2015-02-01' ORDER BY j2.dt;
549548
* Test CTE query
550549
*/
551550
EXPLAIN (COSTS OFF)
552-
WITH ttt AS (SELECT * FROM test.range_rel WHERE dt >= '2015-02-01' AND dt < '2015-03-15')
551+
WITH ttt AS (SELECT * FROM test.range_rel WHERE dt >= '2015-02-01' AND dt < '2015-03-15')
553552
SELECT * FROM ttt;
554553
QUERY PLAN
555554
--------------------------------------------------------------------------------------------
@@ -562,7 +561,7 @@ SELECT * FROM ttt;
562561
(6 rows)
563562

564563
EXPLAIN (COSTS OFF)
565-
WITH ttt AS (SELECT * FROM test.hash_rel WHERE value = 2)
564+
WITH ttt AS (SELECT * FROM test.hash_rel WHERE value = 2)
566565
SELECT * FROM ttt;
567566
QUERY PLAN
568567
--------------------------------------
@@ -782,7 +781,6 @@ create table test.run_values as select generate_series(1, 10000) val;
782781
create table test.runtime_test_1(id serial primary key, val real);
783782
insert into test.runtime_test_1 select generate_series(1, 10000), random();
784783
select pathman.create_hash_partitions('test.runtime_test_1', 'id', 6);
785-
NOTICE: Copying data to partitions...
786784
create_hash_partitions
787785
------------------------
788786
6
@@ -793,7 +791,6 @@ create table test.runtime_test_2 (id serial, category_id int not null, name text
793791
insert into test.runtime_test_2 (select id, (id % 6) + 1 as category_id, 'good' || id::text as name, random() as rating from generate_series(1, 100000) id);
794792
create index on test.runtime_test_2 (category_id, rating);
795793
select pathman.create_hash_partitions('test.runtime_test_2', 'category_id', 6);
796-
NOTICE: Copying data to partitions...
797794
create_hash_partitions
798795
------------------------
799796
6
@@ -803,7 +800,6 @@ create table test.vals as (select generate_series(1, 10000) as val);
803800
create table test.runtime_test_3(val text, id serial not null);
804801
insert into test.runtime_test_3(id, val) select * from generate_series(1, 10000) k, format('k = %s', k);
805802
select pathman.create_hash_partitions('test.runtime_test_3', 'id', 4);
806-
NOTICE: Copying data to partitions...
807803
create_hash_partitions
808804
------------------------
809805
4
@@ -861,10 +857,6 @@ NOTICE: drop cascades to 16 other objects
861857
*/
862858
/* Split first partition in half */
863859
SELECT pathman.split_range_partition('test.num_range_rel_1', 500);
864-
NOTICE: Creating new partition...
865-
NOTICE: Copying data to new partition...
866-
NOTICE: Altering original partition...
867-
NOTICE: Done!
868860
split_range_partition
869861
-----------------------
870862
{0,1000}
@@ -881,21 +873,13 @@ EXPLAIN (COSTS OFF) SELECT * FROM test.num_range_rel WHERE id BETWEEN 100 AND 70
881873
(5 rows)
882874

883875
SELECT pathman.split_range_partition('test.range_rel_1', '2015-01-15'::DATE);
884-
NOTICE: Creating new partition...
885-
NOTICE: Copying data to new partition...
886-
NOTICE: Altering original partition...
887-
NOTICE: Done!
888876
split_range_partition
889877
-------------------------
890878
{01-01-2015,02-01-2015}
891879
(1 row)
892880

893881
/* Merge two partitions into one */
894882
SELECT pathman.merge_range_partitions('test.num_range_rel_1', 'test.num_range_rel_' || currval('test.num_range_rel_seq'));
895-
NOTICE: Altering first partition...
896-
NOTICE: Copying data...
897-
NOTICE: Dropping second partition...
898-
NOTICE: Done!
899883
merge_range_partitions
900884
------------------------
901885

@@ -910,19 +894,13 @@ EXPLAIN (COSTS OFF) SELECT * FROM test.num_range_rel WHERE id BETWEEN 100 AND 70
910894
(3 rows)
911895

912896
SELECT pathman.merge_range_partitions('test.range_rel_1', 'test.range_rel_' || currval('test.range_rel_seq'));
913-
NOTICE: Altering first partition...
914-
NOTICE: Copying data...
915-
NOTICE: Dropping second partition...
916-
NOTICE: Done!
917897
merge_range_partitions
918898
------------------------
919899

920900
(1 row)
921901

922902
/* Append and prepend partitions */
923903
SELECT pathman.append_range_partition('test.num_range_rel');
924-
NOTICE: Appending new partition...
925-
NOTICE: Done!
926904
append_range_partition
927905
------------------------
928906
test.num_range_rel_6
@@ -936,8 +914,6 @@ EXPLAIN (COSTS OFF) SELECT * FROM test.num_range_rel WHERE id >= 4000;
936914
(2 rows)
937915

938916
SELECT pathman.prepend_range_partition('test.num_range_rel');
939-
NOTICE: Prepending new partition...
940-
NOTICE: Done!
941917
prepend_range_partition
942918
-------------------------
943919
test.num_range_rel_7
@@ -957,16 +933,12 @@ SELECT pathman.drop_range_partition('test.num_range_rel_7');
957933
(1 row)
958934

959935
SELECT pathman.append_range_partition('test.range_rel');
960-
NOTICE: Appending new partition...
961-
NOTICE: Done!
962936
append_range_partition
963937
------------------------
964938
test.range_rel_6
965939
(1 row)
966940

967941
SELECT pathman.prepend_range_partition('test.range_rel');
968-
NOTICE: Prepending new partition...
969-
NOTICE: Done!
970942
prepend_range_partition
971943
-------------------------
972944
test.range_rel_7
@@ -999,7 +971,6 @@ EXPLAIN (COSTS OFF) SELECT * FROM test.range_rel WHERE dt BETWEEN '2014-12-15' A
999971
SELECT pathman.add_range_partition('test.range_rel', '2014-12-01'::DATE, '2015-01-02'::DATE);
1000972
ERROR: Specified range overlaps with existing partitions
1001973
SELECT pathman.add_range_partition('test.range_rel', '2014-12-01'::DATE, '2015-01-01'::DATE);
1002-
NOTICE: Done!
1003974
add_range_partition
1004975
---------------------
1005976
test.range_rel_8
@@ -1051,15 +1022,15 @@ EXPLAIN (COSTS OFF) SELECT * FROM test.range_rel WHERE dt BETWEEN '2014-11-15' A
10511022
(4 rows)
10521023

10531024
CREATE TABLE test.range_rel_test1 (
1054-
id SERIAL PRIMARY KEY,
1055-
dt TIMESTAMP,
1056-
txt TEXT,
1057-
abc INTEGER);
1025+
id SERIAL PRIMARY KEY,
1026+
dt TIMESTAMP,
1027+
txt TEXT,
1028+
abc INTEGER);
10581029
SELECT pathman.attach_range_partition('test.range_rel', 'test.range_rel_test1', '2013-01-01'::DATE, '2014-01-01'::DATE);
10591030
ERROR: Partition must have the exact same structure as parent
10601031
CREATE TABLE test.range_rel_test2 (
1061-
id SERIAL PRIMARY KEY,
1062-
dt TIMESTAMP);
1032+
id SERIAL PRIMARY KEY,
1033+
dt TIMESTAMP);
10631034
SELECT pathman.attach_range_partition('test.range_rel', 'test.range_rel_test2', '2013-01-01'::DATE, '2014-01-01'::DATE);
10641035
ERROR: Partition must have the exact same structure as parent
10651036
/*
@@ -1093,7 +1064,6 @@ SELECT COUNT(*) FROM ONLY test.hash_rel;
10931064
(1 row)
10941065

10951066
SELECT pathman.create_hash_partitions('test.hash_rel', 'value', 3);
1096-
NOTICE: Copying data to partitions...
10971067
create_hash_partitions
10981068
------------------------
10991069
3
@@ -1174,7 +1144,7 @@ SELECT * FROM test.range_rel WHERE dt = '2015-03-15';
11741144
DROP TABLE test.range_rel CASCADE;
11751145
NOTICE: drop cascades to 16 other objects
11761146
SELECT * FROM pathman.pathman_config;
1177-
id | relname | attname | parttype | range_interval
1147+
id | partrel | attname | parttype | range_interval
11781148
----+---------+---------+----------+----------------
11791149
(0 rows)
11801150

@@ -1236,7 +1206,6 @@ CREATE TABLE test."TeSt" (a INT NOT NULL, b INT);
12361206
SELECT pathman.create_hash_partitions('test.TeSt', 'a', 3);
12371207
ERROR: relation "test.test" does not exist at character 39
12381208
SELECT pathman.create_hash_partitions('test."TeSt"', 'a', 3);
1239-
NOTICE: Copying data to partitions...
12401209
create_hash_partitions
12411210
------------------------
12421211
3
@@ -1317,36 +1286,24 @@ NOTICE: Copying data to partitions...
13171286
(1 row)
13181287

13191288
SELECT pathman.append_range_partition('test."RangeRel"');
1320-
NOTICE: Appending new partition...
1321-
NOTICE: Done!
13221289
append_range_partition
13231290
------------------------
13241291
test."RangeRel_4"
13251292
(1 row)
13261293

13271294
SELECT pathman.prepend_range_partition('test."RangeRel"');
1328-
NOTICE: Prepending new partition...
1329-
NOTICE: Done!
13301295
prepend_range_partition
13311296
-------------------------
13321297
test."RangeRel_5"
13331298
(1 row)
13341299

13351300
SELECT pathman.merge_range_partitions('test."RangeRel_1"', 'test."RangeRel_' || currval('test."RangeRel_seq"') || '"');
1336-
NOTICE: Altering first partition...
1337-
NOTICE: Copying data...
1338-
NOTICE: Dropping second partition...
1339-
NOTICE: Done!
13401301
merge_range_partitions
13411302
------------------------
13421303

13431304
(1 row)
13441305

13451306
SELECT pathman.split_range_partition('test."RangeRel_1"', '2015-01-01'::DATE);
1346-
NOTICE: Creating new partition...
1347-
NOTICE: Copying data to new partition...
1348-
NOTICE: Altering original partition...
1349-
NOTICE: Done!
13501307
split_range_partition
13511308
-------------------------
13521309
{12-31-2014,01-02-2015}
@@ -1374,7 +1331,7 @@ NOTICE: Copying data to partitions...
13741331
DROP TABLE test."RangeRel" CASCADE;
13751332
NOTICE: drop cascades to 5 other objects
13761333
SELECT * FROM pathman.pathman_config;
1377-
id | relname | attname | parttype | range_interval
1334+
id | partrel | attname | parttype | range_interval
13781335
----+--------------------+---------+----------+----------------
13791336
9 | test.num_range_rel | id | 2 | 1000
13801337
(1 row)
@@ -1418,7 +1375,6 @@ CREATE TABLE hash_rel (
14181375
value INTEGER NOT NULL);
14191376
INSERT INTO hash_rel (value) SELECT g FROM generate_series(1, 10000) as g;
14201377
SELECT create_hash_partitions('hash_rel', 'value', 3);
1421-
NOTICE: Copying data to partitions...
14221378
create_hash_partitions
14231379
------------------------
14241380
3
@@ -1451,36 +1407,24 @@ NOTICE: Copying data to partitions...
14511407
(1 row)
14521408

14531409
SELECT merge_range_partitions('range_rel_1', 'range_rel_2');
1454-
NOTICE: Altering first partition...
1455-
NOTICE: Copying data...
1456-
NOTICE: Dropping second partition...
1457-
NOTICE: Done!
14581410
merge_range_partitions
14591411
------------------------
14601412

14611413
(1 row)
14621414

14631415
SELECT split_range_partition('range_rel_1', '2010-02-15'::date);
1464-
NOTICE: Creating new partition...
1465-
NOTICE: Copying data to new partition...
1466-
NOTICE: Altering original partition...
1467-
NOTICE: Done!
14681416
split_range_partition
14691417
-------------------------
14701418
{01-01-2010,03-01-2010}
14711419
(1 row)
14721420

14731421
SELECT append_range_partition('range_rel');
1474-
NOTICE: Appending new partition...
1475-
NOTICE: Done!
14761422
append_range_partition
14771423
------------------------
14781424
public.range_rel_14
14791425
(1 row)
14801426

14811427
SELECT prepend_range_partition('range_rel');
1482-
NOTICE: Prepending new partition...
1483-
NOTICE: Done!
14841428
prepend_range_partition
14851429
-------------------------
14861430
public.range_rel_15

src/pathman.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#ifdef USE_ASSERT_CHECKING
3838
#include "utils.h"
3939
#define DebugPrintDatum(datum, typid) ( datum_to_cstring((datum), (typid)) )
40-
#elif
40+
#else
4141
#define DebugPrintDatum(datum, typid) ( "[use --enable-cassert]" )
4242
#endif
4343

0 commit comments

Comments
 (0)