aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Davis <jdavis@postgresql.org>2024-10-22 12:48:01 -0700
committerJeff Davis <jdavis@postgresql.org>2024-10-22 12:48:01 -0700
commitdbe6bd4343d8cdb1b3cf1f66d6f66dd876a6c09d (patch)
tree7dc79dd167e54cb70784364b6d226a06e2159085
parent774171c4f640853b1cf8747a4762631d2f5d25be (diff)
downloadpostgresql-dbe6bd4343d8cdb1b3cf1f66d6f66dd876a6c09d.tar.gz
postgresql-dbe6bd4343d8cdb1b3cf1f66d6f66dd876a6c09d.zip
Change pg_*_relation_stats() functions to return type to void.
These functions will either raise an ERROR or run to normal completion, so no return value is necessary. Bump catalog version. Author: Corey Huinker Discussion: https://postgr.es/m/CADkLM=cBF8rnphuTyHFi3KYzB9ByDgx57HwK9Rz2yp7S+Om87w@mail.gmail.com
-rw-r--r--doc/src/sgml/func.sgml11
-rw-r--r--src/backend/catalog/system_functions.sql2
-rw-r--r--src/backend/statistics/relation_stats.c6
-rw-r--r--src/include/catalog/catversion.h2
-rw-r--r--src/include/catalog/pg_proc.dat4
-rw-r--r--src/test/regress/expected/stats_import.out16
6 files changed, 20 insertions, 21 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index ad663c94d77..14dd035134a 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -30174,15 +30174,13 @@ DETAIL: Make sure pg_wal_replay_wait() isn't called within a transaction with a
<optional>, <parameter>relpages</parameter> <type>integer</type></optional>
<optional>, <parameter>reltuples</parameter> <type>real</type></optional>
<optional>, <parameter>relallvisible</parameter> <type>integer</type></optional> )
- <returnvalue>boolean</returnvalue>
+ <returnvalue>void</returnvalue>
</para>
<para>
Updates relation-level statistics for the given relation to the
specified values. The parameters correspond to columns in <link
linkend="catalog-pg-class"><structname>pg_class</structname></link>. Unspecified
- or <literal>NULL</literal> values leave the setting
- unchanged. Returns <literal>true</literal> if a change was made;
- <literal>false</literal> otherwise.
+ or <literal>NULL</literal> values leave the setting unchanged.
</para>
<para>
Ordinarily, these statistics are collected automatically or updated
@@ -30212,12 +30210,11 @@ DETAIL: Make sure pg_wal_replay_wait() isn't called within a transaction with a
<primary>pg_clear_relation_stats</primary>
</indexterm>
<function>pg_clear_relation_stats</function> ( <parameter>relation</parameter> <type>regclass</type> )
- <returnvalue>boolean</returnvalue>
+ <returnvalue>void</returnvalue>
</para>
<para>
Clears table-level statistics for the given relation, as though the
- table was newly created. Returns <literal>true</literal> if a change
- was made; <literal>false</literal> otherwise.
+ table was newly created.
</para>
<para>
The caller must have the <literal>MAINTAIN</literal> privilege on
diff --git a/src/backend/catalog/system_functions.sql b/src/backend/catalog/system_functions.sql
index 92b6aefe7aa..b7e2906f116 100644
--- a/src/backend/catalog/system_functions.sql
+++ b/src/backend/catalog/system_functions.sql
@@ -644,7 +644,7 @@ CREATE OR REPLACE FUNCTION
relpages integer DEFAULT NULL,
reltuples real DEFAULT NULL,
relallvisible integer DEFAULT NULL)
-RETURNS bool
+RETURNS void
LANGUAGE INTERNAL
CALLED ON NULL INPUT VOLATILE
AS 'pg_set_relation_stats';
diff --git a/src/backend/statistics/relation_stats.c b/src/backend/statistics/relation_stats.c
index 1a6d1640c30..b1eb8a9bbaf 100644
--- a/src/backend/statistics/relation_stats.c
+++ b/src/backend/statistics/relation_stats.c
@@ -188,7 +188,8 @@ relation_statistics_update(FunctionCallInfo fcinfo, int elevel)
Datum
pg_set_relation_stats(PG_FUNCTION_ARGS)
{
- PG_RETURN_BOOL(relation_statistics_update(fcinfo, ERROR));
+ relation_statistics_update(fcinfo, ERROR);
+ PG_RETURN_VOID();
}
/*
@@ -211,5 +212,6 @@ pg_clear_relation_stats(PG_FUNCTION_ARGS)
newfcinfo->args[3].value = DEFAULT_RELALLVISIBLE;
newfcinfo->args[3].isnull = false;
- PG_RETURN_BOOL(relation_statistics_update(newfcinfo, ERROR));
+ relation_statistics_update(newfcinfo, ERROR);
+ PG_RETURN_VOID();
}
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index 842c43c0b68..227fb6fb4cd 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -57,6 +57,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 202410141
+#define CATALOG_VERSION_NO 202410221
#endif
diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat
index 7c0b74fe055..b4430e7c77f 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -12345,14 +12345,14 @@
{ oid => '9944',
descr => 'set statistics on relation',
proname => 'pg_set_relation_stats', provolatile => 'v', proisstrict => 'f',
- proparallel => 'u', prorettype => 'bool',
+ proparallel => 'u', prorettype => 'void',
proargtypes => 'regclass int4 float4 int4',
proargnames => '{relation,relpages,reltuples,relallvisible}',
prosrc => 'pg_set_relation_stats' },
{ oid => '9945',
descr => 'clear statistics on relation',
proname => 'pg_clear_relation_stats', provolatile => 'v', proisstrict => 'f',
- proparallel => 'u', prorettype => 'bool',
+ proparallel => 'u', prorettype => 'void',
proargtypes => 'regclass',
proargnames => '{relation}',
prosrc => 'pg_clear_relation_stats' },
diff --git a/src/test/regress/expected/stats_import.out b/src/test/regress/expected/stats_import.out
index a4e3a0f3c48..b50af75bb97 100644
--- a/src/test/regress/expected/stats_import.out
+++ b/src/test/regress/expected/stats_import.out
@@ -38,7 +38,7 @@ SELECT
relallvisible => 4::integer);
pg_set_relation_stats
-----------------------
- t
+
(1 row)
-- reltuples default
@@ -50,7 +50,7 @@ SELECT
relallvisible => 4::integer);
pg_set_relation_stats
-----------------------
- t
+
(1 row)
-- relallvisible default
@@ -62,7 +62,7 @@ SELECT
relallvisible => NULL::integer);
pg_set_relation_stats
-----------------------
- f
+
(1 row)
-- named arguments
@@ -74,7 +74,7 @@ SELECT
relallvisible => 4::integer);
pg_set_relation_stats
-----------------------
- f
+
(1 row)
SELECT relpages, reltuples, relallvisible
@@ -94,7 +94,7 @@ SELECT
5::integer);
pg_set_relation_stats
-----------------------
- t
+
(1 row)
SELECT relpages, reltuples, relallvisible
@@ -111,7 +111,7 @@ SELECT
'stats_import.test'::regclass);
pg_clear_relation_stats
-------------------------
- t
+
(1 row)
SELECT relpages, reltuples, relallvisible
@@ -158,7 +158,7 @@ SELECT
relpages => 2::integer);
pg_set_relation_stats
-----------------------
- t
+
(1 row)
-- nothing stops us from setting it to -1
@@ -168,7 +168,7 @@ SELECT
relpages => -1::integer);
pg_set_relation_stats
-----------------------
- t
+
(1 row)
DROP SCHEMA stats_import CASCADE;