Skip to content

Commit ea0ac1a

Browse files
committed
fix incorrect sql string usage
1 parent a1ab181 commit ea0ac1a

File tree

2 files changed

+34
-6
lines changed

2 files changed

+34
-6
lines changed

patches/0002-fix-quote-names.sql

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
diff --git a/pkg/sql/sem/tree/type_name.go b/pkg/sql/sem/tree/type_name.go
2+
index 898009a..5d4423a 100644
3+
--- a/pkg/sql/sem/tree/type_name.go
4+
+++ b/pkg/sql/sem/tree/type_name.go
5+
@@ -56,8 +56,7 @@ func (t *TypeName) String() string {
6+
7+
// SQLString implements the ResolvableTypeReference interface.
8+
func (t *TypeName) SQLString() string {
9+
- // FmtBareIdentifiers prevents the TypeName string from being wrapped in quotations.
10+
- return AsStringWithFlags(t, FmtBareIdentifiers)
11+
+ return AsStringWithFlags(t, FmtSimple)
12+
}
13+
14+
// FQString renders the type name in full, not omitting the prefix
15+
@@ -250,14 +249,12 @@ func (node *ArrayTypeReference) Format(ctx *FmtCtx) {
16+
17+
// SQLString implements the ResolvableTypeReference interface.
18+
func (node *ArrayTypeReference) SQLString() string {
19+
- // FmtBareIdentifiers prevents the TypeName string from being wrapped in quotations.
20+
- return AsStringWithFlags(node, FmtBareIdentifiers)
21+
+ return AsStringWithFlags(node, FmtSimple)
22+
}
23+
24+
// SQLString implements the ResolvableTypeReference interface.
25+
func (name *UnresolvedObjectName) SQLString() string {
26+
- // FmtBareIdentifiers prevents the TypeName string from being wrapped in quotations.
27+
- return AsStringWithFlags(name, FmtBareIdentifiers)
28+
+ return AsStringWithFlags(name, FmtSimple)
29+
}
30+
31+
// IsReferenceSerialType returns whether the input reference is a known

pkg/sql/sem/tree/type_name.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ func (t *TypeName) String() string {
5656

5757
// SQLString implements the ResolvableTypeReference interface.
5858
func (t *TypeName) SQLString() string {
59-
// FmtBareIdentifiers prevents the TypeName string from being wrapped in quotations.
60-
return AsStringWithFlags(t, FmtBareIdentifiers)
59+
return AsStringWithFlags(t, FmtSimple)
6160
}
6261

6362
// FQString renders the type name in full, not omitting the prefix
@@ -250,14 +249,12 @@ func (node *ArrayTypeReference) Format(ctx *FmtCtx) {
250249

251250
// SQLString implements the ResolvableTypeReference interface.
252251
func (node *ArrayTypeReference) SQLString() string {
253-
// FmtBareIdentifiers prevents the TypeName string from being wrapped in quotations.
254-
return AsStringWithFlags(node, FmtBareIdentifiers)
252+
return AsStringWithFlags(node, FmtSimple)
255253
}
256254

257255
// SQLString implements the ResolvableTypeReference interface.
258256
func (name *UnresolvedObjectName) SQLString() string {
259-
// FmtBareIdentifiers prevents the TypeName string from being wrapped in quotations.
260-
return AsStringWithFlags(name, FmtBareIdentifiers)
257+
return AsStringWithFlags(name, FmtSimple)
261258
}
262259

263260
// IsReferenceSerialType returns whether the input reference is a known

0 commit comments

Comments
 (0)