BUG #19928: pg_upgrade fails on v18 schema with NOT NULL ... NO INHERIT and inheritance

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: exclusion(at)gmail(dot)com
Subject: BUG #19928: pg_upgrade fails on v18 schema with NOT NULL ... NO INHERIT and inheritance
Date: 2026-11-21 09:00:00
Message-ID: 19928-c3f1f0dc1c0a44e9@postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 19928
Logged by: Alexander Lakhin
Email address: exclusion(at)gmail(dot)com
PostgreSQL version: 19.0
Operating system: Ubuntu 24.04
Description:

A database with the following contents:
echo "CREATE DATABASE regression;
\connect regression
CREATE TABLE regress_notnull3 (a int, NOT NULL a NO INHERIT);
CREATE TABLE regress_notnull4 () INHERITS (regress_notnull3);

INSERT INTO regress_notnull4 VALUES (NULL);

-- Tables needed for the version-adaptation step
CREATE TABLE brintest (lsncol pg_lsn);
CREATE TABLE tab_core_types (pg_lsn pg_lsn);
CREATE TABLE brintest_multi (lsncol pg_lsn);
CREATE TABLE brintest_bloom (lsncol pg_lsn);
" > /tmp/db18.sql

can't be upgraded from v18 to v19, e.g. with:
olddump=/tmp/db18.sql oldinstall=/tmp/pg18 PROVE_TESTS="t/002*" make -s
check -C src/bin/pg_upgrade/

due to this error during the consistency check:
# Checking for not-null constraint inconsistencies fatal
#
# Your installation contains inconsistent NOT NULL constraints.
# If the parent column(s) are NOT NULL, then the child column must
# also be marked NOT NULL, or the upgrade will fail.
# You can fix this by running
# ALTER TABLE tablename ALTER column SET NOT NULL;
# on each column listed in the file:
#
.../src/bin/pg_upgrade/tmp_check/t_002_pg_upgrade_new_node_data/pgdata/pg_upgrade_output.d/20261121T024932.279/not_null_inconsistent_columns.txt
# Failure, exiting

cat
.../src/bin/pg_upgrade/tmp_check/t_002_pg_upgrade_new_node_data/pgdata/pg_upgrade_output.d/20261121T024932.279/not_null_inconsistent_columns.txt
In database: regression
public.regress_notnull4.a

Reproduced starting from f295494d3.

Browse pgsql-bugs by date

  From Date Subject
Next Message Zsolt Parragi 2026-11-21 09:22:38 Re: pg_rewind and hint bits leads to visibility corruption
Previous Message Laurenz Albe 2026-11-21 08:43:11 Re: BUG #19927: PostgreSQL 16: SQL dump adds experimental/incompatible options like \restrict