Re: Possible Documentation Update for ALTER STATISTICS

From: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
To: Ahmet Gedemenli <agedemenli(at)microsoft(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Possible Documentation Update for ALTER STATISTICS
Date: 2021-11-04 22:07:47
Message-ID: 2463e3d4-3e00-56c8-8c2c-9493c776700e@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Ahmet,

On 11/4/21 14:35, Ahmet Gedemenli wrote:
> Hey,
>
> I've noticed that the current documentation doesn't mention IF EXISTS
> clause for ALTER STATISTICS in the synopsis section, where PG supports it.
> https://www.postgresql.org/docs/14/sql-alterstatistics.html
> <https://www.postgresql.org/docs/14/sql-alterstatistics.html>
> (Only for the last item, that is ALTER STATISTICS .. SET STATISTICS; for
> the others, PG just throws a syntax error.)
>
> I'm from the Citus team and noticed this while bug fixing, and I wonder
> if it is intentional or not. If it's intentionally supported while the
> other ALTER STATISTICS statement types are not supported, it would be
> good to mention that in the documentation.
>

Well, it's intentional in the sense that support for IF EXISTS in ALTER
commands is rather spotty. For OWNER TO it's not supported at all, and
for the other (RENAME & SET SCHEMA) it's supported only for some object
types. So we added the minimum grammar and never got around to add it.

So you're right we should update the docs for the SET STATISTICS case to
show it's supported in 14. I'll do that shortly.

For 15+ we could improve this to allow IF EXISTS in the other cases. For
RENAME and SET SCHEMA it's fairly easy (see attached fix), for OWNER TO
it's going to be more work because the AlterOwnerStmt does not have the
missing_ok flag.

regards

--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment Content-Type Size
alter-statistics-fix.patch text/x-patch 4.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2021-11-04 22:12:48 Re: inefficient loop in StandbyReleaseLockList()
Previous Message Jeff Davis 2021-11-04 21:25:54 Re: Predefined role pg_maintenance for VACUUM, ANALYZE, CHECKPOINT.