fix(pg_client): discover attached database name dynamically - #34
Closed
adsharma wants to merge 1 commit into
Closed
Conversation
Pass the ATTACH alias (dbName) directly through the PgClientCatalog constructor instead of hardcoding schema-qualified names like 'public.node_person' or 'public.fkrel_knows'. The foreignDatabaseName must be the lbug attached-database name so the join-push-down optimizer can look it up via DatabaseManager::getAttachedDatabase(). The correct name is already known at ATTACH time (the AS <name> alias), so we thread it through the constructor rather than trying to discover it later. This fixes the case where a user ATTACHes pg_client with a custom alias (e.g. 'ATTACH ... AS mydb') — the shadow entries will now use 'mydb' instead of failing to find the attached database.
adsharma
force-pushed
the
fix/foreign-db-name-dynamic-lookup
branch
from
July 28, 2026 00:02
77bb79d to
e83f8b4
Compare
Contributor
Author
|
This doesn't work |
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.
Replace the hardcoded 'pg' database name in foreignDatabaseName with a dynamic lookup that matches the PgClientConnector reference against all attached databases in DatabaseManager. This ensures the correct database alias is used regardless of what name the user specified in the ATTACH ... AS statement.
Adds getAttachedDBName() helper that iterates through attached databases, finds the AttachedPgClientDatabase whose connector matches, and returns its dbName. Falls back to empty string if no match is found.