pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Check for tables with sql_identifier during pg_upgrade 2+ messages / 1 participants [nested] [flat]
* pgsql: Check for tables with sql_identifier during pg_upgrade @ 2019-10-14 21:40 Tomas Vondra <tomas.vondra@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Tomas Vondra @ 2019-10-14 21:40 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 ------ master Details ------- https://git.postgresql.org/pg/commitdiff/0ccfc2822366f92c61cba96541d1c64d2b8b2086 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(+) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Check for tables with sql_identifier during pg_upgrade @ 2019-10-14 21:53 Tomas Vondra <tomas.vondra@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Tomas Vondra @ 2019-10-14 21:53 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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(+) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2019-10-14 21:53 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2019-10-14 21:40 pgsql: Check for tables with sql_identifier during pg_upgrade Tomas Vondra <tomas.vondra@postgresql.org> 2019-10-14 21:53 pgsql: Check for tables with sql_identifier during pg_upgrade Tomas Vondra <tomas.vondra@postgresql.org>
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