Skip to content

Commit

Permalink
sql: alias SET client_encoding to SET NAMES
Browse files Browse the repository at this point in the history
`SET NAMES` is the standard SQL form to indicate which encoding the
client uses to specify identifiers/strings to the server.

This patch adds support for this syntax and aliases it to `SET
client_encoding`. `RESET NAMES` and `SHOW NAMES` are similarly
supported.
  • Loading branch information
knz committed Jun 3, 2017
1 parent b881e92 commit f330b2f
Show file tree
Hide file tree
Showing 5 changed files with 4,470 additions and 4,332 deletions.
11 changes: 11 additions & 0 deletions pkg/sql/parser/parse_test.go
Expand Up @@ -944,6 +944,17 @@ func TestParse2(t *testing.T) {
`RESTORE DATABASE foo FROM 'bar'`},

{`SHOW ALL CLUSTER SETTINGS`, `SHOW CLUSTER SETTING all`},

{`USE foo`, `SET database = 'foo'`},

{`SET NAMES foo`, `SET client_encoding = 'foo'`},
{`SET NAMES 'foo'`, `SET client_encoding = 'foo'`},
{`SET NAMES DEFAULT`, `RESET client_encoding`},
{`SET NAMES`, `RESET client_encoding`},

{`SHOW NAMES`, `SHOW client_encoding`},

{`RESET NAMES`, `RESET client_encoding`},
}
for _, d := range testData {
stmts, err := Parse(d.sql)
Expand Down

0 comments on commit f330b2f

Please sign in to comment.