Thread: Possible Documentation Update for ALTER STATISTICS
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.
(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.
Best,
Ahmet
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