@@ -1179,6 +1179,7 @@ func newOptTable(
1179
1179
originColumns : fk .ForeignKeyDesc ().OriginColumnIDs ,
1180
1180
referencedTable : cat .StableID (fk .GetReferencedTableID ()),
1181
1181
referencedColumns : fk .ForeignKeyDesc ().ReferencedColumnIDs ,
1182
+ constraintID : fk .GetConstraintID (),
1182
1183
validity : fk .GetConstraintValidity (),
1183
1184
match : tree .CompositeKeyMatchMethodType [fk .Match ()],
1184
1185
deleteAction : tree .ForeignKeyReferenceActionType [fk .OnDelete ()],
@@ -1192,6 +1193,7 @@ func newOptTable(
1192
1193
originColumns : fk .ForeignKeyDesc ().OriginColumnIDs ,
1193
1194
referencedTable : ot .ID (),
1194
1195
referencedColumns : fk .ForeignKeyDesc ().ReferencedColumnIDs ,
1196
+ constraintID : fk .GetConstraintID (),
1195
1197
validity : fk .GetConstraintValidity (),
1196
1198
match : tree .CompositeKeyMatchMethodType [fk .Match ()],
1197
1199
deleteAction : tree .ForeignKeyReferenceActionType [fk .OnDelete ()],
@@ -1570,6 +1572,21 @@ func (ot *optTable) HomeRegionColName() (colName string, ok bool) {
1570
1572
return * regionalByRowConfig .As , true
1571
1573
}
1572
1574
1575
+ // RegionalByRowUsingConstraint is part of the cat.Table interface.
1576
+ func (ot * optTable ) RegionalByRowUsingConstraint () cat.ForeignKeyConstraint {
1577
+ if ! ot .desc .IsLocalityRegionalByRow () {
1578
+ return nil
1579
+ }
1580
+ if id := ot .desc .GetRegionalByRowUsingConstraint (); id != catid .ConstraintID (0 ) {
1581
+ for i := range ot .outboundFKs {
1582
+ if ot .outboundFKs [i ].constraintID == id {
1583
+ return & ot .outboundFKs [i ]
1584
+ }
1585
+ }
1586
+ }
1587
+ return nil
1588
+ }
1589
+
1573
1590
// GetDatabaseID is part of the cat.Table interface.
1574
1591
func (ot * optTable ) GetDatabaseID () descpb.ID {
1575
1592
return ot .desc .GetParentID ()
@@ -2283,6 +2300,7 @@ type optForeignKeyConstraint struct {
2283
2300
referencedTable cat.StableID
2284
2301
referencedColumns []descpb.ColumnID
2285
2302
2303
+ constraintID catid.ConstraintID
2286
2304
validity descpb.ConstraintValidity
2287
2305
match tree.CompositeKeyMatchMethod
2288
2306
deleteAction tree.ReferenceAction
@@ -2700,6 +2718,11 @@ func (ot *optVirtualTable) HomeRegionColName() (colName string, ok bool) {
2700
2718
return "" , false
2701
2719
}
2702
2720
2721
+ // RegionalByRowUsingConstraint is part of the cat.Table interface.
2722
+ func (ot * optVirtualTable ) RegionalByRowUsingConstraint () cat.ForeignKeyConstraint {
2723
+ return nil
2724
+ }
2725
+
2703
2726
// GetDatabaseID is part of the cat.Table interface.
2704
2727
func (ot * optVirtualTable ) GetDatabaseID () descpb.ID {
2705
2728
return 0
0 commit comments