summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorJeff Davis2024-10-22 22:06:55 +0000
committerJeff Davis2024-10-22 22:06:55 +0000
commitce207d2a79017713c0293bf70132dc6d41166b03 (patch)
tree40a9575ea42f1c8eadd28e542a8f664aeb7a7ed1 /src/include
parentdbe6bd4343d8cdb1b3cf1f66d6f66dd876a6c09d (diff)
Add functions pg_set_attribute_stats() and pg_clear_attribute_stats().
Enable manipulation of attribute statistics. Only superficial validation is performed, so it's possible to add nonsense, and it's up to the planner (or other users of statistics) to behave reasonably in that case. Bump catalog version. Author: Corey Huinker Discussion: https://postgr.es/m/CADkLM=eErgzn7ECDpwFcptJKOk9SxZEk5Pot4d94eVTZsvj3gw@mail.gmail.com
Diffstat (limited to 'src/include')
-rw-r--r--src/include/catalog/catversion.h2
-rw-r--r--src/include/catalog/pg_proc.dat14
-rw-r--r--src/include/statistics/stat_utils.h7
3 files changed, 22 insertions, 1 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index 227fb6fb4cd..391bf04bf5d 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -57,6 +57,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 202410221
+#define CATALOG_VERSION_NO 202410222
#endif
diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat
index b4430e7c77f..6297b7c679d 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -12342,6 +12342,20 @@
proargnames => '{summarized_tli,summarized_lsn,pending_lsn,summarizer_pid}',
prosrc => 'pg_get_wal_summarizer_state' },
+# Statistics Import
+{ oid => '9162',
+ descr => 'set statistics on attribute',
+ proname => 'pg_set_attribute_stats', provolatile => 'v', proisstrict => 'f',
+ proparallel => 'u', prorettype => 'void',
+ proargtypes => 'regclass name bool float4 int4 float4 text _float4 text float4 text _float4 _float4 text float4 text',
+ proargnames => '{relation,attname,inherited,null_frac,avg_width,n_distinct,most_common_vals,most_common_freqs,histogram_bounds,correlation,most_common_elems,most_common_elem_freqs,elem_count_histogram,range_length_histogram,range_empty_frac,range_bounds_histogram}',
+ prosrc => 'pg_set_attribute_stats' },
+{ oid => '9163',
+ descr => 'clear statistics on attribute',
+ proname => 'pg_clear_attribute_stats', provolatile => 'v', proisstrict => 'f',
+ proparallel => 'u', prorettype => 'void',
+ proargtypes => 'regclass name bool',
+ proargnames => '{relation,attname,inherited}',
+ prosrc => 'pg_clear_attribute_stats' },
{ oid => '9944',
descr => 'set statistics on relation',
proname => 'pg_set_relation_stats', provolatile => 'v', proisstrict => 'f',
diff --git a/src/include/statistics/stat_utils.h b/src/include/statistics/stat_utils.h
index 46057c60c03..e5f19d00609 100644
--- a/src/include/statistics/stat_utils.h
+++ b/src/include/statistics/stat_utils.h
@@ -24,6 +24,13 @@ struct StatsArgInfo
extern void stats_check_required_arg(FunctionCallInfo fcinfo,
struct StatsArgInfo *arginfo,
int argnum);
+extern bool stats_check_arg_array(FunctionCallInfo fcinfo,
+ struct StatsArgInfo *arginfo, int argnum,
+ int elevel);
+extern bool stats_check_arg_pair(FunctionCallInfo fcinfo,
+ struct StatsArgInfo *arginfo,
+ int argnum1, int argnum2, int elevel);
+
extern void stats_lock_check_privileges(Oid reloid);
#endif /* STATS_UTILS_H */