CQLSH逃脱多行评论(Slash Asterisk)

发布于 2025-02-01 10:43:28 字数 827 浏览 4 评论 0原文

我正在使用CQLSH命令行实用程序来加载一些DDL。

我使用的实用程序的版本是:

[cqlsh 6.0.0 | Cassandra 4.0.0.47 | CQL spec 3.4.5 | Native protocol v5]

加载ddl.cql的命令:

cqlsh -u username -p password cassandra.example.com 65503 --ssl -f DDL.cql

我在CQL脚本中有一个打破语法的行。

INSERT into tablename (key,columnname1,columnname2) VALUES 
   ('keyName','value1','/value2/*/value3');

/*被解释为多行注释的开始。它曾经在旧版本的CQLSH上工作。

有没有办法逃脱此序列?

我们看到的错误看起来像这样:

SyntaxException: line 4:2 mismatched input 'Update' expecting ')' (...,'value1','/value2INSERT into tablename(INSERT into tablename (key,columnname1,columnname2)) VALUES ('[Update]-...)
SyntaxException: line 1:0 no viable alternative at input '(' ([(]...)

运行时相同的行为也是交互式模式。

I am using cqlsh command line utility to load some DDLs.

The version of utility I use is this:

[cqlsh 6.0.0 | Cassandra 4.0.0.47 | CQL spec 3.4.5 | Native protocol v5]

Command that loads DDL.cql:

cqlsh -u username -p password cassandra.example.com 65503 --ssl -f DDL.cql

I have a line in cql script that breaks the syntax.

INSERT into tablename (key,columnname1,columnname2) VALUES 
   ('keyName','value1','/value2/*/value3');

/* is interpreted as start of multi-line comment. It used to work on older versions of cqlsh.

Is there a way to escape this sequence?

The error we see looks like this:

SyntaxException: line 4:2 mismatched input 'Update' expecting ')' (...,'value1','/value2INSERT into tablename(INSERT into tablename (key,columnname1,columnname2)) VALUES ('[Update]-...)
SyntaxException: line 1:0 no viable alternative at input '(' ([(]...)

Same behavior while running is interactive mode too.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不弃不离 2025-02-08 10:43:29

我可以确认它曾经在Cassandra 3.11中使用(我尤其是测试了C* 3.11.13)。由于某种原因,它不适用于从4.0.0开始的任何版本的C* 4.0。

感谢您的记录 cassandra-17667 我们现在正在分手。我还没有弄清楚哪种变化损坏了,但希望我们很快就会修复它。干杯!

I can confirm that it used to work in Cassandra 3.11 (I tested C* 3.11.13 in particular). For some reason, it doesn't work for any versions of C* 4.0 beginning from 4.0.0.

Thanks for logging CASSANDRA-17667 which we're triaging now. I haven't figured out which change broke it but hopefully we'll get it fixed sometime soon. Cheers!

祁梦 2025-02-08 10:43:29

面临同样的问题,一个简单的解决方法对我们有所帮助。基本上,必须将多线评论终结器分为两个字符串并串联。

'*/':失败

'*' +'/':工作

Have faced the same issue and a simple workaround had helped us. Basically had to split the multi line comment terminator to two strings and concatenated it.

‘*/‘ : fails

‘*’ + ‘/‘ : works

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文