postgres.git / summary / log / commit / refs
commit 25251bb27fad53075b94556dabc486fc8de84ba4
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: Thu Aug 20 08:45:51 2026 +0000
First released in: 15.20, 16.16, 17.12, 18.7, 19.0
Skip bogus find_composite_type_dependencies() call on sequences
A sequence has no rowtype. We called
find_composite_type_dependencies() with InvalidOid, which is harmless
but pointless. Skip it.
This started to happen with commit 344d62fb9a97 in v15, which added
the ALTER SEQUENCE ... SET LOGGED/UNLOGGED subcommand. Before that,
sequences were never rewritten. While this is harmless, backpatch to
keep the code the same on all branches, to make backpatching future
patches a little easier.
Backpatch-through: 15
src/backend/commands/tablecmds.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d042d90acd3..d4bc38b66e8 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -5735,7 +5735,7 @@ ATRewriteTables(AlterTableStmt *parsetree, List **wqueue, LOCKMODE lockmode,
* constraints, so it's not necessary/appropriate to enforce them just
* during ALTER.)
*/
- if (tab->newvals != NIL || tab->rewrite > 0)
+ if (tab->newvals != NIL || (tab->rewrite > 0 && tab->relkind != RELKIND_SEQUENCE))
{
Relation rel;
@@ -6752,6 +6752,8 @@ find_composite_type_dependencies(Oid typeOid, Relation origRelation,
SysScanDesc depScan;
HeapTuple depTup;
+ Assert(OidIsValid(typeOid));
+
/* since this function recurses, it could be driven to stack overflow */
check_stack_depth();
[parent: 259ca794c983]