From 17cb339c5db51f4596702e7d6d467613bb98a82c Mon Sep 17 00:00:00 2001
From: "Chao Li (Evan)" <lic@highgo.com>
Date: Tue, 17 Mar 2026 08:35:14 +0800
Subject: [PATCH v9 1/2] test: add regression test for ALTER TABLE ... NO
 INHERIT on typed tables

Suggested-by: Michael Paquier <michael@paquier.xyz>
Author: Chao Li <lic@highgo.com>
Discussion: https://postgr.es/m/CAEoWx2kggo1N2kDH6OSfXHL_5gKg3DqQ0PdNuL4LH4XSTKJ3-g@mail.gmail.com
---
 src/test/regress/expected/typed_table.out | 4 +++-
 src/test/regress/sql/typed_table.sql      | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/test/regress/expected/typed_table.out b/src/test/regress/expected/typed_table.out
index 885f085e154..2badd8e1498 100644
--- a/src/test/regress/expected/typed_table.out
+++ b/src/test/regress/expected/typed_table.out
@@ -41,8 +41,10 @@ ERROR:  cannot alter column type of typed table
 LINE 1: ALTER TABLE persons ALTER COLUMN name TYPE varchar;
                                          ^
 CREATE TABLE stuff (id int);
-ALTER TABLE persons INHERIT stuff;
+ALTER TABLE persons INHERIT stuff; -- error
 ERROR:  cannot change inheritance of typed table
+ALTER TABLE persons NO INHERIT stuff; -- error
+ERROR:  relation "stuff" is not a parent of relation "persons"
 CREATE TABLE personsx OF person_type (myname WITH OPTIONS NOT NULL); -- error
 ERROR:  column "myname" does not exist
 CREATE TABLE persons2 OF person_type (
diff --git a/src/test/regress/sql/typed_table.sql b/src/test/regress/sql/typed_table.sql
index 57ce12782b0..d0ea968e71f 100644
--- a/src/test/regress/sql/typed_table.sql
+++ b/src/test/regress/sql/typed_table.sql
@@ -20,7 +20,8 @@ ALTER TABLE persons DROP COLUMN name;
 ALTER TABLE persons RENAME COLUMN id TO num;
 ALTER TABLE persons ALTER COLUMN name TYPE varchar;
 CREATE TABLE stuff (id int);
-ALTER TABLE persons INHERIT stuff;
+ALTER TABLE persons INHERIT stuff; -- error
+ALTER TABLE persons NO INHERIT stuff; -- error
 
 CREATE TABLE personsx OF person_type (myname WITH OPTIONS NOT NULL); -- error
 
-- 
2.50.1 (Apple Git-155)

