postgres.git / summary / log / commit / refs

commit    539e6a916eef09dc6b7c3abb603722af772b1386
Author:   Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date:     Thu Aug 20 08:45:51 2026 +0000

    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 e02529d08ee..3fd375feffc 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -5506,7 +5506,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; @@ -6524,6 +6524,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: f0098e2fc90f]