Skip to content

Conversation

mnd999
Copy link

@mnd999 mnd999 commented Jun 12, 2025

Error codes for graph types.

This work is likely to be feature flagged for some time, so we don't want to merge it to the public docs yet, but we do need to review the errors.

@mnd999 mnd999 added dev The default branch. DO NOT MERGE cypher-25 labels Jun 12, 2025
@mnd999 mnd999 marked this pull request as ready for review June 16, 2025 09:14
@mnd999 mnd999 force-pushed the graph-type-errors branch from 85e42a1 to d27c275 Compare June 16, 2025 09:15
Copy link
Contributor

@Hunterness Hunterness left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked at the implementation PR but I did have some thoughts on the error messages from just looking at them in isolation.

Status: 0 open comment in this group and 1 in the next

@mnd999 mnd999 force-pushed the graph-type-errors branch from 9eff486 to af24129 Compare July 2, 2025 14:14
----
ALTER CURRENT GRAPH TYPE SET {
(p:Person => {name :: STRING}),
CONSTRAINT FOR (p:Person =>) REQUIRE p.name IS NOT NULL,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want a second example where the node elem type and constraint have different properties (to show that it's not only a problem when the properties are the same)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to, if somebody is looking at this page, they already have the error.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe, but I just felt that since both the node and the relationship example had the same property it might be nice to also show some other cases that would fail

ALTER CURRENT GRAPH TYPE SET {
    (p:Person => {name :: STRING}),
    CONSTRAINT FOR (p:Person) REQUIRE p.ssn IS NOT NULL
}


Fix to:
ALTER CURRENT GRAPH TYPE SET {
    (p:Person => {name :: STRING, ssn:: ANY NOT NULL})
}

(this both have another property and doesn't say we expect the label to be identifying in the constraint syntax)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need any more examples, most of the error codes do not have any.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, cause they didn't have time to add any when doing the initial docs, they want there to be examples for all codes (I've been asked to add examples when I updated codes previously) so that's not really a metric to go after

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but if you don't want new/additional example then update the existing one instead: I just want some more variation in the examples and not have the very same case in both the node and relationship version (just switching which constraint type is where)

@mnd999 mnd999 force-pushed the graph-type-errors branch 2 times, most recently from 7d5bab3 to e25ea42 Compare July 17, 2025 07:57
Copy link
Contributor

@Hunterness Hunterness left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New round of comments

Status: only open comments are from the groups above

----
ALTER CURRENT GRAPH TYPE SET {
(p:Person => {name :: STRING}),
CONSTRAINT FOR (p:Person =>) REQUIRE p.name IS NOT NULL,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe, but I just felt that since both the node and the relationship example had the same property it might be nice to also show some other cases that would fail

ALTER CURRENT GRAPH TYPE SET {
    (p:Person => {name :: STRING}),
    CONSTRAINT FOR (p:Person) REQUIRE p.ssn IS NOT NULL
}


Fix to:
ALTER CURRENT GRAPH TYPE SET {
    (p:Person => {name :: STRING, ssn:: ANY NOT NULL})
}

(this both have another property and doesn't say we expect the label to be identifying in the constraint syntax)

Copy link
Collaborator

@renetapopova renetapopova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many editorial comments, some of which require fixing the description in the codebase. When these are addressed, I'll build it locally and read it again. I also need to regenerate the index file to add the new codes.

Copy link
Collaborator

@renetapopova renetapopova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. A few minor comments.

Copy link
Contributor

@Hunterness Hunterness left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed when double checking the messages and the impl updates

@renetapopova renetapopova self-requested a review July 25, 2025 11:34
@neo4j-docops-agent
Copy link
Collaborator

This PR includes documentation updates
View the updated docs at https://neo4j-docs-status-codes-341.surge.sh

New pages:

Updated pages:

Copy link
Contributor

@Hunterness Hunterness left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of new errors (and a brief look through the old)

Comment on lines +69 to +70
CONSTRAINT FOR () REQUIRE n.prop IS UNIQUE
----
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
CONSTRAINT FOR () REQUIRE n.prop IS UNIQUE
----
CONSTRAINT FOR () REQUIRE n.prop IS UNIQUE
}
----

Comment on lines +83 to +84
CONSTRAINT FOR (n:Node) REQUIRE n.prop IS UNIQUE
----
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
CONSTRAINT FOR (n:Node) REQUIRE n.prop IS UNIQUE
----
CONSTRAINT FOR (n:Node) REQUIRE n.prop IS UNIQUE
}
----


[source]
----
error: data exception - relationship element type already exists. A relationship element type identified by the relationship type `REL` already exists in the graph type."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
error: data exception - relationship element type already exists. A relationship element type identified by the relationship type `REL` already exists in the graph type."
error: data exception - relationship element type already exists. A relationship element type identified by the relationship type `REL` already exists in the graph type.


[source]
----
error: data exception - relationship element type specified incorrectly. The relationship element type identified by the relationship type `REL` is different to the one specified in the query.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be possible for this error (and the node one) to either show the diff or the full existing type 🤔 I got this error when missing the => on my end node which took a bit to figure out (and some call to show XD) and having the diff or type definition would maybe have helped figure it out faster 🤷

Comment on lines +13 to +14
(p:Person => {name :: STRING })
(p)-[:DRIVES]->(:Car)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(p:Person => {name :: STRING })
(p)-[:DRIVES]->(:Car)
(p:Person => {name :: STRING }),
(p)-[:DRIVES]->(:Car)

error: data exception - graph type constraint not supported. Graph type constraint definitions are not supported in the `{ <<graphTypeOperation>> }` operation.

== Explanation

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we want an explanation here?

[source,cypher]
----
ALTER CURRENT GRAPH TYPE ALTER {
CONSTRAINT c1 FOR (s:Student) REQUIRE s.studentId :: STRING
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since Gowri have (multiple times) stumbled on the inline key constraints it might be nice with an example of that as well

Given
ALTER CURRENT GRAPH TYPE SET {
    (:Label => :ToBeRemoved {prop :: STRING IS KEY})
}

Then:
ALTER CURRENT GRAPH TYPE ALTER {
    (:Label => {prop :: STRING IS KEY})
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that you have it for DROP, but I think Gowri have had more questions on it for ALTER 🤷

Comment on lines +44 to +45
}
ALTER CURRENT GRAPH TYPE ADD {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would we need some indication that these are two queries and not one containing two alter clauses? 🤔 (since this would fail parsing on the second ALTER I'd assume)

=== xref:errors/gql-errors/22NC9.adoc[22NC9]

Status description:: error: data exception - invalid element type constraints in graph type. A `{ <<entityType>>1 }` element type property `{ <<context>> }` constraint cannot be specified inline of a `{ <<entityType>>2 }` element type.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing 22NCA-F?

Comment on lines 634 to +635
Status description:: error: data exception - unsupported struct tag. Unsupported struct tag: 0x56. `{ <<value>> }`.
=== xref:errors/gql-errors/22NC1.adoc[22NC1]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Status description:: error: data exception - unsupported struct tag. Unsupported struct tag: 0x56. `{ <<value>> }`.
=== xref:errors/gql-errors/22NC1.adoc[22NC1]
Status description:: error: data exception - unsupported struct tag. Unsupported struct tag: 0x56. `{ <<value>> }`.
=== xref:errors/gql-errors/22NC1.adoc[22NC1]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants