1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-22 21:53:06 +03:00

Make the name optional in CREATE STATISTICS.

This allows users to omit the statistics name in a CREATE STATISTICS
command, letting the system auto-generate a sensible, unique name,
putting the statistics object in the same schema as the table.

Simon Riggs, reviewed by Matthias van de Meent.

Discussion: https://postgr.es/m/CANbhV-FGD2d_C3zFTfT2aRfX_TaPSgOeKES58RLZx5XzQp5NhA@mail.gmail.com
This commit is contained in:
Dean Rasheed
2022-07-21 19:23:13 +01:00
parent fa6c230ef2
commit 624aa2a13b
5 changed files with 86 additions and 53 deletions

View File

@@ -155,10 +155,9 @@ CreateStatistics(CreateStatsStmt *stmt)
/*
* If the node has a name, split it up and determine creation namespace.
* If not (a possibility not considered by the grammar, but one which can
* occur via the "CREATE TABLE ... (LIKE)" command), then we put the
* object in the same namespace as the relation, and cons up a name for
* it.
* If not, put the object in the same namespace as the relation, and cons
* up a name for it. (This can happen either via "CREATE STATISTICS ..."
* or via "CREATE TABLE ... (LIKE)".)
*/
if (stmt->defnames)
namespaceId = QualifiedNameGetCreationNamespace(stmt->defnames,