Closed ikehara closed 3 months ago
Thanks for the PR @ikehara! There's definitely a problem here but I have a different take on the root cause of the issue. I'm going to create a new issue which will include my analysis of what I think is going on here; once that's done we can discuss how to proceed.
Thanks again!
Thank you for the investigation.
While investigating this issue, I discovered another problem.
I would appreciate it if you could take a look at this one as well.
I'm +1 this solution.
So I didn't articulate this clearly enough but my original concern here was some variation of the following; there are actually two issues being addressed by this PR:
They're both legit bugs, but only one really relates to the problem at hand. My hope was to detangle those issues so that we could get a clear fix for each of them. After talking about it for a while it's become increasingly clear that this isn't essential, and I agree the approach here solves the problem as well.
This pull request fixes the issue where the
SetKeyspaceResult
in the response message of theUSE
statement does not reflect the actual keyspace name.Previously, when using the
USE
statement with a quoted name incqlsh
, the behavior was as follows:cqlsh
sendsUSE "ks"
SetKeyspaceResult "\"ks\""
is returnedcqlsh
sendsUSE ""ks""
The Cassandra session is composed of multiple connections, and when the
USE
statement succeeds on one connection, it updates the current keyspace for all other connections.I also found that the escape character of quoted name is different from the CQL grammar. It says "any character where " can appear if doubled."
Changes
This pull request includes the following changes:
Modify
identifer.go
to addID
methodID
to theidentifer.go
file to enhance identifier handling.Modify
lexer_test.go
to addTestLexerIdentifiers
testTestLexerIdentifiers
inlexer_test.go
to ensure the lexer correctly identifies and processes identifiers.Modify
proxy.go
to fixinterceptSystemQuery
methodinterceptSystemQuery
method inproxy.go
to ensureSetKeyspaceResult
uses a real keyspace name instead of quoted one.Fix quoted name of identifier