Skip to content

duckdb catalog: auto-detect rel_* tables as relationship tables - #31

Open
adsharma wants to merge 3 commits into
mainfrom
duckdb_rel
Open

duckdb catalog: auto-detect rel_* tables as relationship tables#31
adsharma wants to merge 3 commits into
mainfrom
duckdb_rel

Conversation

@adsharma

Copy link
Copy Markdown
Contributor

When table name starts with rel_, query foreign keys from the db to determine src/dst node tables and create a RelGroupCatalogEntry instead of a NodeTableCatalogEntry.

When table name starts with rel_, query foreign keys from the db to
determine src/dst node tables and create a RelGroupCatalogEntry
instead of a NodeTableCatalogEntry.
Match the pg_client naming convention (PR #65): rel_* = foreign-key-backed,
scan-driven relationship tables; csr_rel_* is reserved for attach-time
materialization into a local on-disk CSR RelTable and currently routes
through the same scan-driven path until COPY-based materialization lands.
Add duckdb_rel.test with a self-contained fixture db (users_sessions.db):
node tables users/sessions plus rel_user_owns_session (rel_* prefix) and
csr_rel_user_blocks_user (csr_rel_* prefix). Covers LOAD FROM scans,
MATCH traversal counts over both rel variants, and DETACH.

Also fix createForeignRelTable's FK discovery query: DuckDB's
information_schema.constraint_column_usage reports the constraint's own
table rather than the referenced one, so src/dst node tables could never
be resolved. Use duckdb_constraints() (referenced_table +
unnest(constraint_column_names)) instead.
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