Skip to content

fix: schema qualifer reference - #124

Merged
tianzhou merged 1 commit into
mainfrom
cross_schema
Oct 24, 2025
Merged

tianzhou merged 1 commit into
mainfrom
cross_schema

Conversation

@tianzhou

@tianzhou tianzhou commented Oct 24, 2025 •

Copy link
Copy Markdown
Contributor

Fix #123

Copilot AI review requested due to automatic review settings October 24, 2025 17:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes schema qualifier references by standardizing the schema name from utils to util and removing redundant schema prefixes when objects reference types within their own schema. The changes ensure that dumped schemas use unqualified type references when the type is defined in the same schema, matching PostgreSQL's pg_dump behavior.

Key changes:

  • Renamed schema from utils to util for consistency
  • Updated code generation to strip schema prefixes from data types, return types, and composite type attributes when they match the target schema
  • Restructured tenant schema tests to load the same SQL into public, tenant1, and tenant2 schemas

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
testdata/dump/tenant/util.sql Renamed schema from utils to util and updated function references
testdata/dump/tenant/tenant.sql New file containing complete schema definition with cross-schema type references and util function calls
testdata/dump/tenant/public.sql Removed file - types and tables now defined in tenant.sql instead
testdata/dump/tenant/pgschema.sql Added type definitions and removed schema qualifiers from type references within the same schema
internal/diff/type.go Added logic to strip schema prefix from composite type attributes
internal/diff/procedure.go Updated parameter formatting to strip schema prefixes for target schema
internal/diff/function.go Updated parameter and return type formatting to strip schema prefixes
cmd/dump/dump_integration_test.go Restructured test to load tenant.sql into public, tenant1, and tenant2 schemas

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tianzhou
tianzhou merged commit e523942 into main Oct 24, 2025
2 checks passed
tianzhou added a commit that referenced this pull request Oct 27, 2025
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.

types created in schema cause reference errors in planning

2 participants