Resolve cross-schema row types to STRUCT (not VARCHAR)#476
Merged
Conversation
Follow-up to duckdb#474 / duckdb#475. After PR duckdb#475, row types of relations are discovered and registered under their own schema, so the in-schema case works. But when a relation in schema B has a column whose type is the row type of a relation in schema A, PostgresUtils::TypeToLogicalType still looked up the type entry against the relation's schema (B). It finds nothing there and falls back to VARCHAR. Plumb the type's own namespace through PostgresTypeData. The two discovery queries now join pg_namespace on pg_type.typnamespace and expose nspname as the type's schema, and TypeToLogicalType uses Catalog::GetSchema to resolve the lookup against that schema when it differs from the relation's own. Extend test/sql/storage/attach_types_table_row.test with a cross- schema view and table; the existing test put both ends in the same schema, which is why this slipped through.
Member
|
Hi, thanks for the PR! I think it looks good, just there is an outage with GH actions right now so CI tests are not running. I'll trigger the tests run when the actions are back on. |
The two SQL discovery queries pull type_schema from an INNER JOIN on pg_namespace, so the column is never NULL.
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.
Follow-up to #474 / #475. After PR #475, row types of relations are discovered and registered under their own schema, so the in-schema case works. But when a relation in schema B has a column whose type is the row type of a relation in schema A, PostgresUtils::TypeToLogicalType still looked up the type entry against the relation's schema (B). It finds nothing there and falls back to VARCHAR.