Skip to content

[wip] add cypher frontend#9

Draft
phall1 wants to merge 2 commits into
Evokoa:mainfrom
phall1:feat/cypher-frontend
Draft

[wip] add cypher frontend#9
phall1 wants to merge 2 commits into
Evokoa:mainfrom
phall1:feat/cypher-frontend

Conversation

@phall1
Copy link
Copy Markdown

@phall1 phall1 commented May 21, 2026

pgGraph today exposes graph queries as PostgreSQL SQL functions:

SELECT * FROM graph.traverse(
    'public.people'::regclass, 'alice',
    /*max_depth=*/ 2, /*edge_types=*/ ARRAY['KNOWS'],
    /*direction=*/ 'outgoing', ...
);

For complex queries (ex multi hop patterns with predicates), cypher (& GQL) more expressive.

Adding a new function & support for graph.cypher(text, jsonb) that:

  • accepts an openCypher v9 query string
  • parses it through the cyrs frontend, and
  • dispatches each plan operator to either pgGraph's existing in-memory engine (reads) or to SPI-issued DML against the registered source tables (writes).

This is a draft for visibilty (the markdowns will be stripped when pr is ready).

cyrs is still in development, but has a pretty robust test suite. Also open to contributions over there

Patrick Hall and others added 2 commits May 19, 2026 08:18
Bootstraps the Cypher frontend integration on a new feat/cypher-frontend
branch:

* docs/contributor_guide/cypher-frontend/000-080: complete spec set
  covering overview, architecture, catalog extensions, read+write
  operator mapping, expression/type bridge, diagnostics, milestones,
  and open questions (including dependencies on cyrs upstream).
* sql/cypher_catalog.sql: six new catalog tables wiring Cypher labels
  and rel-types onto registered pgGraph tables/edges, plus uniqueness
  and multi-label-set declarations.
* src/cypher_facade/: module skeleton with five new pg_extern
  registration functions (register_label, register_label_property,
  register_rel_type, register_unique, allow_label_set) and a
  cyrs_schema::SchemaProvider impl reading the catalog via SPI.
* Cargo.toml: cyrs-schema path dep against ../../cyrs (pin scheme to
  be revisited per docs/.../080-open-questions.md Q-UP-10).

Execution path (graph.cypher(text, jsonb)) lands in M1.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
cyrs 0.1.0 (crates.io; PRs #56/#58) resolved all 13 feat-request
asks. Reflect that on the cypher-frontend branch:

* schema_provider.rs: promote labels_compatible / label_unique_props /
  rel_type_unique_props from inherent stub methods to real
  cyrs_schema::SchemaProvider trait methods now that cyrs ships them,
  so cyrs-sema proves MERGE determinism and label-set compatibility
  upstream instead of at execution time.
* 080-open-questions.md: rewrite the Upstream section as a resolved
  table mapping each Q-UP item to its shipped API; no Q-UP item
  blocks pgGraph any longer. Internal Q-IN decisions unchanged.
* 070-milestones-and-tests.md: drop the "until cyrs ships" workarounds
  from M3 (multi-label CREATE), M4 (MERGE key extraction), and M5
  (ShortestPath operator).

Verified: cargo check --lib (rustc 1.95) passes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant