mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-05 02:59:44 -06:00
Disabling FK ref action SET DEFAULT error so that Doltgres can support SET DEFAULT. Dolt/GMS will still validate this in an analyzer rule to preserve MySQL compatibility.
This commit is contained in:
@@ -83,6 +83,7 @@ const (
|
||||
ForeignKeyReferentialAction_NoAction
|
||||
ForeignKeyReferentialAction_Restrict
|
||||
ForeignKeyReferentialAction_SetNull
|
||||
ForeignKeyReferentialAction_SetDefault
|
||||
)
|
||||
|
||||
// ForeignKey is the complete, internal representation of a Foreign Key.
|
||||
@@ -771,6 +772,8 @@ func (refOp ForeignKeyReferentialAction) String() string {
|
||||
return "RESTRICT"
|
||||
case ForeignKeyReferentialAction_SetNull:
|
||||
return "SET NULL"
|
||||
case ForeignKeyReferentialAction_SetDefault:
|
||||
return "SET DEFAULT"
|
||||
default:
|
||||
return "INVALID"
|
||||
}
|
||||
@@ -786,6 +789,8 @@ func (refOp ForeignKeyReferentialAction) ReducedString() string {
|
||||
return "CASCADE"
|
||||
case ForeignKeyReferentialAction_SetNull:
|
||||
return "SET NULL"
|
||||
case ForeignKeyReferentialAction_SetDefault:
|
||||
return "SET DEFAULT"
|
||||
default:
|
||||
return "INVALID"
|
||||
}
|
||||
|
||||
@@ -2998,6 +2998,8 @@ func toReferentialAction(opt doltdb.ForeignKeyReferentialAction) sql.ForeignKeyR
|
||||
return sql.ForeignKeyReferentialAction_Restrict
|
||||
case doltdb.ForeignKeyReferentialAction_SetNull:
|
||||
return sql.ForeignKeyReferentialAction_SetNull
|
||||
case doltdb.ForeignKeyReferentialAction_SetDefault:
|
||||
return sql.ForeignKeyReferentialAction_SetDefault
|
||||
default:
|
||||
panic(fmt.Sprintf("Unhandled foreign key referential action %v", opt))
|
||||
}
|
||||
@@ -3016,7 +3018,7 @@ func ParseFkReferentialAction(refOp sql.ForeignKeyReferentialAction) (doltdb.For
|
||||
case sql.ForeignKeyReferentialAction_SetNull:
|
||||
return doltdb.ForeignKeyReferentialAction_SetNull, nil
|
||||
case sql.ForeignKeyReferentialAction_SetDefault:
|
||||
return doltdb.ForeignKeyReferentialAction_DefaultAction, sql.ErrForeignKeySetDefault.New()
|
||||
return doltdb.ForeignKeyReferentialAction_SetDefault, nil
|
||||
default:
|
||||
return doltdb.ForeignKeyReferentialAction_DefaultAction, fmt.Errorf("unknown foreign key referential action: %v", refOp)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user