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

Commitac7f02b

Browse files
committed
Merge branch 'rel_future_beta' into rel_future_strings
2 parents9fedc28 +89c5b23 commitac7f02b

26 files changed

+1308
-419
lines changed

‎LICENSE

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
Copyright (c) 2015-2016, Postgres Professional
2-
3-
Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
1+
pg_pathman is released under the PostgreSQL License, a liberal Open Source license, similar to the BSD or MIT licenses.
42

3+
Copyright (c) 2015-2017, Postgres Professional
4+
Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
55
Portions Copyright (c) 1994, The Regents of the University of California
66

77
Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies.
88

9-
IN NO EVENT SHALLTHE UNIVERSITY OF CALIFORNIABE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IFTHE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9+
IN NO EVENT SHALLPOSTGRES PROFESSIONALBE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IFPOSTGRES PROFESSIONAL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1010

11-
THE UNIVERSITY OF CALIFORNIASPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, ANDTHE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
11+
POSTGRES PROFESSIONALSPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, ANDPOSTGRES PROFESSIONAL HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

‎Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ REGRESS = pathman_basic \
3838
pathman_rowmarks\
3939
pathman_runtime_nodes\
4040
pathman_utility_stmt\
41+
pathman_column_type\
4142
pathman_calamity
4243

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

‎README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ create_hash_partitions(relation REGCLASS,
9999
attributeTEXT,
100100
partitions_countINTEGER,
101101
partition_dataBOOLEAN DEFAULT TRUE,
102-
partition_namesTEXT[] DEFAULTNULL,
103-
tablespacesTEXT[] DEFAULTNULL)
102+
partition_namesTEXT[] DEFAULTNULL,
103+
tablespacesTEXT[] DEFAULTNULL)
104104
```
105105
Performs HASH partitioning for`relation` by integer key`attribute`. The`partitions_count` parameter specifies the number of partitions to create; it cannot be changed afterwards. If`partition_data` is`true` then all the data will be automatically copied from the parent table to partitions. Note that data migration may took a while to finish and the table will be locked until transaction commits. See`partition_table_concurrently()` for a lock-free way to migrate data. Partition creation callback is invoked for each partition if set beforehand (see`set_init_callback()`).
106106

@@ -665,11 +665,11 @@ SELECT disable_pathman_for('range_rel');
665665
```
666666
All sections and data will remain unchanged and will be handled by the standard PostgreSQL inheritance mechanism.
667667

668-
##Feedback
668+
##Feedback
669669
Do not hesitate to post your issues, questions and new ideas at the[issues](https://github.com/postgrespro/pg_pathman/issues) page.
670670

671671
##Authors
672-
Ildar Musin <i.musin@postgrespro.ru> Postgres Professional Ltd., Russia
673-
Alexander Korotkov <a.korotkov@postgrespro.ru> Postgres Professional Ltd., Russia
674-
Dmitry Ivanov <d.ivanov@postgrespro.ru> Postgres Professional Ltd., Russia
672+
Ildar Musin <i.musin@postgrespro.ru> Postgres Professional Ltd., Russia
673+
Alexander Korotkov <a.korotkov@postgrespro.ru> Postgres Professional Ltd., Russia
674+
Dmitry Ivanov <d.ivanov@postgrespro.ru> Postgres Professional Ltd., Russia
675675

‎README.rus.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,6 @@ SELECT disable_pathman_for('range_rel');
488488
Если у вас есть вопросы или предложения, а также если вы обнаружили ошибки, напишите нам в разделе[issues](https://github.com/postgrespro/pg_pathman/issues).
489489

490490
##Авторы
491-
Ильдар Мусин <i.musin@postgrespro.ru> Postgres Professional, Россия
492-
Александр Коротков <a.korotkov@postgrespro.ru> Postgres Professional, Россия
493-
Дмитрий Иванов <d.ivanov@postgrespro.ru> Postgres Professional, Россия
491+
Ильдар Мусин <i.musin@postgrespro.ru> Postgres Professional, Россия
492+
Александр Коротков <a.korotkov@postgrespro.ru> Postgres Professional, Россия
493+
Дмитрий Иванов <d.ivanov@postgrespro.ru> Postgres Professional, Россия

‎expected/pathman_basic.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1990,6 +1990,6 @@ ORDER BY partition;
19901990
DROP TABLE test.provided_part_names CASCADE;
19911991
NOTICE: drop cascades to 2 other objects
19921992
DROP SCHEMA test CASCADE;
1993-
NOTICE: drop cascades to48 other objects
1993+
NOTICE: drop cascades to47 other objects
19941994
DROP EXTENSION pg_pathman CASCADE;
19951995
DROP SCHEMA pathman CASCADE;

‎expected/pathman_calamity.out

Lines changed: 103 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ SELECT create_hash_partitions('calamity.part_ok', 'val', 4);
502502
CREATE TABLE calamity.wrong_partition (LIKE calamity.part_test) INHERITS (calamity.part_test); /* wrong partition w\o constraints */
503503
NOTICE: merging column "val" with inherited definition
504504
SELECT add_to_pathman_config('calamity.part_test', 'val');
505-
ERROR: constraint "pathman_wrong_partition_1_check"for partition "wrong_partition" does not exist
505+
ERROR: constraint "pathman_wrong_partition_1_check"of partition "wrong_partition" does not exist
506506
EXPLAIN (COSTS OFF) SELECT * FROM calamity.part_ok; /* check that pathman is enabled */
507507
QUERY PLAN
508508
-----------------------------
@@ -514,7 +514,7 @@ EXPLAIN (COSTS OFF) SELECT * FROM calamity.part_ok; /* check that pathman is ena
514514
(5 rows)
515515

516516
SELECT add_to_pathman_config('calamity.part_test', 'val', '10');
517-
ERROR: constraint "pathman_wrong_partition_1_check"for partition "wrong_partition" does not exist
517+
ERROR: constraint "pathman_wrong_partition_1_check"of partition "wrong_partition" does not exist
518518
EXPLAIN (COSTS OFF) SELECT * FROM calamity.part_ok; /* check that pathman is enabled */
519519
QUERY PLAN
520520
-----------------------------
@@ -661,6 +661,107 @@ NOTICE: drop cascades to table calamity.test_range_oid_1
661661
DROP SCHEMA calamity CASCADE;
662662
NOTICE: drop cascades to 18 other objects
663663
DROP EXTENSION pg_pathman;
664+
/*
665+
* -------------------------------------
666+
* Special tests (pathman_cache_stats)
667+
* -------------------------------------
668+
*/
669+
CREATE SCHEMA calamity;
670+
CREATE EXTENSION pg_pathman;
671+
/* Change this setting for code coverage */
672+
SET pg_pathman.enable_bounds_cache = false;
673+
/* check view pathman_cache_stats */
674+
CREATE TABLE calamity.test_pathman_cache_stats(val NUMERIC NOT NULL);
675+
SELECT create_range_partitions('calamity.test_pathman_cache_stats', 'val', 1, 10, 10);
676+
NOTICE: sequence "test_pathman_cache_stats_seq" does not exist, skipping
677+
create_range_partitions
678+
-------------------------
679+
10
680+
(1 row)
681+
682+
SELECT context, entries FROM pathman_cache_stats ORDER BY context;/* OK */
683+
context | entries
684+
--------------------------+---------
685+
maintenance | 0
686+
partition bounds cache | 0
687+
partition dispatch cache | 1
688+
partition parents cache | 10
689+
(4 rows)
690+
691+
SELECT drop_partitions('calamity.test_pathman_cache_stats');
692+
NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_1
693+
NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_2
694+
NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_3
695+
NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_4
696+
NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_5
697+
NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_6
698+
NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_7
699+
NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_8
700+
NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_9
701+
NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_10
702+
drop_partitions
703+
-----------------
704+
10
705+
(1 row)
706+
707+
SELECT context, entries FROM pathman_cache_stats ORDER BY context;/* OK */
708+
context | entries
709+
--------------------------+---------
710+
maintenance | 0
711+
partition bounds cache | 0
712+
partition dispatch cache | 0
713+
partition parents cache | 0
714+
(4 rows)
715+
716+
DROP TABLE calamity.test_pathman_cache_stats;
717+
/* Restore this GUC */
718+
SET pg_pathman.enable_bounds_cache = true;
719+
/* check view pathman_cache_stats (one more time) */
720+
CREATE TABLE calamity.test_pathman_cache_stats(val NUMERIC NOT NULL);
721+
SELECT create_range_partitions('calamity.test_pathman_cache_stats', 'val', 1, 10, 10);
722+
create_range_partitions
723+
-------------------------
724+
10
725+
(1 row)
726+
727+
SELECT context, entries FROM pathman_cache_stats ORDER BY context;/* OK */
728+
context | entries
729+
--------------------------+---------
730+
maintenance | 0
731+
partition bounds cache | 10
732+
partition dispatch cache | 1
733+
partition parents cache | 10
734+
(4 rows)
735+
736+
SELECT drop_partitions('calamity.test_pathman_cache_stats');
737+
NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_1
738+
NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_2
739+
NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_3
740+
NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_4
741+
NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_5
742+
NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_6
743+
NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_7
744+
NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_8
745+
NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_9
746+
NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_10
747+
drop_partitions
748+
-----------------
749+
10
750+
(1 row)
751+
752+
SELECT context, entries FROM pathman_cache_stats ORDER BY context;/* OK */
753+
context | entries
754+
--------------------------+---------
755+
maintenance | 0
756+
partition bounds cache | 0
757+
partition dispatch cache | 0
758+
partition parents cache | 0
759+
(4 rows)
760+
761+
DROP TABLE calamity.test_pathman_cache_stats;
762+
DROP SCHEMA calamity CASCADE;
763+
NOTICE: drop cascades to sequence calamity.test_pathman_cache_stats_seq
764+
DROP EXTENSION pg_pathman;
664765
/*
665766
* ------------------------------------------
666767
* Special tests (uninitialized pg_pathman)

‎expected/pathman_column_type.out

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
\set VERBOSITY terse
2+
SET search_path = 'public';
3+
CREATE EXTENSION pg_pathman;
4+
CREATE SCHEMA test_column_type;
5+
/* create new table (val int) */
6+
CREATE TABLE test_column_type.test(val INT4 NOT NULL);
7+
SELECT create_range_partitions('test_column_type.test', 'val', 1, 10, 10);
8+
NOTICE: sequence "test_seq" does not exist, skipping
9+
create_range_partitions
10+
-------------------------
11+
10
12+
(1 row)
13+
14+
/* make sure that bounds and dispatch info has been cached */
15+
SELECT * FROM test_column_type.test;
16+
val
17+
-----
18+
(0 rows)
19+
20+
SELECT context, entries FROM pathman_cache_stats ORDER BY context;
21+
context | entries
22+
--------------------------+---------
23+
maintenance | 0
24+
partition bounds cache | 10
25+
partition dispatch cache | 1
26+
partition parents cache | 10
27+
(4 rows)
28+
29+
/* change column's type (should flush caches) */
30+
ALTER TABLE test_column_type.test ALTER val TYPE NUMERIC;
31+
/* make sure that everything works properly */
32+
SELECT * FROM test_column_type.test;
33+
val
34+
-----
35+
(0 rows)
36+
37+
SELECT context, entries FROM pathman_cache_stats ORDER BY context;
38+
context | entries
39+
--------------------------+---------
40+
maintenance | 0
41+
partition bounds cache | 10
42+
partition dispatch cache | 1
43+
partition parents cache | 10
44+
(4 rows)
45+
46+
/* check insert dispatching */
47+
INSERT INTO test_column_type.test VALUES (1);
48+
SELECT tableoid::regclass, * FROM test_column_type.test;
49+
tableoid | val
50+
-------------------------+-----
51+
test_column_type.test_1 | 1
52+
(1 row)
53+
54+
DROP SCHEMA test_column_type CASCADE;
55+
NOTICE: drop cascades to 12 other objects
56+
DROP EXTENSION pg_pathman;

‎init.sql

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,12 @@ LANGUAGE plpgsql;
250250
*/
251251
CREATEOR REPLACE FUNCTION @extschema@.show_partition_list()
252252
RETURNS TABLE (
253-
parentREGCLASS,
254-
partitionREGCLASS,
255-
parttypeINT4,
256-
partattrTEXT,
257-
range_minTEXT,
258-
range_maxTEXT)
253+
parentREGCLASS,
254+
partitionREGCLASS,
255+
parttypeINT4,
256+
partattrTEXT,
257+
range_minTEXT,
258+
range_maxTEXT)
259259
AS'pg_pathman','show_partition_list_internal'
260260
LANGUAGE C STRICT;
261261

@@ -267,6 +267,24 @@ AS SELECT * FROM @extschema@.show_partition_list();
267267

268268
GRANTSELECTON @extschema@.pathman_partition_list TO PUBLIC;
269269

270+
/*
271+
* Show memory usage of pg_pathman's caches.
272+
*/
273+
CREATEOR REPLACE FUNCTION @extschema@.show_cache_stats()
274+
RETURNS TABLE (
275+
contextTEXT,
276+
sizeINT8,
277+
usedINT8,
278+
entriesINT8)
279+
AS'pg_pathman','show_cache_stats_internal'
280+
LANGUAGE C STRICT;
281+
282+
/*
283+
* View for show_cache_stats().
284+
*/
285+
CREATEOR REPLACE VIEW @extschema@.pathman_cache_stats
286+
ASSELECT*FROM @extschema@.show_cache_stats();
287+
270288
/*
271289
* Show all existing concurrent partitioning tasks.
272290
*/

‎sql/pathman_calamity.sql

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,41 @@ SELECT get_part_range('calamity.test_range_oid_1', NULL::INT4);/* OK */
260260

261261
DROPTABLEcalamity.test_range_oid CASCADE;
262262

263+
DROPSCHEMA calamity CASCADE;
264+
DROP EXTENSION pg_pathman;
265+
266+
267+
268+
/*
269+
* -------------------------------------
270+
* Special tests (pathman_cache_stats)
271+
* -------------------------------------
272+
*/
273+
274+
CREATESCHEMAcalamity;
275+
CREATE EXTENSION pg_pathman;
276+
277+
/* Change this setting for code coverage*/
278+
SETpg_pathman.enable_bounds_cache= false;
279+
280+
/* check view pathman_cache_stats*/
281+
CREATETABLEcalamity.test_pathman_cache_stats(valNUMERICNOT NULL);
282+
SELECT create_range_partitions('calamity.test_pathman_cache_stats','val',1,10,10);
283+
SELECT context, entriesFROM pathman_cache_statsORDER BY context;/* OK*/
284+
SELECT drop_partitions('calamity.test_pathman_cache_stats');
285+
SELECT context, entriesFROM pathman_cache_statsORDER BY context;/* OK*/
286+
DROPTABLEcalamity.test_pathman_cache_stats;
287+
288+
/* Restore this GUC*/
289+
SETpg_pathman.enable_bounds_cache= true;
290+
291+
/* check view pathman_cache_stats (one more time)*/
292+
CREATETABLEcalamity.test_pathman_cache_stats(valNUMERICNOT NULL);
293+
SELECT create_range_partitions('calamity.test_pathman_cache_stats','val',1,10,10);
294+
SELECT context, entriesFROM pathman_cache_statsORDER BY context;/* OK*/
295+
SELECT drop_partitions('calamity.test_pathman_cache_stats');
296+
SELECT context, entriesFROM pathman_cache_statsORDER BY context;/* OK*/
297+
DROPTABLEcalamity.test_pathman_cache_stats;
263298

264299
DROPSCHEMA calamity CASCADE;
265300
DROP EXTENSION pg_pathman;

‎sql/pathman_column_type.sql

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
\set VERBOSITY terse
2+
3+
SET search_path='public';
4+
CREATE EXTENSION pg_pathman;
5+
CREATESCHEMAtest_column_type;
6+
7+
8+
/* create new table (val int)*/
9+
CREATETABLEtest_column_type.test(val INT4NOT NULL);
10+
SELECT create_range_partitions('test_column_type.test','val',1,10,10);
11+
12+
/* make sure that bounds and dispatch info has been cached*/
13+
SELECT*FROMtest_column_type.test;
14+
SELECT context, entriesFROM pathman_cache_statsORDER BY context;
15+
16+
/* change column's type (should flush caches)*/
17+
ALTERTABLEtest_column_type.test ALTER val TYPENUMERIC;
18+
19+
/* make sure that everything works properly*/
20+
SELECT*FROMtest_column_type.test;
21+
SELECT context, entriesFROM pathman_cache_statsORDER BY context;
22+
23+
/* check insert dispatching*/
24+
INSERT INTOtest_column_type.testVALUES (1);
25+
SELECT tableoid::regclass,*FROMtest_column_type.test;
26+
27+
28+
DROPSCHEMA test_column_type CASCADE;
29+
DROP EXTENSION pg_pathman;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp