0001-Fix-ALTER-TABLE-DROP-EXPRESSION-for-inheritance-hier.patch
text/x-patch
Filename: 0001-Fix-ALTER-TABLE-DROP-EXPRESSION-for-inheritance-hier.patch
Type: text/x-patch
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch 0001
Subject: Fix ALTER TABLE DROP EXPRESSION for inheritance hierarchy
| File | + | − |
|---|---|---|
| src/backend/commands/tablecmds.c | 6 | 6 |
From b28086bee3c7d49b3703cf164813f8cbc20d6938 Mon Sep 17 00:00:00 2001
From: Lakshmi <bharatdbpg@gmail.com>
Date: Wed, 22 Oct 2025 17:15:55 +0530
Subject: [PATCH] Fix ALTER TABLE DROP EXPRESSION for inheritance hierarchy
---
src/backend/commands/tablecmds.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 5fd8b51312c..0f0c104e238 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -8732,12 +8732,12 @@ ATPrepDropExpression(Relation rel, AlterTableCmd *cmd, bool recurse, bool recurs
* tables, somewhat similar to how DROP COLUMN does it, so that the
* resulting state can be properly dumped and restored.
*/
- if (!recurse &&
- find_inheritance_children(RelationGetRelid(rel), lockmode))
- ereport(ERROR,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("ALTER TABLE / DROP EXPRESSION must be applied to child tables too")));
-
+ if (!recurse && !recursing &&
+ find_inheritance_children(RelationGetRelid(rel), lockmode))
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("ALTER TABLE / DROP EXPRESSION must be applied to child tables too"),
+ errhint("Do not specify the ONLY keyword.")));
/*
* Cannot drop generation expression from inherited columns.
*/
--
2.39.5