]> granicus.if.org Git - postgresql/commitdiff
pg_upgrade: avoid ALTER COLUMN TYPE on inherited columns
authorBruce Momjian <bruce@momjian.us>
Tue, 19 Nov 2013 20:00:49 +0000 (15:00 -0500)
committerBruce Momjian <bruce@momjian.us>
Tue, 19 Nov 2013 20:00:49 +0000 (15:00 -0500)
This only affects upgrades from 8.3 currently, and is harmless as the
child just generates an error in the script, but we should get it right
in case we ever need this for more complex uses.

Per report from Peter Eisentraut

contrib/pg_upgrade/version_old_8_3.c

index 84a47eec596305021e22562c937589b125d7cf46..e8438b6cb0b2e92963bd6b2f3043460dc4aaefe2 100644 (file)
@@ -325,6 +325,8 @@ old_8_3_rebuild_tsvector_tables(ClusterInfo *cluster, bool check_mode)
                                                                "WHERE  c.relkind = 'r' AND "
                                                                "               c.oid = a.attrelid AND "
                                                                "               NOT a.attisdropped AND "
+               /* child attribute changes are processed by the parent */
+                                                               "               a.attinhcount = 0 AND "
                                                                "               a.atttypid = 'pg_catalog.tsvector'::pg_catalog.regtype AND "
                                                                "               c.relnamespace = n.oid AND "
                /* exclude possible orphaned temp tables */
@@ -346,6 +348,8 @@ old_8_3_rebuild_tsvector_tables(ClusterInfo *cluster, bool check_mode)
                                                                "WHERE  c.relkind = 'r' AND "                   \
                                                                "               c.oid = a.attrelid AND "                \
                                                                "               NOT a.attisdropped AND "                \
+               /* child attribute changes are processed by the parent */               \
+                                                               "               a.attinhcount = 0 AND "                 \
                                                                "               a.atttypid = 'pg_catalog.tsvector'::pg_catalog.regtype AND " \
                                                                "               c.relnamespace = n.oid AND "    \
                                                                "       n.nspname !~ '^pg_' AND "               \