Skip to content

Commit 9963ba7

Browse files
craig[bot]spilchen
andcommitted
Merge #147834
147834: workload/schemachanger: detect trigger-based self-dependencies in tableHasDependencies r=spilchen a=spilchen Previously, tableHasDependencies excluded all self-dependencies under the assumption that they originated from foreign keys. However, triggers can also create self-references now (see #147018), and that should be counted as true dependencies since it will block things like a table rename. This change updates the query to exclude only self-dependencies where the dependedonby_type is 'fk', allowing ones from triggers to be detected correctly. Informs #147514 Epic: none Release note: none Co-authored-by: Matt Spilchen <[email protected]>
2 parents 805a7f2 + 15cfa34 commit 9963ba7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/workload/schemachange/error_screening.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func (og *operationGenerator) tableHasDependencies(
117117
ns.oid = c.relnamespace
118118
WHERE c.relname = $1 AND ns.nspname = $2
119119
)
120-
AND fd.descriptor_id != fd.dependedonby_id
120+
AND NOT (fd.descriptor_id = fd.dependedonby_id AND fd.dependedonby_type = 'fk')
121121
AND fd.dependedonby_type != 'sequence'
122122
%s
123123
)

0 commit comments

Comments
 (0)