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

Commit7f4f39e

Browse files
committed
add regression test 'pathman_column_type'
1 parent8cd5149 commit7f4f39e

File tree

3 files changed

+86
-0
lines changed

3 files changed

+86
-0
lines changed

‎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

‎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;

‎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