pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Block ALTER INDEX/TABLE index_name ALTER COLUMN colname SET (opt 3+ messages / 1 participants [nested] [flat]
* pgsql: Block ALTER INDEX/TABLE index_name ALTER COLUMN colname SET (opt @ 2021-10-19 02:07 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 3+ messages in thread From: Michael Paquier @ 2021-10-19 02:07 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Block ALTER INDEX/TABLE index_name ALTER COLUMN colname SET (options) The grammar of this command run on indexes with column names has always been authorized by the parser, and it has never been documented. Since 911e702, it is possible to define opclass parameters as of CREATE INDEX, which actually broke the old case of ALTER INDEX/TABLE where relation-level parameters n_distinct and n_distinct_inherited could be defined for an index (see 76a47c0 and its thread where this point has been touched, still remained unused). Attempting to do that in v13~ would cause the index to become unusable, as there is a new dedicated code path to load opclass parameters instead of the relation-level ones previously available. Note that it is possible to fix things with a manual catalog update to bring the relation back online. This commit disables this command for now as the use of column names for indexes does not make sense anyway, particularly when it comes to index expressions where names are automatically computed. One way to properly support this case properly in the future would be to use column numbers when it comes to indexes, in the same way as ALTER INDEX .. ALTER COLUMN .. SET STATISTICS. Partitioned indexes were already blocked, but not indexes. Some tests are added for both cases. There was some code in ANALYZE to enforce n_distinct to be used for an index expression if the parameter was defined, but just remove it for now until/if there is support for this (note that index-level parameters never had support in pg_dump either, previously), so this was just dead code. Reported-by: Matthijs van der Vleuten Author: Nathan Bossart, Michael Paquier Reviewed-by: Vik Fearing, Dilip Kumar Discussion: https://postgr.es/m/17220-15d684c6c2171a83@postgresql.org Backpatch-through: 13 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/fdd88571454e2b00dbe446e8609c6e4294ca89ae Modified Files -------------- src/backend/commands/analyze.c | 11 ----------- src/backend/commands/tablecmds.c | 2 +- src/test/regress/expected/btree_index.out | 14 ++++++++++++++ src/test/regress/sql/btree_index.sql | 11 +++++++++++ 4 files changed, 26 insertions(+), 12 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Block ALTER INDEX/TABLE index_name ALTER COLUMN colname SET (opt @ 2021-10-19 02:07 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 3+ messages in thread From: Michael Paquier @ 2021-10-19 02:07 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Block ALTER INDEX/TABLE index_name ALTER COLUMN colname SET (options) The grammar of this command run on indexes with column names has always been authorized by the parser, and it has never been documented. Since 911e702, it is possible to define opclass parameters as of CREATE INDEX, which actually broke the old case of ALTER INDEX/TABLE where relation-level parameters n_distinct and n_distinct_inherited could be defined for an index (see 76a47c0 and its thread where this point has been touched, still remained unused). Attempting to do that in v13~ would cause the index to become unusable, as there is a new dedicated code path to load opclass parameters instead of the relation-level ones previously available. Note that it is possible to fix things with a manual catalog update to bring the relation back online. This commit disables this command for now as the use of column names for indexes does not make sense anyway, particularly when it comes to index expressions where names are automatically computed. One way to properly support this case properly in the future would be to use column numbers when it comes to indexes, in the same way as ALTER INDEX .. ALTER COLUMN .. SET STATISTICS. Partitioned indexes were already blocked, but not indexes. Some tests are added for both cases. There was some code in ANALYZE to enforce n_distinct to be used for an index expression if the parameter was defined, but just remove it for now until/if there is support for this (note that index-level parameters never had support in pg_dump either, previously), so this was just dead code. Reported-by: Matthijs van der Vleuten Author: Nathan Bossart, Michael Paquier Reviewed-by: Vik Fearing, Dilip Kumar Discussion: https://postgr.es/m/17220-15d684c6c2171a83@postgresql.org Backpatch-through: 13 Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b1b797ec71a1a8cc6bb500313f4373bcb5aac1ff Modified Files -------------- src/backend/commands/analyze.c | 11 ----------- src/backend/commands/tablecmds.c | 2 +- src/test/regress/expected/btree_index.out | 12 ++++++++++++ src/test/regress/sql/btree_index.sql | 11 +++++++++++ 4 files changed, 24 insertions(+), 12 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Block ALTER INDEX/TABLE index_name ALTER COLUMN colname SET (opt @ 2021-10-19 02:07 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 3+ messages in thread From: Michael Paquier @ 2021-10-19 02:07 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Block ALTER INDEX/TABLE index_name ALTER COLUMN colname SET (options) The grammar of this command run on indexes with column names has always been authorized by the parser, and it has never been documented. Since 911e702, it is possible to define opclass parameters as of CREATE INDEX, which actually broke the old case of ALTER INDEX/TABLE where relation-level parameters n_distinct and n_distinct_inherited could be defined for an index (see 76a47c0 and its thread where this point has been touched, still remained unused). Attempting to do that in v13~ would cause the index to become unusable, as there is a new dedicated code path to load opclass parameters instead of the relation-level ones previously available. Note that it is possible to fix things with a manual catalog update to bring the relation back online. This commit disables this command for now as the use of column names for indexes does not make sense anyway, particularly when it comes to index expressions where names are automatically computed. One way to properly support this case properly in the future would be to use column numbers when it comes to indexes, in the same way as ALTER INDEX .. ALTER COLUMN .. SET STATISTICS. Partitioned indexes were already blocked, but not indexes. Some tests are added for both cases. There was some code in ANALYZE to enforce n_distinct to be used for an index expression if the parameter was defined, but just remove it for now until/if there is support for this (note that index-level parameters never had support in pg_dump either, previously), so this was just dead code. Reported-by: Matthijs van der Vleuten Author: Nathan Bossart, Michael Paquier Reviewed-by: Vik Fearing, Dilip Kumar Discussion: https://postgr.es/m/17220-15d684c6c2171a83@postgresql.org Backpatch-through: 13 Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/85dc4292a7a1c0b9943cd285cbb3a90a5e368b3f Modified Files -------------- src/backend/commands/analyze.c | 11 ----------- src/backend/commands/tablecmds.c | 2 +- src/test/regress/expected/btree_index.out | 12 ++++++++++++ src/test/regress/sql/btree_index.sql | 11 +++++++++++ 4 files changed, 24 insertions(+), 12 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2021-10-19 02:07 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-10-19 02:07 pgsql: Block ALTER INDEX/TABLE index_name ALTER COLUMN colname SET (opt Michael Paquier <michael@paquier.xyz> 2021-10-19 02:07 pgsql: Block ALTER INDEX/TABLE index_name ALTER COLUMN colname SET (opt Michael Paquier <michael@paquier.xyz> 2021-10-19 02:07 pgsql: Block ALTER INDEX/TABLE index_name ALTER COLUMN colname SET (opt Michael Paquier <michael@paquier.xyz>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox