pgsql: Check for tables with sql_identifier during pg_upgrade
От | Tomas Vondra |
---|---|
Тема | pgsql: Check for tables with sql_identifier during pg_upgrade |
Дата | |
Msg-id | E1iK8H7-00046x-72@gemulon.postgresql.org обсуждение исходный текст |
Список | pgsql-committers |
Check for tables with sql_identifier during pg_upgrade Commit 7c15cef86d changed sql_identifier data type to be based on name instead of varchar. Unfortunately, this breaks on-disk format for this data type. Luckily, that should be a very rare problem, as this data type is used only in information_schema views, so this only affects user objects (tables, materialized views and indexes). One way to end in such situation is to do CTAS with a query on those system views. There are two options to deal with this - we can either abort pg_upgrade if there are user objects with sql_identifier columns in pg_upgrade, or we could replace the sql_identifier type with varchar. Considering how rare the issue is expected to be, and the complexity of replacing the data type (e.g. in matviews), we've decided to go with the simple check. The query is somewhat complex - the sql_identifier data type may be used indirectly - through a domain, a composite type or both, possibly in multiple levels. Detecting this requires a recursive CTE. Backpatch to 12, where the sql_identifier definition changed. Reported-by: Hans Buschmann Author: Tomas Vondra Reviewed-by: Tom Lane Backpatch-to: 12 Discussion: https://postgr.es/m/16045-673e8fa6b5ace196%40postgresql.org Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/eaf900e842ab0c8a03f23a2eda6a872eb9fce1c7 Modified Files -------------- src/bin/pg_upgrade/check.c | 8 +++ src/bin/pg_upgrade/pg_upgrade.h | 2 + src/bin/pg_upgrade/version.c | 119 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+)
В списке pgsql-committers по дате отправления: