Re: pgsql: Improve handling of inherited GENERATED expressions. - Mailing list pgsql-committers

From Tom Lane
Subject Re: pgsql: Improve handling of inherited GENERATED expressions.
Date
Msg-id 1340662.1673556269@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgsql: Improve handling of inherited GENERATED expressions.  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pgsql: Improve handling of inherited GENERATED expressions.  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-committers
I wrote:
> Yeah.  I think best bet may be to drop the problematic table(s),
> as we've done for other de-supported DDL situations.  A quick
> experiment suggests that
> DROP TABLE gtest_normal_child;
> DROP TABLE gtest_normal_child2;
> should do it.

Some testing here confirms that the attached patch is enough to
un-break things for HEAD.  Since you mentioned you have some other
quasi-urgent BF fixes, maybe the thing to do is to roll up a release
now and then work on the bigger idea at leisure.

            regards, tom lane

diff -pudr client-code-REL_15.orig/PGBuild/Modules/TestUpgradeXversion.pm
client-code-REL_15/PGBuild/Modules/TestUpgradeXversion.pm
--- client-code-REL_15.orig/PGBuild/Modules/TestUpgradeXversion.pm    2022-12-31 09:15:03.000000000 -0500
+++ client-code-REL_15/PGBuild/Modules/TestUpgradeXversion.pm    2023-01-12 15:27:30.709009163 -0500
@@ -586,12 +586,17 @@ sub test_upgrade    ## no critic (Subrou
         }
     }

-    # can't upgrade aclitem in user tables from pre 16 to 16+
+    # stuff not supported from release 16
     if (   ($this_branch gt 'REL_15_STABLE' || $this_branch eq 'HEAD')
         && ($oversion le 'REL_15_STABLE' && $oversion ne 'HEAD'))
     {
-        my $prstmt = "alter table if exists public.tab_core_types
-                      drop column if exists aclitem";
+        # Can't upgrade aclitem in user tables from pre 16 to 16+.
+        # Also can't handle child tables with newly-generated columns.
+        my $prstmt = join(';',
+                          'alter table if exists public.tab_core_types
+                          drop column if exists aclitem',
+                          'drop table if exists public.gtest_normal_child',
+                          'drop table if exists public.gtest_normal_child2');

         run_psql("$other_branch/inst/bin/psql", "-e", $prstmt,
             "regression", "$upgrade_loc/$oversion-copy.log", 1);

pgsql-committers by date:

Previous
From: Alexander Korotkov
Date:
Subject: pgsql: Fix jsonpath existense checking of missing variables
Next
From: Andrew Dunstan
Date:
Subject: Re: pgsql: Improve handling of inherited GENERATED expressions.