e7nd7r opened a new issue, #2323: URL: https://github.com/apache/age/issues/2323
## Context [Gnapsis](https://github.com/e7nd7r/gnapsis) is a code intelligence graph being developed to help AI assistants understand codebases through semantic relationships. It's built on top of Apache AGE (PostgreSQL + graph capabilities), and Cypher is used for all graph operations. During the migration from Neo4j to AGE, several openCypher standard features were found to be unsupported. This issue was created to document these findings in one place to help track compliance and potentially guide future contributions. ## Discovery Process All Cypher queries were systematically tested against AGE, and failures were cross-referenced against the official openCypher specification: - [openCypher9.pdf](https://s3.amazonaws.com/artifacts.opencypher.org/openCypher9.pdf) - [Grammar files](https://github.com/opencypher/openCypher/tree/master/grammar) - Accepted CIPs ## Incompatibilities Found | Feature | openCypher Reference | AGE Error | |---------|---------------------|-----------| | `MERGE ... ON CREATE SET` | [openCypher9.pdf](https://s3.amazonaws.com/artifacts.opencypher.org/openCypher9.pdf), [style-guide](https://github.com/opencypher/openCypher/blob/master/docs/style-guide.adoc) | `syntax error at or near "ON"` | | `MERGE ... ON MATCH SET` | Same as above | `syntax error at or near "ON"` | | `datetime()` function | [CIP2015-08-06-date-time](https://s3.amazonaws.com/artifacts.opencypher.org/website/ocig7/oCIG+7+-+2018-03-14+-+CIP+2015-08-06+Date+and+Time.pdf) | `function datetime does not exist` | | `EXISTS { subquery }` | [CIP2015-05-13-EXISTS](https://github.com/opencypher/openCypher/blob/master/cip/1.accepted/CIP2015-05-13-EXISTS.adoc) | `syntax error at or near "{"` | | `NOT (pattern)` in WHERE | [basic-grammar.xml:316](https://github.com/opencypher/openCypher/blob/master/grammar/basic-grammar.xml#L316), [L405](https://github.com/opencypher/openCypher/blob/master/grammar/basic-grammar.xml#L405) | `syntax error at or near ":"` | | `count()` on empty MATCH | [basic-grammar.xml:356](https://github.com/opencypher/openCypher/blob/master/grammar/basic-grammar.xml#L356) | No rows returned instead of `{count: 0}` | | `RETURN` after `DELETE` | [cypher.xml:149](https://github.com/opencypher/openCypher/blob/master/grammar/cypher.xml#L149), [L217](https://github.com/opencypher/openCypher/blob/master/grammar/cypher.xml#L217) | `syntax error at or near "count"` | ## Examples ### MERGE ON CREATE/MATCH SET (Related: Issue #1619) ```cypher -- Standard openCypher (not supported in AGE) MERGE (n:Person {name: 'Alice'}) ON CREATE SET n.created_at = timestamp() ON MATCH SET n.updated_at = timestamp() RETURN n; ``` ### EXISTS subquery ```cypher -- Standard openCypher (not supported in AGE) MATCH (e:Entity) WHERE EXISTS { MATCH (e)-[:BELONGS_TO*]->(e) } RETURN e; ``` ### NOT pattern predicate ```cypher -- Standard openCypher (not supported in AGE) MATCH (e:Entity) WHERE NOT (e)-[:BELONGS_TO]->(:Entity) RETURN e; ``` ### RETURN after DELETE ```cypher -- Standard openCypher (not supported in AGE) MATCH (e:Entity {id: $id}) DETACH DELETE e RETURN count(*) AS deleted; ``` ## Workarounds Workarounds for each issue have been documented here: [AGE_CYPHER_COMPATIBILITY.md](https://github.com/e7nd7r/gnapsis/blob/main/docs/AGE_CYPHER_COMPATIBILITY.md) For example: - `ON CREATE SET` → A check-then-create pattern can be used with separate MATCH and CREATE statements - `NOT (pattern)` → `OPTIONAL MATCH` combined with `IS NULL` check can be used - `count()` on empty → `rows.is_empty()` can be checked in application code ## Contribution Some analysis on the `ON CREATE SET` implementation has already been done: [NOTES_ON_CREATE_SET.md](https://github.com/e7nd7r/age/blob/main/NOTES_ON_CREATE_SET.md) PRs would be gladly contributed for any of these features if the team is interested. Which features would be considered highest priority for the project? AGE is a fantastic project - having graph capabilities in PostgreSQL is greatly appreciated! 🐘 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
