Uh oh!
There was an error while loading. Please reload this page.
fix: add schema qualification hints for extension type errors - #4513
Conversation
sweatybridge
commented
Nov 26, 2025
Thanks for checking. Our current recommendation is to always use schema qualified references in your migration file. For eg. CREATETABLEtest (pathextensions.ltreeNOT NULL);This avoids ambiguity in default search path resolution which can be configured per session, per role, or per cluster. The default search path for Supabase postgres role is currently set to |
@sweatybridge Thanks for the elaboration! I get that relying on a fixed search_path isn’t future-proof. |
sweatybridge
commented
Nov 26, 2025
Do you plan to do this by inspecting the error object returned from pgx? If so, that sounds good to me. Thanks for your help. |
7ttp
commented
Nov 26, 2025
Yep, I’ll inspect the pgx error and add the clearer message + schema qualification hint. On it |
b68f5bb to
1b972d2ComparePull Request Test Coverage Report for Build 21779030687Details
💛 - Coveralls |
1b972d2 to
711463fCompare7ttp
commented
Nov 27, 2025
@sweatybridge whenever you have a moment, a quick review would be appreciated. 💚 |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
@sweatybridge All requested changes have been applied. Ready for rereview. |
Uh oh!
There was an error while loading. Please reload this page.
8def4f9 to
3395b48Compare7ttp
commented
Feb 6, 2026
@sweatybridge heyy! |
sweatybridge
commented
Feb 7, 2026
Can we add some unit tests for the new code please? |
Inspect pgx errors for SQLSTATE 42704 (undefined_object) and provide helpful hints when extension types are not found. The error message now: - Detects 'type does not exist' errors - Extracts the type name from the error message - Suggests using schema-qualified references (e.g., extensions.ltree) - Provides a concrete example in the error output This addresses the issue where migrations work locally but fail remotely with opaque 'type does not exist' errors, making it clear to users that they should use schema-qualified type references instead of relying on search_path settings.
b2873f8 to
c01e0daCompare7ttp
commented
Feb 7, 2026
Added unit tests for extractTypeName function |
Uh oh!
There was an error while loading. Please reload this page.
Summary
Improve CLI migration errors for undefined PostgreSQL extension types by adding a context aware hint for unqualified type references.
Problem
Migrations can fail with:
This error does not indicate whether the type is missing due to schema visibility,
extension installation, or configuration differences.
Solution
Inspect pgconn.PgError during migration execution and conditionally provide a schema-qualification hint only when the referenced type is not already schema-qualified.
Related