Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure that quoted identifiers remain quoted in formatter #17406

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,7 @@ protected Void visitInsert(Insert node, Integer indent)
public Void visitSetSession(SetSession node, Integer context)
{
builder.append("SET SESSION ")
.append(node.getName())
.append(formatName(node.getName()))
.append(" = ")
.append(formatExpression(node.getValue(), parameters));

Expand All @@ -1256,7 +1256,7 @@ public Void visitSetSession(SetSession node, Integer context)
public Void visitResetSession(ResetSession node, Integer context)
{
builder.append("RESET SESSION ")
.append(node.getName());
.append(formatName(node.getName()));

return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,19 @@ public void testResetSession()
assertStatement("RESET SESSION foo", new ResetSession(QualifiedName.of("foo")));
}

@Test
public void testSessionIdentifiers()
{
assertStatement("SET SESSION \"foo-bar\".baz = 'x'",
new SetSession(QualifiedName.of("foo-bar", "baz"), new StringLiteral("x")));
assertInvalidStatement("SET SESSION foo-bar.name = 'value'",
"mismatched input '-'. Expecting: '.', '='");
assertStatement("RESET SESSION \"foo-bar\".baz",
new ResetSession(QualifiedName.of("foo-bar", "baz")));
assertInvalidStatement("RESET SESSION foo-bar.name",
"mismatched input '-'. Expecting: '.', <EOF>");
}

@Test
public void testShowSession()
{
Expand Down