Cannot drop index with nested property (dot) in Neo4j using bolt

58 views
Skip to first unread message

Davide D'Alto

unread,
May 21, 2018, 12:26:16 PM5/21/18
to Neo4j
Hi,
I was surprised to see the following error:


Neo.ClientError.Statement.SyntaxError: Invalid input '.': expected an identifier character, whitespace, ',' or ')' (line 1, column 38 (offset: 37)) "DROP INDEX ON :SingleBoardComputer(id.id)"

How is it that I can create the index but I cannot drop it? Is there a special syntax?

Thanks,
Davide

Michael Hunger

unread,
May 22, 2018, 3:39:38 AM5/22/18
to ne...@googlegroups.com
As that is not a valid identifier anymore you have to quote it with backticks, like `id.id` same goes for labels and rel-types.

Michael

--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Davide D'Alto

unread,
May 22, 2018, 4:10:27 AM5/22/18
to ne...@googlegroups.com
Thanks Michael,
that's the right solution:
https://stackoverflow.com/questions/50453953/drop-index-with-on-nested-property-with-a-dot-in-neo4j?noredirect=1#comment87924847_50453953

By the way, related to this, I have another issue.
When I get all the constraints in the schema calling `CALL
db.constraints()` I'm surprised that it returns only a column
description with queries like this:

CONSTRAINT ON ( per#son:Per#Son ) ASSERT per#son.nickname IS UNIQUE

Note that that's not an error, I've actually created a label `Per#son`
(I added a special char in it).
The problem here is that the query returned by `db.constraints()` does
not escape special chars and therefore if I want to drop the
constraint I cannot simply add the DROP at the beginning.
I think the same happens for db.indexes() but because there are
additional columns I can create the right query myself.

I think the description field should keep track of part of the query
requiring escaping.
Am I missing something here?

Thanks



On Tue, May 22, 2018 at 9:39 AM, 'Michael Hunger' via Neo4j
<ne...@googlegroups.com> wrote:
> As that is not a valid identifier anymore you have to quote it with
> backticks, like `id.id` same goes for labels and rel-types.
>
> Michael
>
> On Mon, May 21, 2018 at 6:26 PM, Davide D'Alto <dalto...@gmail.com>
> wrote:
>>
>> Hi,
>> I was surprised to see the following error:
>>
>>
>> Neo.ClientError.Statement.SyntaxError: Invalid input '.': expected an
>> identifier character, whitespace, ',' or ')' (line 1, column 38 (offset:
>> 37)) "DROP INDEX ON :SingleBoardComputer(id.id)"
>>
>> How is it that I can create the index but I cannot drop it? Is there a
>> special syntax?
>>
>> Thanks,
>> Davide
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Neo4j" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to neo4j+un...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Neo4j" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/neo4j/vPSZXNqmmOc/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> neo4j+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages