Support Spanner's UNION syntax, which needs to be UNION DISTINCT or UNION ALL. (#101768)

* Support Spanner's UNION syntax, which needs to be UNION DISTINCT or UNION ALL.
This commit is contained in:
Peter Štibraný
2025-03-10 12:33:52 +01:00
committed by GitHub
parent 607d39b573
commit fd6a4908f1
13 changed files with 46 additions and 23 deletions
+10
View File
@@ -32,6 +32,8 @@ type Dialect interface {
BooleanStr(bool) string
DateTimeFunc(string) string
BatchSize() int
UnionDistinct() string // this is the default UNION type
UnionAll() string
OrderBy(order string) string
@@ -467,3 +469,11 @@ func (b *BaseDialect) Update(ctx context.Context, tx *session.SessionTx, tableNa
func (b *BaseDialect) Concat(strs ...string) string {
return fmt.Sprintf("CONCAT(%s)", strings.Join(strs, ", "))
}
func (b *BaseDialect) UnionDistinct() string {
return "UNION"
}
func (b *BaseDialect) UnionAll() string {
return "UNION ALL"
}