Skip to content

Commit

Permalink
sql: fix the pretty-printing of CREATE EXTENSION
Browse files Browse the repository at this point in the history
Release note: None
  • Loading branch information
knz committed Apr 21, 2023
1 parent 8124bff commit 7b06335
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions pkg/sql/parser/testdata/create_misc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ CREATE EXTENSION bob -- fully parenthesized
CREATE EXTENSION bob -- literals removed
CREATE EXTENSION bob -- identifiers removed

parse
CREATE EXTENSION "a-b"
----
CREATE EXTENSION "a-b"
CREATE EXTENSION "a-b" -- fully parenthesized
CREATE EXTENSION "a-b" -- literals removed
CREATE EXTENSION "a-b" -- identifiers removed

parse
CREATE EXTENSION IF NOT EXISTS bob
----
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/sem/tree/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -2147,7 +2147,7 @@ func (node *CreateExtension) Format(ctx *FmtCtx) {
// do not contain sensitive information and
// 2) we want to get telemetry on which extensions
// users attempt to load.
ctx.WriteString(node.Name)
lexbase.EncodeRestrictedSQLIdent(&ctx.Buffer, node.Name, ctx.flags.EncodeFlags())
}

// CreateExternalConnection represents a CREATE EXTERNAL CONNECTION statement.
Expand Down

0 comments on commit 7b06335

Please sign in to comment.