fix: remove pg_catalog prefix for unknown types in deparser #257
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.
Summary
Removes hardcoded
pg_catalog.prefix from thegetPgCatalogTypeNamefunction in the TypeScript deparser. This fixes issues with extension types (citext, hstore, ltree, etc.) that don't live inpg_catalogbut in the schema where the extension is installed (typicallypublic).PostgreSQL automatically searches
pg_catalogfirst via the implicit search_path, so explicit qualification is unnecessary for built-in types and incorrect for extension types.Changes:
bpcharwithout size modifier:pg_catalog.bpchar→bpcharrealtype:pg_catalog.float4→float4pg_catalog.${typeName}→typeNameRelated issue: constructive-io/constructive-planning#477
Review & Testing Checklist for Human
pg_catalog.prefix being present in deparsed outputcitext) to confirm it no longer producespg_catalog.citextNotes
This is a companion fix to constructive-db PR #179 which applies the same fix to the SQL deparser.
Link to Devin run: https://app.devin.ai/sessions/45dd8cf3c5c4475f974e0ba445857a70
Requested by: Dan Lynch (@pyramation)