Output of h2.sh.txt, three runs. Builds: cassert, -O2. master 77bba5454f9 + v3 REL_19_STABLE dfffe8da630 + v3, and unpatched REL_18_STABLE 2ea5222db7c + v3's REL_18 version, and unpatched Paths of the temporary clusters are shown as . ================================================================ RUN: REL_18_STABLE unpatched creates and fixes; --check to master and 19 ================================================================ ### 0. builds OLD postgres (PostgreSQL) 18.7 FIX postgres (PostgreSQL) 18.7 TARGET postgres (PostgreSQL) 20devel TARGET2 postgres (PostgreSQL) 19rc2 ### 1. create the cases with the unpatched server case_a: partitions created: 1 case_b: partitions created: 1 case_c: partitions created: 1 case_d: partitions created: 1 case_e: partitions created: 2 case_f: partitions created: 2 ### 2. pg_upgrade --check before any fix $ pg_upgrade --check (postgres (PostgreSQL) 18.7 -> TARGET) Performing Consistency Checks ----------------------------- Checking cluster versions ok Checking database connection settings ok Checking for unsupported encodings ok Checking names of databases, roles, and tablespaces ok Checking database user is the install user ok Checking for prepared transactions ok Checking oldestXID and oldestMultiXid consistency ok Checking for contrib/isn with bigint-passing mismatch ok Checking logical replication slots ok Checking subscription state ok Checking data type usage ok Checking for objects affected by Unicode update ok Checking for not-null constraint inconsistencies ok Checking for virtual generated column inconsistencies fatal Your installation contains partitions whose virtual generated columns have a different generation expression than the partitioned table. This is no longer allowed, so the upgrade would fail. You can fix this by running ALTER TABLE parent ALTER COLUMN column SET EXPRESSION AS (...); on the partitioned table of each column. In version 18 this is not allowed on a table with CHECK constraints, so drop them first and add them back afterwards. A list of the problem columns is in the file: /new/pg_upgrade_output.d/20261113T214002.753/partition_virtual_generated_columns.txt Failure, exiting contents of partition_virtual_generated_columns.txt: In database: case_a public.ta1.v In database: case_b public.tb1.v In database: case_c public.tc1.v In database: case_d public.td1.v In database: case_e public.te1a.v In database: case_f public.tf1.v $ pg_upgrade --check (postgres (PostgreSQL) 18.7 -> TARGET2) Performing Consistency Checks ----------------------------- Checking cluster versions ok Checking database connection settings ok Checking for unsupported encodings ok Checking names of databases, roles, and tablespaces ok Checking database user is the install user ok Checking for prepared transactions ok Checking oldestXID and oldestMultiXid consistency ok Checking for contrib/isn with bigint-passing mismatch ok Checking logical replication slots ok Checking subscription state ok Checking data type usage ok Checking for objects affected by Unicode update ok Checking for not-null constraint inconsistencies ok Checking for virtual generated column inconsistencies fatal Your installation contains partitions whose virtual generated columns have a different generation expression than the partitioned table. This is no longer allowed, so the upgrade would fail. You can fix this by running ALTER TABLE parent ALTER COLUMN column SET EXPRESSION AS (...); on the partitioned table of each column. In version 18 this is not allowed on a table with CHECK constraints, so drop them first and add them back afterwards. A list of the problem columns is in the file: /new/pg_upgrade_output.d/20261113T214004.531/partition_virtual_generated_columns.txt Failure, exiting contents of partition_virtual_generated_columns.txt: In database: case_a public.ta1.v In database: case_b public.tb1.v In database: case_c public.tc1.v In database: case_d public.td1.v In database: case_e public.te1a.v In database: case_f public.tf1.v ### 3. follow the message on postgres (PostgreSQL) 18.7 [case_a] file lists public.ta1.v; its partitioned table is ta, expression (x * 2) begin BEGIN alter table ta drop constraint ta_x_check ALTER TABLE alter table ta alter column v set expression as ((x * 2)) ALTER TABLE alter table ta add constraint ta_x_check CHECK ((x > 0)) ALTER TABLE commit COMMIT [case_b] file lists public.tb1.v; its partitioned table is tb, expression (- x) begin BEGIN alter table tb drop constraint tb_v_check ALTER TABLE alter table tb alter column v set expression as ((- x)) ALTER TABLE alter table tb add constraint tb_v_check CHECK ((v > 0)) ERROR: check constraint "tb_v_check" of relation "tb1" is violated by some row commit ROLLBACK [case_c] file lists public.tc1.v; its partitioned table is tc, expression (x * 2) begin BEGIN alter table tc alter column v set expression as ((x * 2)) ERROR: ALTER TABLE / SET EXPRESSION is not supported for virtual generated columns in tables with check constraints DETAIL: Column "v" of relation "tc1" is a virtual generated column. commit ROLLBACK [case_d] file lists public.td1.v; its partitioned table is td, expression NULLIF(x, 0) begin BEGIN alter table td alter column v set expression as (NULLIF(x, 0)) ERROR: column "v" of relation "td1" contains null values commit ROLLBACK [case_e] file lists public.te1a.v; its partitioned table is te1, expression (x * 2) begin BEGIN alter table te1 alter column v set expression as ((x * 2)) ALTER TABLE commit COMMIT [case_f] file lists public.tf1.v; its partitioned table is tf, expression (x * 2) begin BEGIN alter table tf alter column v set expression as ((x * 2)) ALTER TABLE commit COMMIT ### 4. pg_upgrade --check after following the message $ pg_upgrade --check (postgres (PostgreSQL) 18.7 -> TARGET) Performing Consistency Checks ----------------------------- Checking cluster versions ok Checking database connection settings ok Checking for unsupported encodings ok Checking names of databases, roles, and tablespaces ok Checking database user is the install user ok Checking for prepared transactions ok Checking oldestXID and oldestMultiXid consistency ok Checking for contrib/isn with bigint-passing mismatch ok Checking logical replication slots ok Checking subscription state ok Checking data type usage ok Checking for objects affected by Unicode update ok Checking for not-null constraint inconsistencies ok Checking for virtual generated column inconsistencies fatal Your installation contains partitions whose virtual generated columns have a different generation expression than the partitioned table. This is no longer allowed, so the upgrade would fail. You can fix this by running ALTER TABLE parent ALTER COLUMN column SET EXPRESSION AS (...); on the partitioned table of each column. In version 18 this is not allowed on a table with CHECK constraints, so drop them first and add them back afterwards. A list of the problem columns is in the file: /new/pg_upgrade_output.d/20261113T214006.867/partition_virtual_generated_columns.txt Failure, exiting contents of partition_virtual_generated_columns.txt: In database: case_b public.tb1.v In database: case_c public.tc1.v In database: case_d public.td1.v $ pg_upgrade --check (postgres (PostgreSQL) 18.7 -> TARGET2) Performing Consistency Checks ----------------------------- Checking cluster versions ok Checking database connection settings ok Checking for unsupported encodings ok Checking names of databases, roles, and tablespaces ok Checking database user is the install user ok Checking for prepared transactions ok Checking oldestXID and oldestMultiXid consistency ok Checking for contrib/isn with bigint-passing mismatch ok Checking logical replication slots ok Checking subscription state ok Checking data type usage ok Checking for objects affected by Unicode update ok Checking for not-null constraint inconsistencies ok Checking for virtual generated column inconsistencies fatal Your installation contains partitions whose virtual generated columns have a different generation expression than the partitioned table. This is no longer allowed, so the upgrade would fail. You can fix this by running ALTER TABLE parent ALTER COLUMN column SET EXPRESSION AS (...); on the partitioned table of each column. In version 18 this is not allowed on a table with CHECK constraints, so drop them first and add them back afterwards. A list of the problem columns is in the file: /new/pg_upgrade_output.d/20261113T214008.918/partition_virtual_generated_columns.txt Failure, exiting contents of partition_virtual_generated_columns.txt: In database: case_b public.tb1.v In database: case_c public.tc1.v In database: case_d public.td1.v ### 5. what the message does not say: the remaining cases by hand [case_b] the rows do not meet the CHECK with the parent's expression select x, v as v_via_partition, -x as v_via_parent from tb1 x | v_via_partition | v_via_parent ---+-----------------+-------------- 5 | 5 | -5 (1 row) [case_c] drop the CHECK of the partition instead, then add it back begin BEGIN alter table tc1 drop constraint tc1_x_check ALTER TABLE alter table tc alter column v set expression as (x * 2) ALTER TABLE alter table tc1 add constraint tc1_x_check check (x > 0) ALTER TABLE commit COMMIT [case_e] SET EXPRESSION on the root instead of the listed partition's parent alter table te alter column v set expression as (x * 2) ALTER TABLE [case_d] the row is NULL with the parent's expression select x, v as v_via_partition, nullif(x, 0) as v_via_parent from td1 x | v_via_partition | v_via_parent ---+-----------------+-------------- 0 | 1 | (1 row) $ pg_upgrade --check (postgres (PostgreSQL) 18.7 -> TARGET) Performing Consistency Checks ----------------------------- Checking cluster versions ok Checking database connection settings ok Checking for unsupported encodings ok Checking names of databases, roles, and tablespaces ok Checking database user is the install user ok Checking for prepared transactions ok Checking oldestXID and oldestMultiXid consistency ok Checking for contrib/isn with bigint-passing mismatch ok Checking logical replication slots ok Checking subscription state ok Checking data type usage ok Checking for objects affected by Unicode update ok Checking for not-null constraint inconsistencies ok Checking for virtual generated column inconsistencies fatal Your installation contains partitions whose virtual generated columns have a different generation expression than the partitioned table. This is no longer allowed, so the upgrade would fail. You can fix this by running ALTER TABLE parent ALTER COLUMN column SET EXPRESSION AS (...); on the partitioned table of each column. In version 18 this is not allowed on a table with CHECK constraints, so drop them first and add them back afterwards. A list of the problem columns is in the file: /new/pg_upgrade_output.d/20261113T214013.021/partition_virtual_generated_columns.txt Failure, exiting contents of partition_virtual_generated_columns.txt: In database: case_b public.tb1.v In database: case_d public.td1.v ### 6. real pg_upgrade -> TARGET, without case_b and case_d pg_upgrade exit 0: Upgrade Complete each leaf: rows read through the root, rows read directly, its expression ta/ta1|1=2|1=2|(x * 2) tc/tc1|1=2|1=2|(x * 2) te/te1a|1=2|1=2|(x * 2) tf/tf1a|1=2|1=2|(x * 2) count(*) where v = 2 through each root, constraint_exclusion on / partition ta on|1 ta partition|1 tc on|1 tc partition|1 te on|1 te partition|1 tf on|1 tf partition|1 repro-ce-on.sql in a new database of the upgraded cluster Null display is "(null)". server_version ---------------- 20devel (1 row) CREATE TABLE psql:repro:15: ERROR: virtual generated column "v" of partition "p1" must have the same generation expression as the partitioned table psql:repro:16: ERROR: no partition of relation "p" found for row DETAIL: Partition key of the failing row contains (a) = (0). CREATE TABLE psql:repro:22: ERROR: virtual generated column "v" of partition "c1" must have the same generation expression as the partitioned table psql:repro:23: ERROR: no partition of relation "c" found for row DETAIL: Partition key of the failing row contains (a) = (5). a | v ---+--- (0 rows) SET p_null -------- 0 (1 row) c_neg ------- 0 (1 row) SET p_null -------- 0 (1 row) c_neg ------- 0 (1 row) QUERY PLAN -------------------------------- Aggregate -> Result Replaces: Scan on p One-Time Filter: false (4 rows) RESET ================================================================ RUN: REL_18_STABLE unpatched creates, the same data directory is fixed with the REL_18 patch; --check to master and 19 ================================================================ ### 0. builds OLD postgres (PostgreSQL) 18.7 FIX postgres (PostgreSQL) 18.7 TARGET postgres (PostgreSQL) 20devel TARGET2 postgres (PostgreSQL) 19rc2 ### 1. create the cases with the unpatched server case_a: partitions created: 1 case_b: partitions created: 1 case_c: partitions created: 1 case_d: partitions created: 1 case_e: partitions created: 2 case_f: partitions created: 2 ### 2. pg_upgrade --check before any fix $ pg_upgrade --check (postgres (PostgreSQL) 18.7 -> TARGET) Performing Consistency Checks ----------------------------- Checking cluster versions ok Checking database connection settings ok Checking for unsupported encodings ok Checking names of databases, roles, and tablespaces ok Checking database user is the install user ok Checking for prepared transactions ok Checking oldestXID and oldestMultiXid consistency ok Checking for contrib/isn with bigint-passing mismatch ok Checking logical replication slots ok Checking subscription state ok Checking data type usage ok Checking for objects affected by Unicode update ok Checking for not-null constraint inconsistencies ok Checking for virtual generated column inconsistencies fatal Your installation contains partitions whose virtual generated columns have a different generation expression than the partitioned table. This is no longer allowed, so the upgrade would fail. You can fix this by running ALTER TABLE parent ALTER COLUMN column SET EXPRESSION AS (...); on the partitioned table of each column. In version 18 this is not allowed on a table with CHECK constraints, so drop them first and add them back afterwards. A list of the problem columns is in the file: /new/pg_upgrade_output.d/20261113T214023.139/partition_virtual_generated_columns.txt Failure, exiting contents of partition_virtual_generated_columns.txt: In database: case_a public.ta1.v In database: case_b public.tb1.v In database: case_c public.tc1.v In database: case_d public.td1.v In database: case_e public.te1a.v In database: case_f public.tf1.v $ pg_upgrade --check (postgres (PostgreSQL) 18.7 -> TARGET2) Performing Consistency Checks ----------------------------- Checking cluster versions ok Checking database connection settings ok Checking for unsupported encodings ok Checking names of databases, roles, and tablespaces ok Checking database user is the install user ok Checking for prepared transactions ok Checking oldestXID and oldestMultiXid consistency ok Checking for contrib/isn with bigint-passing mismatch ok Checking logical replication slots ok Checking subscription state ok Checking data type usage ok Checking for objects affected by Unicode update ok Checking for not-null constraint inconsistencies ok Checking for virtual generated column inconsistencies fatal Your installation contains partitions whose virtual generated columns have a different generation expression than the partitioned table. This is no longer allowed, so the upgrade would fail. You can fix this by running ALTER TABLE parent ALTER COLUMN column SET EXPRESSION AS (...); on the partitioned table of each column. In version 18 this is not allowed on a table with CHECK constraints, so drop them first and add them back afterwards. A list of the problem columns is in the file: /new/pg_upgrade_output.d/20261113T214024.883/partition_virtual_generated_columns.txt Failure, exiting contents of partition_virtual_generated_columns.txt: In database: case_a public.ta1.v In database: case_b public.tb1.v In database: case_c public.tc1.v In database: case_d public.td1.v In database: case_e public.te1a.v In database: case_f public.tf1.v ### 3. follow the message on postgres (PostgreSQL) 18.7 [case_a] file lists public.ta1.v; its partitioned table is ta, expression (x * 2) begin BEGIN alter table ta drop constraint ta_x_check ALTER TABLE alter table ta alter column v set expression as ((x * 2)) ALTER TABLE alter table ta add constraint ta_x_check CHECK ((x > 0)) ALTER TABLE commit COMMIT [case_b] file lists public.tb1.v; its partitioned table is tb, expression (- x) begin BEGIN alter table tb drop constraint tb_v_check ALTER TABLE alter table tb alter column v set expression as ((- x)) ALTER TABLE alter table tb add constraint tb_v_check CHECK ((v > 0)) ERROR: check constraint "tb_v_check" of relation "tb1" is violated by some row commit ROLLBACK [case_c] file lists public.tc1.v; its partitioned table is tc, expression (x * 2) begin BEGIN alter table tc alter column v set expression as ((x * 2)) ERROR: ALTER TABLE / SET EXPRESSION is not supported for virtual generated columns in tables with check constraints DETAIL: Column "v" of relation "tc1" is a virtual generated column. commit ROLLBACK [case_d] file lists public.td1.v; its partitioned table is td, expression NULLIF(x, 0) begin BEGIN alter table td alter column v set expression as (NULLIF(x, 0)) ERROR: column "v" of relation "td1" contains null values commit ROLLBACK [case_e] file lists public.te1a.v; its partitioned table is te1, expression (x * 2) begin BEGIN alter table te1 alter column v set expression as ((x * 2)) ERROR: cannot alter generation expression of virtual generated column "v" of partition "te1" HINT: Alter the generation expression of the partitioned table instead. commit ROLLBACK [case_f] file lists public.tf1.v; its partitioned table is tf, expression (x * 2) begin BEGIN alter table tf alter column v set expression as ((x * 2)) ALTER TABLE commit COMMIT ### 4. pg_upgrade --check after following the message $ pg_upgrade --check (postgres (PostgreSQL) 18.7 -> TARGET) Performing Consistency Checks ----------------------------- Checking cluster versions ok Checking database connection settings ok Checking for unsupported encodings ok Checking names of databases, roles, and tablespaces ok Checking database user is the install user ok Checking for prepared transactions ok Checking oldestXID and oldestMultiXid consistency ok Checking for contrib/isn with bigint-passing mismatch ok Checking logical replication slots ok Checking subscription state ok Checking data type usage ok Checking for objects affected by Unicode update ok Checking for not-null constraint inconsistencies ok Checking for virtual generated column inconsistencies fatal Your installation contains partitions whose virtual generated columns have a different generation expression than the partitioned table. This is no longer allowed, so the upgrade would fail. You can fix this by running ALTER TABLE parent ALTER COLUMN column SET EXPRESSION AS (...); on the partitioned table of each column. In version 18 this is not allowed on a table with CHECK constraints, so drop them first and add them back afterwards. A list of the problem columns is in the file: /new/pg_upgrade_output.d/20261113T214026.674/partition_virtual_generated_columns.txt Failure, exiting contents of partition_virtual_generated_columns.txt: In database: case_b public.tb1.v In database: case_c public.tc1.v In database: case_d public.td1.v In database: case_e public.te1a.v $ pg_upgrade --check (postgres (PostgreSQL) 18.7 -> TARGET2) Performing Consistency Checks ----------------------------- Checking cluster versions ok Checking database connection settings ok Checking for unsupported encodings ok Checking names of databases, roles, and tablespaces ok Checking database user is the install user ok Checking for prepared transactions ok Checking oldestXID and oldestMultiXid consistency ok Checking for contrib/isn with bigint-passing mismatch ok Checking logical replication slots ok Checking subscription state ok Checking data type usage ok Checking for objects affected by Unicode update ok Checking for not-null constraint inconsistencies ok Checking for virtual generated column inconsistencies fatal Your installation contains partitions whose virtual generated columns have a different generation expression than the partitioned table. This is no longer allowed, so the upgrade would fail. You can fix this by running ALTER TABLE parent ALTER COLUMN column SET EXPRESSION AS (...); on the partitioned table of each column. In version 18 this is not allowed on a table with CHECK constraints, so drop them first and add them back afterwards. A list of the problem columns is in the file: /new/pg_upgrade_output.d/20261113T214028.369/partition_virtual_generated_columns.txt Failure, exiting contents of partition_virtual_generated_columns.txt: In database: case_b public.tb1.v In database: case_c public.tc1.v In database: case_d public.td1.v In database: case_e public.te1a.v ### 5. what the message does not say: the remaining cases by hand [case_b] the rows do not meet the CHECK with the parent's expression select x, v as v_via_partition, -x as v_via_parent from tb1 x | v_via_partition | v_via_parent ---+-----------------+-------------- 5 | 5 | -5 (1 row) [case_c] drop the CHECK of the partition instead, then add it back begin BEGIN alter table tc1 drop constraint tc1_x_check ALTER TABLE alter table tc alter column v set expression as (x * 2) ALTER TABLE alter table tc1 add constraint tc1_x_check check (x > 0) ALTER TABLE commit COMMIT [case_e] SET EXPRESSION on the root instead of the listed partition's parent alter table te alter column v set expression as (x * 2) ALTER TABLE [case_d] the row is NULL with the parent's expression select x, v as v_via_partition, nullif(x, 0) as v_via_parent from td1 x | v_via_partition | v_via_parent ---+-----------------+-------------- 0 | 1 | (1 row) $ pg_upgrade --check (postgres (PostgreSQL) 18.7 -> TARGET) Performing Consistency Checks ----------------------------- Checking cluster versions ok Checking database connection settings ok Checking for unsupported encodings ok Checking names of databases, roles, and tablespaces ok Checking database user is the install user ok Checking for prepared transactions ok Checking oldestXID and oldestMultiXid consistency ok Checking for contrib/isn with bigint-passing mismatch ok Checking logical replication slots ok Checking subscription state ok Checking data type usage ok Checking for objects affected by Unicode update ok Checking for not-null constraint inconsistencies ok Checking for virtual generated column inconsistencies fatal Your installation contains partitions whose virtual generated columns have a different generation expression than the partitioned table. This is no longer allowed, so the upgrade would fail. You can fix this by running ALTER TABLE parent ALTER COLUMN column SET EXPRESSION AS (...); on the partitioned table of each column. In version 18 this is not allowed on a table with CHECK constraints, so drop them first and add them back afterwards. A list of the problem columns is in the file: /new/pg_upgrade_output.d/20261113T214030.304/partition_virtual_generated_columns.txt Failure, exiting contents of partition_virtual_generated_columns.txt: In database: case_b public.tb1.v In database: case_d public.td1.v ### 6. real pg_upgrade -> TARGET, without case_b and case_d pg_upgrade exit 0: Upgrade Complete each leaf: rows read through the root, rows read directly, its expression ta/ta1|1=2|1=2|(x * 2) tc/tc1|1=2|1=2|(x * 2) te/te1a|1=2|1=2|(x * 2) tf/tf1a|1=2|1=2|(x * 2) count(*) where v = 2 through each root, constraint_exclusion on / partition ta on|1 ta partition|1 tc on|1 tc partition|1 te on|1 te partition|1 tf on|1 tf partition|1 repro-ce-on.sql in a new database of the upgraded cluster Null display is "(null)". server_version ---------------- 20devel (1 row) CREATE TABLE psql:repro:15: ERROR: virtual generated column "v" of partition "p1" must have the same generation expression as the partitioned table psql:repro:16: ERROR: no partition of relation "p" found for row DETAIL: Partition key of the failing row contains (a) = (0). CREATE TABLE psql:repro:22: ERROR: virtual generated column "v" of partition "c1" must have the same generation expression as the partitioned table psql:repro:23: ERROR: no partition of relation "c" found for row DETAIL: Partition key of the failing row contains (a) = (5). a | v ---+--- (0 rows) SET p_null -------- 0 (1 row) c_neg ------- 0 (1 row) SET p_null -------- 0 (1 row) c_neg ------- 0 (1 row) QUERY PLAN -------------------------------- Aggregate -> Result Replaces: Scan on p One-Time Filter: false (4 rows) RESET ================================================================ RUN: REL_19_STABLE unpatched creates and fixes; --check to master ================================================================ ### 0. builds OLD postgres (PostgreSQL) 19rc2 FIX postgres (PostgreSQL) 19rc2 TARGET postgres (PostgreSQL) 20devel ### 1. create the cases with the unpatched server case_a: partitions created: 1 case_b: partitions created: 1 case_c: partitions created: 1 case_d: partitions created: 1 case_e: partitions created: 2 case_f: partitions created: 2 ### 2. pg_upgrade --check before any fix $ pg_upgrade --check (postgres (PostgreSQL) 19rc2 -> TARGET) Performing Consistency Checks ----------------------------- Checking cluster versions ok Checking database connection settings ok Checking for unsupported encodings ok Checking database user is the install user ok Checking for prepared transactions ok Checking oldestXID and oldestMultiXid consistency ok Checking for contrib/isn with bigint-passing mismatch ok Checking logical replication slots ok Checking subscription state ok Checking data type usage ok Checking for objects affected by Unicode update ok Checking for virtual generated column inconsistencies fatal Your installation contains partitions whose virtual generated columns have a different generation expression than the partitioned table. This is no longer allowed, so the upgrade would fail. You can fix this by running ALTER TABLE parent ALTER COLUMN column SET EXPRESSION AS (...); on the partitioned table of each column. In version 18 this is not allowed on a table with CHECK constraints, so drop them first and add them back afterwards. A list of the problem columns is in the file: /new/pg_upgrade_output.d/20261113T214042.235/partition_virtual_generated_columns.txt Failure, exiting contents of partition_virtual_generated_columns.txt: In database: case_a public.ta1.v In database: case_b public.tb1.v In database: case_c public.tc1.v In database: case_d public.td1.v In database: case_e public.te1a.v In database: case_f public.tf1.v ### 3. follow the message on postgres (PostgreSQL) 19rc2 [case_a] file lists public.ta1.v; its partitioned table is ta, expression (x * 2) begin BEGIN alter table ta alter column v set expression as ((x * 2)) ALTER TABLE commit COMMIT [case_b] file lists public.tb1.v; its partitioned table is tb, expression (- x) begin BEGIN alter table tb alter column v set expression as ((- x)) ERROR: check constraint "tb_v_check" of relation "tb1" is violated by some row commit ROLLBACK [case_c] file lists public.tc1.v; its partitioned table is tc, expression (x * 2) begin BEGIN alter table tc alter column v set expression as ((x * 2)) ALTER TABLE commit COMMIT [case_d] file lists public.td1.v; its partitioned table is td, expression NULLIF(x, 0) begin BEGIN alter table td alter column v set expression as (NULLIF(x, 0)) ERROR: column "v" of relation "td1" contains null values commit ROLLBACK [case_e] file lists public.te1a.v; its partitioned table is te1, expression (x * 2) begin BEGIN alter table te1 alter column v set expression as ((x * 2)) ALTER TABLE commit COMMIT [case_f] file lists public.tf1.v; its partitioned table is tf, expression (x * 2) begin BEGIN alter table tf alter column v set expression as ((x * 2)) ALTER TABLE commit COMMIT ### 4. pg_upgrade --check after following the message $ pg_upgrade --check (postgres (PostgreSQL) 19rc2 -> TARGET) Performing Consistency Checks ----------------------------- Checking cluster versions ok Checking database connection settings ok Checking for unsupported encodings ok Checking database user is the install user ok Checking for prepared transactions ok Checking oldestXID and oldestMultiXid consistency ok Checking for contrib/isn with bigint-passing mismatch ok Checking logical replication slots ok Checking subscription state ok Checking data type usage ok Checking for objects affected by Unicode update ok Checking for virtual generated column inconsistencies fatal Your installation contains partitions whose virtual generated columns have a different generation expression than the partitioned table. This is no longer allowed, so the upgrade would fail. You can fix this by running ALTER TABLE parent ALTER COLUMN column SET EXPRESSION AS (...); on the partitioned table of each column. In version 18 this is not allowed on a table with CHECK constraints, so drop them first and add them back afterwards. A list of the problem columns is in the file: /new/pg_upgrade_output.d/20261113T214043.753/partition_virtual_generated_columns.txt Failure, exiting contents of partition_virtual_generated_columns.txt: In database: case_b public.tb1.v In database: case_d public.td1.v ### 5. what the message does not say: the remaining cases by hand [case_b] the rows do not meet the CHECK with the parent's expression select x, v as v_via_partition, -x as v_via_parent from tb1 x | v_via_partition | v_via_parent ---+-----------------+-------------- 5 | 5 | -5 (1 row) [case_e] SET EXPRESSION on the root instead of the listed partition's parent alter table te alter column v set expression as (x * 2) ALTER TABLE [case_d] the row is NULL with the parent's expression select x, v as v_via_partition, nullif(x, 0) as v_via_parent from td1 x | v_via_partition | v_via_parent ---+-----------------+-------------- 0 | 1 | (1 row) $ pg_upgrade --check (postgres (PostgreSQL) 19rc2 -> TARGET) Performing Consistency Checks ----------------------------- Checking cluster versions ok Checking database connection settings ok Checking for unsupported encodings ok Checking database user is the install user ok Checking for prepared transactions ok Checking oldestXID and oldestMultiXid consistency ok Checking for contrib/isn with bigint-passing mismatch ok Checking logical replication slots ok Checking subscription state ok Checking data type usage ok Checking for objects affected by Unicode update ok Checking for virtual generated column inconsistencies fatal Your installation contains partitions whose virtual generated columns have a different generation expression than the partitioned table. This is no longer allowed, so the upgrade would fail. You can fix this by running ALTER TABLE parent ALTER COLUMN column SET EXPRESSION AS (...); on the partitioned table of each column. In version 18 this is not allowed on a table with CHECK constraints, so drop them first and add them back afterwards. A list of the problem columns is in the file: /new/pg_upgrade_output.d/20261113T214045.632/partition_virtual_generated_columns.txt Failure, exiting contents of partition_virtual_generated_columns.txt: In database: case_b public.tb1.v In database: case_d public.td1.v ### 6. real pg_upgrade -> TARGET, without case_b and case_d pg_upgrade exit 0: Upgrade Complete each leaf: rows read through the root, rows read directly, its expression ta/ta1|1=2|1=2|(x * 2) tc/tc1|1=2|1=2|(x * 2) te/te1a|1=2|1=2|(x * 2) tf/tf1a|1=2|1=2|(x * 2) count(*) where v = 2 through each root, constraint_exclusion on / partition ta on|1 ta partition|1 tc on|1 tc partition|1 te on|1 te partition|1 tf on|1 tf partition|1 repro-ce-on.sql in a new database of the upgraded cluster Null display is "(null)". server_version ---------------- 20devel (1 row) CREATE TABLE psql:repro:15: ERROR: virtual generated column "v" of partition "p1" must have the same generation expression as the partitioned table psql:repro:16: ERROR: no partition of relation "p" found for row DETAIL: Partition key of the failing row contains (a) = (0). CREATE TABLE psql:repro:22: ERROR: virtual generated column "v" of partition "c1" must have the same generation expression as the partitioned table psql:repro:23: ERROR: no partition of relation "c" found for row DETAIL: Partition key of the failing row contains (a) = (5). a | v ---+--- (0 rows) SET p_null -------- 0 (1 row) c_neg ------- 0 (1 row) SET p_null -------- 0 (1 row) c_neg ------- 0 (1 row) QUERY PLAN -------------------------------- Aggregate -> Result Replaces: Scan on p One-Time Filter: false (4 rows) RESET