From 650ab8aaf1957863ae14c80265e79f5d903b49fd Mon Sep 17 00:00:00 2001 From: Jeff Davis Date: Tue, 25 Mar 2025 11:16:06 -0700 Subject: Stats: use schemaname/relname instead of regclass. For import and export, use schemaname/relname rather than regclass. This is more natural during export, fits with the other arguments better, and it gives better control over error handling in case we need to downgrade more errors to warnings. Also, use text for the argument types for schemaname, relname, and attname so that casts to "name" are not required. Author: Corey Huinker Discussion: https://postgr.es/m/CADkLM=ceOSsx_=oe73QQ-BxUFR2Cwqum7-UP_fPe22DBY0NerA@mail.gmail.com --- doc/src/sgml/func.sgml | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 49694e81220..f8c1deb04ee 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -30364,14 +30364,15 @@ postgres=# SELECT '0/0'::pg_lsn + pd.segment_number * ps.setting::int + :offset mytable: SELECT pg_restore_relation_stats( - 'relation', 'mytable'::regclass, - 'relpages', 173::integer, - 'reltuples', 10000::real); + 'schemaname', 'myschema', + 'relname', 'mytable', + 'relpages', 173::integer, + 'reltuples', 10000::real); - The argument relation with a value of type - regclass is required, and specifies the table. Other + The arguments schemaname and + relname are required, and specify the table. Other arguments are the names and values of statistics corresponding to certain columns in pg_class. @@ -30408,7 +30409,7 @@ postgres=# SELECT '0/0'::pg_lsn + pd.segment_number * ps.setting::int + :offset pg_clear_relation_stats - pg_clear_relation_stats ( relation regclass ) + pg_clear_relation_stats ( schemaname text, relname text ) void @@ -30457,22 +30458,23 @@ postgres=# SELECT '0/0'::pg_lsn + pd.segment_number * ps.setting::int + :offset mytable: SELECT pg_restore_attribute_stats( - 'relation', 'mytable'::regclass, - 'attname', 'col1'::name, - 'inherited', false, - 'avg_width', 125::integer, - 'null_frac', 0.5::real); + 'schemaname', 'myschema', + 'relname', 'mytable', + 'attname', 'col1', + 'inherited', false, + 'avg_width', 125::integer, + 'null_frac', 0.5::real); - The required arguments are relation with a value - of type regclass, which specifies the table; either - attname with a value of type name or - attnum with a value of type smallint, - which specifies the column; and inherited, which - specifies whether the statistics include values from child tables. - Other arguments are the names and values of statistics corresponding - to columns in schemaname and + relname with a value of type text + which specify the table; either attname with a + value of type text or attnum with a + value of type smallint, which specifies the column; and + inherited, which specifies whether the statistics + include values from child tables. Other arguments are the names and + values of statistics corresponding to columns in pg_stats. @@ -30502,8 +30504,9 @@ postgres=# SELECT '0/0'::pg_lsn + pd.segment_number * ps.setting::int + :offset pg_clear_attribute_stats pg_clear_attribute_stats ( - relation regclass, - attname name, + schemaname text, + relname text, + attname text, inherited boolean ) void -- cgit v1.2.3