Skip to content

Commit ac3c932

Browse files
committed
Bug fix: not quoting table names is load bearing
1 parent 28fdce5 commit ac3c932

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

sql/expression/get_field.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,16 @@ func (p *GetField) WithChildren(children ...sql.Expression) (sql.Expression, err
165165
}
166166

167167
func (p *GetField) String() string {
168-
if p.quoteName {
169-
if p.table == "" {
170-
return p.parser.QuoteIdentifier(p.name)
171-
}
172-
return p.parser.QuoteIdentifier(p.table) + "." + p.parser.QuoteIdentifier(p.name)
173-
}
174-
168+
// We never quote anything if the table identifier is present. Quoting the field name is a very narrow use case
169+
// used only for serializing column default values and related fields, in which case the table name will always be
170+
// stripped away. The output of this method is load-bearing in many places of analysis and execution.
175171
if p.table == "" {
172+
if p.quoteName {
173+
return p.parser.QuoteIdentifier(p.name)
174+
}
176175
return p.name
177176
}
177+
178178
return p.table + "." + p.name
179179
}
180180

0 commit comments

Comments
 (0)