无效的输入 F

huangapple go评论104阅读模式
英文:

Invalid input F

问题

我正在4.1版本中运行以下Cypher查询,但是我无法理解为什么它会产生错误消息“无效输入'F':预期空格、注释、IF或ON”对于查询CREATE CONSTRAINT n_tester FOR (n:Test) REQUIRE n.Tester IS UNIQUE

Cypher查询是否必须分行?我添加了一些\n,但仍然出错了 - 不过这可能是php的json_encode做了一些奇怪的事情。这个查询的格式有什么问题?

英文:

I am running the following Cypher query in 4.1 and cannot see for the life of me why it is producing the error Invalid input 'F': expected whitespace, comment, IF or ON for the query CREATE CONSTRAINT n_tester FOR (n:Test) REQUIRE n.Tester IS UNIQUE.

Do Cypher queries have to be line separated? I added a couple of \n and it still errored - however that could well be php's json_encode doing something odd. What is wrong with the format of this query?

答案1

得分: 1

版本之间的语法有所变化。对于4.3版本:

CREATE CONSTRAINT n_tester ON (n:Test) ASSERT n.Tester IS UNIQUE

对于4.1版本,文档甚至没有显示约束条件,所以可能在那个版本中不可用。

https://neo4j.com/docs/cypher-manual/4.3/constraints/syntax/

英文:

The syntax changes between versions. For 4.3:

CREATE CONSTRAINT n_tester ON (n:Test) ASSERT n.Tester IS UNIQUE

For 4.1, the documentation doesn't even show constraints, so maybe that's not even available for that version.

https://neo4j.com/docs/cypher-manual/4.3/constraints/syntax/

答案2

得分: 1

注意:Neo4j 4.1 已经在一段时间前达到了生命周期终点,请升级!

一般来说,你可以在这里找到旧版本的文档。

对于 4.1 版本,约束创建语法(根据你的示例进行了调整)如下所示:

CREATE CONSTRAINT n_tester ON (n:Test) ASSERT n.Tester IS UNIQUE
英文:

Note: Neo4j 4.1 has reached End Of Life a while ago, please upgrade!

Generally speaking, you can find documentation for older versions here.

For 4.1, the constraint creation syntax (adapted to your example) is as follows:

CREATE CONSTRAINT n_tester ON (n:Test) ASSERT n.Tester IS UNIQUE

huangapple
  • 本文由 发表于 2023年8月9日 05:08:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/76863206.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定