[
https://issues.apache.org/jira/browse/CASSANDRA-21548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18102076#comment-18102076
]
Stefan Miklosovic commented on CASSANDRA-21548:
-----------------------------------------------
This is still happening, that is, if you have more spaces between "DROP
KEYSPACE ks" than one.
{code}
cassandra@cqlsh> CREATE KEYSPACE ks WITH replication = {'class':
'SimpleStrategy', 'replication_factor': 1};
cassandra@cqlsh> use ks;
cassandra@cqlsh:ks> DROP KEYSPACE ks;
cassandra@cqlsh:ks>
{code}
Also this is not correct:
{code}
cassandra@cqlsh> CREATE KEYSPACE abc WITH replication =
{'class':'SimpleStrategy','replication_factor':1}; -- real name: abc
cassandra@cqlsh> CREATE KEYSPACE "ABC" WITH replication =
{'class':'SimpleStrategy','replication_factor':1}; -- real name: ABC
cassandra@cqlsh> DESCRIBE KEYSPACES ;
"ABC" system_auth system_metrics system_views
abc system_cluster_metadata system_schema system_virtual_schema
system system_distributed system_traces
cassandra@cqlsh> USE "ABC";
cassandra@cqlsh:ABC> DROP KEYSPACE abc;
cassandra@cqlsh>
{code}
When I have two keyspaces, "ABC" and abc, and I use "ABC" one, then when I drop
just abc then it will reset it, but it should not, because I never dropped
"ABC" (the upper case quoted one).
Prefer the existing CQL parser over string-splitting. cqlsh already parses
statements (ruleset.cql_parse, used by parse_for_update_meta). Extracting the
ksname binding would eliminate the whitespace/quote/comment fragility for free
and be consistent with the rest of the file.
I did everything here:
https://github.com/smiklosovic/cassandra/pull/new/CASSANDRA-21548
> cqlsh prompt does not reset to default after dropping the current keyspace
> --------------------------------------------------------------------------
>
> Key: CASSANDRA-21548
> URL: https://issues.apache.org/jira/browse/CASSANDRA-21548
> Project: Apache Cassandra
> Issue Type: Improvement
> Components: CQL/Interpreter
> Reporter: Arvind Kandpal
> Assignee: Arvind Kandpal
> Priority: Normal
> Fix For: 6.x, 7.x
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> When a user is currently inside a keyspace in cqlsh and drops that exact same
> keyspace, the cqlsh prompt does not reset to the default `cqlsh>` prompt.
> Instead, it remains stuck showing the dropped keyspace name.
> +Steps to reproduce:+
> 1. Start cqlsh
> 2. CREATE KEYSPACE test_ks WITH replication = \{'class': 'SimpleStrategy',
> 'replication_factor': 1};
> 3. USE test_ks;
> 4. DROP KEYSPACE test_ks;
> +Expected Behavior:+
> After dropping the keyspace, the prompt should automatically reset back to
> the default `cqlsh>`.
> +Actual Behavior:+
> The prompt remains stuck as `cqlsh:test_ks>`. If the user runs any table
> queries, it throws a "Keyspace does not exist" error.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]