Fix nil pointer dereference in table.GetSQL

Add nil check for scope.Database before accessing dialect,
consistent with the pattern used in field.go and expression.go.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Qishuai Liu 2026-02-04 22:43:27 +09:00
parent 333f52e702
commit 6ea08e79aa
No known key found for this signature in database
1 changed files with 5 additions and 1 deletions

View File

@ -24,7 +24,11 @@ func (t table) GetName() string {
}
func (t table) GetSQL(scope scope) string {
return t.sqlDialects[scope.Database.dialect]
dialect := dialectUnknown
if scope.Database != nil {
dialect = scope.Database.dialect
}
return t.sqlDialects[dialect]
}
func (t table) getOperatorPriority() int {