Change pg_*_relation_stats() functions to return type to void.
authorJeff Davis <[email protected]>
Tue, 22 Oct 2024 19:48:01 +0000 (12:48 -0700)
committerJeff Davis <[email protected]>
Tue, 22 Oct 2024 19:48:01 +0000 (12:48 -0700)
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

doc/src/sgml/func.sgml
src/backend/catalog/system_functions.sql
src/backend/statistics/relation_stats.c
src/include/catalog/catversion.h
src/include/catalog/pg_proc.dat
src/test/regress/expected/stats_import.out

index ad663c94d775992d66642f9e8f12e7cc622d7e6a..14dd035134a5e5467c7f5d738d1365e4d4847284 100644 (file)
@@ -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
index 92b6aefe7aaaddde7fe4bb7f4dea6adc08ef5b1d..b7e2906f116cfad7dc68429c41fbeb80e867e1fc 100644 (file)
@@ -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';
index 1a6d1640c30a65c91db956c7bd73d5a457170f18..b1eb8a9bbaff9fe113175492a38ac73a3e6c576a 100644 (file)
@@ -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();
 }
index 842c43c0b684b49fe0b40b83f480457033efaddb..227fb6fb4cda6ec6b5eb0fbb3655933fbb31f683 100644 (file)
@@ -57,6 +57,6 @@
  */
 
 /*                         yyyymmddN */
-#define CATALOG_VERSION_NO 202410141
+#define CATALOG_VERSION_NO 202410221
 
 #endif
index 7c0b74fe0551048ec52a875b642ef72dc0195ce1..b4430e7c77f53fa2265529b2f6b68f3b2e3b8769 100644 (file)
 { 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' },
index a4e3a0f3c48eda276ede9825f9ba664fb029a47d..b50af75bb9707d7efd501bee0e7ba01d65b35eb7 100644 (file)
@@ -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;