duckdb catalog: auto-detect rel_* tables as relationship tables - #31
Open
adsharma wants to merge 3 commits into
Open
duckdb catalog: auto-detect rel_* tables as relationship tables#31adsharma wants to merge 3 commits into
adsharma wants to merge 3 commits into
Conversation
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.
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.
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.