@@ -28,21 +28,33 @@ SELECT context, entries FROM pathman_cache_stats ORDER BY context;
28
28
partition status cache | 3
29
29
(4 rows)
30
30
31
- /* change column's type (should flush caches) */
31
+ /*
32
+ * Get parsed and analyzed expression.
33
+ */
34
+ CREATE FUNCTION get_cached_partition_cooked_key(REGCLASS)
35
+ RETURNS TEXT AS 'pg_pathman', 'get_cached_partition_cooked_key_pl'
36
+ LANGUAGE C STRICT;
32
37
SELECT get_partition_cooked_key('test_column_type.test'::REGCLASS);
33
38
get_partition_cooked_key
34
39
-----------------------------------------------------------------------------------------------------------------------
35
40
{VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location 8}
36
41
(1 row)
37
42
43
+ SELECT get_cached_partition_cooked_key('test_column_type.test'::REGCLASS);
44
+ get_cached_partition_cooked_key
45
+ -----------------------------------------------------------------------------------------------------------------------
46
+ {VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location 8}
47
+ (1 row)
48
+
38
49
SELECT get_partition_key_type('test_column_type.test'::REGCLASS);
39
50
get_partition_key_type
40
51
------------------------
41
52
integer
42
53
(1 row)
43
54
55
+ /* change column's type (should also flush caches) */
44
56
ALTER TABLE test_column_type.test ALTER val TYPE NUMERIC;
45
- /* check that expression has been built */
57
+ /* check that correct expression has been built */
46
58
SELECT get_partition_key_type('test_column_type.test'::REGCLASS);
47
59
get_partition_key_type
48
60
------------------------
@@ -55,6 +67,13 @@ SELECT get_partition_cooked_key('test_column_type.test'::REGCLASS);
55
67
{VAR :varno 1 :varattno 1 :vartype 1700 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location 8}
56
68
(1 row)
57
69
70
+ SELECT get_cached_partition_cooked_key('test_column_type.test'::REGCLASS);
71
+ get_cached_partition_cooked_key
72
+ -------------------------------------------------------------------------------------------------------------------------
73
+ {VAR :varno 1 :varattno 1 :vartype 1700 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnoold 1 :varoattno 1 :location 8}
74
+ (1 row)
75
+
76
+ DROP FUNCTION get_cached_partition_cooked_key(REGCLASS);
58
77
/* make sure that everything works properly */
59
78
SELECT * FROM test_column_type.test;
60
79
val
0 commit comments