File tree 2 files changed +24
-0
lines changed
Filter options
2 files changed +24
-0
lines changed
Original file line number Diff line number Diff line change @@ -112,6 +112,23 @@ create_single_range_partition_internal(Oid parent_relid,
112
112
init_callback_params callback_params ;
113
113
List * trigger_columns = NIL ;
114
114
Node * expr ;
115
+ Datum values [Natts_pathman_config ];
116
+ bool isnull [Natts_pathman_config ];
117
+
118
+
119
+ /*
120
+ * Sanity check. Probably needed only if some absurd init_callback
121
+ * decides to drop the table while we are creating partitions.
122
+ * It seems much better to use prel cache here, but this doesn't work
123
+ * because it regards tables with no partitions as not partitioned at all
124
+ * (build_pathman_relation_info returns NULL), and if I comment out that,
125
+ * tests fail for not immediately obvious reasons. Don't want to dig
126
+ * into this now.
127
+ */
128
+ if (!pathman_config_contains_relation (parent_relid , values , isnull , NULL , NULL ))
129
+ {
130
+ elog (ERROR , "Can't create range partition: relid %u doesn't exist or not partitioned" , parent_relid );
131
+ }
115
132
116
133
/* Generate a name if asked to */
117
134
if (!partition_rv )
Original file line number Diff line number Diff line change @@ -252,6 +252,11 @@ show_cache_stats_internal(PG_FUNCTION_ARGS)
252
252
253
253
funccxt = SRF_FIRSTCALL_INIT ();
254
254
255
+ if (!TopPathmanContext )
256
+ {
257
+ elog (ERROR , "pg_pathman's memory contexts are not initialized yet" );
258
+ }
259
+
255
260
old_mcxt = MemoryContextSwitchTo (funccxt -> multi_call_memory_ctx );
256
261
257
262
usercxt = (show_cache_stats_cxt * ) palloc (sizeof (show_cache_stats_cxt ));
@@ -893,6 +898,8 @@ add_to_pathman_config(PG_FUNCTION_ARGS)
893
898
}
894
899
}
895
900
901
+ CacheInvalidateRelcacheByRelid (relid );
902
+
896
903
PG_RETURN_BOOL (true);
897
904
}
898
905
You can’t perform that action at this time.
0 commit comments