Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit dbe6bd4

Browse files
committed
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
1 parent 774171c commit dbe6bd4

File tree

6 files changed

+20
-21
lines changed

6 files changed

+20
-21
lines changed

doc/src/sgml/func.sgml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30174,15 +30174,13 @@ DETAIL: Make sure pg_wal_replay_wait() isn't called within a transaction with a
3017430174
<optional>, <parameter>relpages</parameter> <type>integer</type></optional>
3017530175
<optional>, <parameter>reltuples</parameter> <type>real</type></optional>
3017630176
<optional>, <parameter>relallvisible</parameter> <type>integer</type></optional> )
30177-
<returnvalue>boolean</returnvalue>
30177+
<returnvalue>void</returnvalue>
3017830178
</para>
3017930179
<para>
3018030180
Updates relation-level statistics for the given relation to the
3018130181
specified values. The parameters correspond to columns in <link
3018230182
linkend="catalog-pg-class"><structname>pg_class</structname></link>. Unspecified
30183-
or <literal>NULL</literal> values leave the setting
30184-
unchanged. Returns <literal>true</literal> if a change was made;
30185-
<literal>false</literal> otherwise.
30183+
or <literal>NULL</literal> values leave the setting unchanged.
3018630184
</para>
3018730185
<para>
3018830186
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
3021230210
<primary>pg_clear_relation_stats</primary>
3021330211
</indexterm>
3021430212
<function>pg_clear_relation_stats</function> ( <parameter>relation</parameter> <type>regclass</type> )
30215-
<returnvalue>boolean</returnvalue>
30213+
<returnvalue>void</returnvalue>
3021630214
</para>
3021730215
<para>
3021830216
Clears table-level statistics for the given relation, as though the
30219-
table was newly created. Returns <literal>true</literal> if a change
30220-
was made; <literal>false</literal> otherwise.
30217+
table was newly created.
3022130218
</para>
3022230219
<para>
3022330220
The caller must have the <literal>MAINTAIN</literal> privilege on

src/backend/catalog/system_functions.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ CREATE OR REPLACE FUNCTION
644644
relpages integer DEFAULT NULL,
645645
reltuples real DEFAULT NULL,
646646
relallvisible integer DEFAULT NULL)
647-
RETURNS bool
647+
RETURNS void
648648
LANGUAGE INTERNAL
649649
CALLED ON NULL INPUT VOLATILE
650650
AS 'pg_set_relation_stats';

src/backend/statistics/relation_stats.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ relation_statistics_update(FunctionCallInfo fcinfo, int elevel)
188188
Datum
189189
pg_set_relation_stats(PG_FUNCTION_ARGS)
190190
{
191-
PG_RETURN_BOOL(relation_statistics_update(fcinfo, ERROR));
191+
relation_statistics_update(fcinfo, ERROR);
192+
PG_RETURN_VOID();
192193
}
193194

194195
/*
@@ -211,5 +212,6 @@ pg_clear_relation_stats(PG_FUNCTION_ARGS)
211212
newfcinfo->args[3].value = DEFAULT_RELALLVISIBLE;
212213
newfcinfo->args[3].isnull = false;
213214

214-
PG_RETURN_BOOL(relation_statistics_update(newfcinfo, ERROR));
215+
relation_statistics_update(newfcinfo, ERROR);
216+
PG_RETURN_VOID();
215217
}

src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@
5757
*/
5858

5959
/* yyyymmddN */
60-
#define CATALOG_VERSION_NO 202410141
60+
#define CATALOG_VERSION_NO 202410221
6161

6262
#endif

src/include/catalog/pg_proc.dat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12345,14 +12345,14 @@
1234512345
{ oid => '9944',
1234612346
descr => 'set statistics on relation',
1234712347
proname => 'pg_set_relation_stats', provolatile => 'v', proisstrict => 'f',
12348-
proparallel => 'u', prorettype => 'bool',
12348+
proparallel => 'u', prorettype => 'void',
1234912349
proargtypes => 'regclass int4 float4 int4',
1235012350
proargnames => '{relation,relpages,reltuples,relallvisible}',
1235112351
prosrc => 'pg_set_relation_stats' },
1235212352
{ oid => '9945',
1235312353
descr => 'clear statistics on relation',
1235412354
proname => 'pg_clear_relation_stats', provolatile => 'v', proisstrict => 'f',
12355-
proparallel => 'u', prorettype => 'bool',
12355+
proparallel => 'u', prorettype => 'void',
1235612356
proargtypes => 'regclass',
1235712357
proargnames => '{relation}',
1235812358
prosrc => 'pg_clear_relation_stats' },

src/test/regress/expected/stats_import.out

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ SELECT
3838
relallvisible => 4::integer);
3939
pg_set_relation_stats
4040
-----------------------
41-
t
41+
4242
(1 row)
4343

4444
-- reltuples default
@@ -50,7 +50,7 @@ SELECT
5050
relallvisible => 4::integer);
5151
pg_set_relation_stats
5252
-----------------------
53-
t
53+
5454
(1 row)
5555

5656
-- relallvisible default
@@ -62,7 +62,7 @@ SELECT
6262
relallvisible => NULL::integer);
6363
pg_set_relation_stats
6464
-----------------------
65-
f
65+
6666
(1 row)
6767

6868
-- named arguments
@@ -74,7 +74,7 @@ SELECT
7474
relallvisible => 4::integer);
7575
pg_set_relation_stats
7676
-----------------------
77-
f
77+
7878
(1 row)
7979

8080
SELECT relpages, reltuples, relallvisible
@@ -94,7 +94,7 @@ SELECT
9494
5::integer);
9595
pg_set_relation_stats
9696
-----------------------
97-
t
97+
9898
(1 row)
9999

100100
SELECT relpages, reltuples, relallvisible
@@ -111,7 +111,7 @@ SELECT
111111
'stats_import.test'::regclass);
112112
pg_clear_relation_stats
113113
-------------------------
114-
t
114+
115115
(1 row)
116116

117117
SELECT relpages, reltuples, relallvisible
@@ -158,7 +158,7 @@ SELECT
158158
relpages => 2::integer);
159159
pg_set_relation_stats
160160
-----------------------
161-
t
161+
162162
(1 row)
163163

164164
-- nothing stops us from setting it to -1
@@ -168,7 +168,7 @@ SELECT
168168
relpages => -1::integer);
169169
pg_set_relation_stats
170170
-----------------------
171-
t
171+
172172
(1 row)
173173

174174
DROP SCHEMA stats_import CASCADE;

0 commit comments

Comments
 (0)