Fix: quote relation labels in Cypher to handle reserved keywords#7
Merged
Merged
Conversation
AgensGraph rejects unquoted relation labels that collide with reserved Cypher/SQL keywords (e.g. REFERENCES, MATCH, CREATE). Double-quote all dynamic relation labels in Edge.to_cypher_create() so that any LLM-extracted relationship name is safe. Fixes outshift-open/ioc-cognition-fabric-node-svc#7 Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: sfph <selina@cisco.com>
27accce to
893c0a7
Compare
ssmails
approved these changes
May 1, 2026
Collaborator
ssmails
left a comment
There was a problem hiding this comment.
LGTM assuming it works with upsert/query
sfph
added a commit
that referenced
this pull request
May 1, 2026
Bump version for PyPI release including the fix for quoting Cypher relation labels that use reserved keywords (issue #7). Signed-off-by: sfph <selina@cisco.com> Co-authored-by: Cursor <cursoragent@cursor.com>
sfph
added a commit
to sfph/ioc-cognition-fabric-node-svc
that referenced
this pull request
May 1, 2026
Picks up the fix for quoting reserved Cypher keywords in relation labels (e.g. REFERENCES) that caused SyntaxError in AgensGraph. Ref: outshift-open/ioc-knowledge-memory#7 Signed-off-by: sfph <selina@cisco.com> Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: sfph <selina@cisco.com> Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Edge.to_cypher_create()so that reserved Cypher/SQL keywords (e.g.REFERENCES,MATCH,CREATE) don't cause syntax errors in AgensGraph.Fixes outshift-open/ioc-cognition-fabric-node-svc#7
Root Cause
Edge.to_cypher_create()interpolatedself.relationdirectly into the Cypher query:REFERENCESis a reserved keyword in AgensGraph/PostgreSQL, causing apsycopg2.errors.SyntaxError.Fix
Wrap the relation label in double-quotes (AgensGraph's identifier quoting mechanism):
Note: backtick quoting (Neo4j-style) is not supported by AgensGraph.
Test plan
REFERENCES,INITIATES_ENTRY_INTO)RELATES_TO,KNOWS)Made with Cursor