@@ -280,11 +280,11 @@ ERROR: 'parttype' should not be NULL
280280SELECT validate_interval_value('pg_class', 'oid', 1, 'HASH', NULL); /* not ok */
281281ERROR: interval should be NULL for HASH partitioned table
282282SELECT validate_interval_value('pg_class', 'expr', 2, '1 mon', NULL); /* not ok */
283- ERROR: cannot find type name for attribute "expr" of relation "pg_class "
283+ ERROR: failed to analyze partitioning expression "expr"
284284SELECT validate_interval_value('pg_class', 'expr', 2, NULL, 'cooked_expr'); /* not ok */
285285ERROR: unrecognized token: "cooked_expr"
286286SELECT validate_interval_value('pg_class', 'EXPR', 1, 'HASH', NULL); /* not ok */
287- ERROR: cannot find type name for attribute "expr" of relation "pg_class "
287+ ERROR: failed to analyze partitioning expression "EXPR "
288288/* check function validate_relname() */
289289SELECT validate_relname('calamity.part_test');
290290 validate_relname
@@ -304,7 +304,7 @@ ERROR: 'relid' should not be NULL
304304SELECT validate_expression('calamity.part_test', NULL); /* not ok */
305305ERROR: 'expression' should not be NULL
306306SELECT validate_expression('calamity.part_test', 'valval'); /* not ok */
307- ERROR: cannot find type name for attribute "valval" of relation "part_test "
307+ ERROR: failed to analyze partitioning expression "valval"
308308SELECT validate_expression('calamity.part_test', 'random()'); /* not ok */
309309ERROR: failed to analyze partitioning expression "random()"
310310SELECT validate_expression('calamity.part_test', 'val'); /* OK */
@@ -580,7 +580,7 @@ ERROR: relation "0" does not exist
580580SELECT add_to_pathman_config('calamity.part_test', NULL); /* no expr */
581581ERROR: 'expression' should not be NULL
582582SELECT add_to_pathman_config('calamity.part_test', 'V_A_L'); /* wrong expr */
583- ERROR: cannot find type name for attribute "v_a_l" of relation "part_test "
583+ ERROR: failed to analyze partitioning expression "V_A_L "
584584SELECT add_to_pathman_config('calamity.part_test', 'val'); /* OK */
585585 add_to_pathman_config
586586-----------------------
@@ -851,9 +851,7 @@ DROP EXTENSION pg_pathman;
851851 */
852852CREATE SCHEMA calamity;
853853CREATE EXTENSION pg_pathman;
854- /* Change this setting for code coverage */
855- SET pg_pathman.enable_bounds_cache = false;
856- /* check view pathman_cache_stats */
854+ /* check that cache loading is lazy */
857855CREATE TABLE calamity.test_pathman_cache_stats(val NUMERIC NOT NULL);
858856SELECT create_range_partitions('calamity.test_pathman_cache_stats', 'val', 1, 10, 10);
859857 create_range_partitions
@@ -870,22 +868,54 @@ SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
870868 partition parents cache | 0
871869(4 rows)
872870
873- SELECT drop_partitions('calamity.test_pathman_cache_stats');
874- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_1
875- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_2
876- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_3
877- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_4
878- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_5
879- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_6
880- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_7
881- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_8
882- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_9
883- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_10
884- drop_partitions
885- -----------------
886- 10
871+ DROP TABLE calamity.test_pathman_cache_stats CASCADE;
872+ NOTICE: drop cascades to 11 other objects
873+ SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
874+ context | entries
875+ --------------------------+---------
876+ maintenance | 0
877+ partition bounds cache | 0
878+ partition dispatch cache | 0
879+ partition parents cache | 0
880+ (4 rows)
881+
882+ /* Change this setting for code coverage */
883+ SET pg_pathman.enable_bounds_cache = false;
884+ /* check view pathman_cache_stats (bounds cache disabled) */
885+ CREATE TABLE calamity.test_pathman_cache_stats(val NUMERIC NOT NULL);
886+ SELECT create_range_partitions('calamity.test_pathman_cache_stats', 'val', 1, 10, 10);
887+ create_range_partitions
888+ -------------------------
889+ 10
887890(1 row)
888891
892+ EXPLAIN (COSTS OFF) SELECT * FROM calamity.test_pathman_cache_stats;
893+ QUERY PLAN
894+ -----------------------------------------------
895+ Append
896+ -> Seq Scan on test_pathman_cache_stats_1
897+ -> Seq Scan on test_pathman_cache_stats_2
898+ -> Seq Scan on test_pathman_cache_stats_3
899+ -> Seq Scan on test_pathman_cache_stats_4
900+ -> Seq Scan on test_pathman_cache_stats_5
901+ -> Seq Scan on test_pathman_cache_stats_6
902+ -> Seq Scan on test_pathman_cache_stats_7
903+ -> Seq Scan on test_pathman_cache_stats_8
904+ -> Seq Scan on test_pathman_cache_stats_9
905+ -> Seq Scan on test_pathman_cache_stats_10
906+ (11 rows)
907+
908+ SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
909+ context | entries
910+ --------------------------+---------
911+ maintenance | 0
912+ partition bounds cache | 0
913+ partition dispatch cache | 1
914+ partition parents cache | 10
915+ (4 rows)
916+
917+ DROP TABLE calamity.test_pathman_cache_stats CASCADE;
918+ NOTICE: drop cascades to 11 other objects
889919SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
890920 context | entries
891921--------------------------+---------
@@ -895,42 +925,102 @@ SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
895925 partition parents cache | 0
896926(4 rows)
897927
898- DROP TABLE calamity.test_pathman_cache_stats;
899928/* Restore this GUC */
900929SET pg_pathman.enable_bounds_cache = true;
901- /* check view pathman_cache_stats (one more time ) */
930+ /* check view pathman_cache_stats (bounds cache enabled ) */
902931CREATE TABLE calamity.test_pathman_cache_stats(val NUMERIC NOT NULL);
903932SELECT create_range_partitions('calamity.test_pathman_cache_stats', 'val', 1, 10, 10);
904933 create_range_partitions
905934-------------------------
906935 10
907936(1 row)
908937
938+ EXPLAIN (COSTS OFF) SELECT * FROM calamity.test_pathman_cache_stats;
939+ QUERY PLAN
940+ -----------------------------------------------
941+ Append
942+ -> Seq Scan on test_pathman_cache_stats_1
943+ -> Seq Scan on test_pathman_cache_stats_2
944+ -> Seq Scan on test_pathman_cache_stats_3
945+ -> Seq Scan on test_pathman_cache_stats_4
946+ -> Seq Scan on test_pathman_cache_stats_5
947+ -> Seq Scan on test_pathman_cache_stats_6
948+ -> Seq Scan on test_pathman_cache_stats_7
949+ -> Seq Scan on test_pathman_cache_stats_8
950+ -> Seq Scan on test_pathman_cache_stats_9
951+ -> Seq Scan on test_pathman_cache_stats_10
952+ (11 rows)
953+
909954SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
910955 context | entries
911956--------------------------+---------
912957 maintenance | 0
913- partition bounds cache | 0
958+ partition bounds cache | 10
914959 partition dispatch cache | 1
960+ partition parents cache | 10
961+ (4 rows)
962+
963+ DROP TABLE calamity.test_pathman_cache_stats CASCADE;
964+ NOTICE: drop cascades to 11 other objects
965+ SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
966+ context | entries
967+ --------------------------+---------
968+ maintenance | 0
969+ partition bounds cache | 0
970+ partition dispatch cache | 0
915971 partition parents cache | 0
916972(4 rows)
917973
918- SELECT drop_partitions('calamity.test_pathman_cache_stats');
919- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_1
920- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_2
921- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_3
922- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_4
923- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_5
924- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_6
925- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_7
926- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_8
927- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_9
928- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_10
929- drop_partitions
930- -----------------
931- 10
974+ /* check that parents cache has been flushed after partition was dropped */
975+ CREATE TABLE calamity.test_pathman_cache_stats(val NUMERIC NOT NULL);
976+ SELECT create_range_partitions('calamity.test_pathman_cache_stats', 'val', 1, 10, 10);
977+ create_range_partitions
978+ -------------------------
979+ 10
932980(1 row)
933981
982+ EXPLAIN (COSTS OFF) SELECT * FROM calamity.test_pathman_cache_stats;
983+ QUERY PLAN
984+ -----------------------------------------------
985+ Append
986+ -> Seq Scan on test_pathman_cache_stats_1
987+ -> Seq Scan on test_pathman_cache_stats_2
988+ -> Seq Scan on test_pathman_cache_stats_3
989+ -> Seq Scan on test_pathman_cache_stats_4
990+ -> Seq Scan on test_pathman_cache_stats_5
991+ -> Seq Scan on test_pathman_cache_stats_6
992+ -> Seq Scan on test_pathman_cache_stats_7
993+ -> Seq Scan on test_pathman_cache_stats_8
994+ -> Seq Scan on test_pathman_cache_stats_9
995+ -> Seq Scan on test_pathman_cache_stats_10
996+ (11 rows)
997+
998+ SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
999+ context | entries
1000+ --------------------------+---------
1001+ maintenance | 0
1002+ partition bounds cache | 10
1003+ partition dispatch cache | 1
1004+ partition parents cache | 10
1005+ (4 rows)
1006+
1007+ SELECT drop_range_partition('calamity.test_pathman_cache_stats_1');
1008+ drop_range_partition
1009+ -------------------------------------
1010+ calamity.test_pathman_cache_stats_1
1011+ (1 row)
1012+
1013+ SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
1014+ context | entries
1015+ --------------------------+---------
1016+ maintenance | 0
1017+ partition bounds cache | 9
1018+ partition dispatch cache | 1
1019+ partition parents cache | 0
1020+ (4 rows)
1021+
1022+ DROP TABLE calamity.test_pathman_cache_stats CASCADE;
1023+ NOTICE: drop cascades to 10 other objects
9341024SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
9351025 context | entries
9361026--------------------------+---------
@@ -940,7 +1030,6 @@ SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
9401030 partition parents cache | 0
9411031(4 rows)
9421032
943- DROP TABLE calamity.test_pathman_cache_stats;
9441033DROP SCHEMA calamity CASCADE;
9451034DROP EXTENSION pg_pathman;
9461035/*
0 commit comments