Repository navigation
fix(postgres): type names from the database analyzer, enums, escaped … - #75
Open
timohuovinen wants to merge 1 commit into
Open
timohuovinen wants to merge 1 commit into
timohuovinen wants to merge 1 commit into
Conversation
…query text
sqlc's database analyzer names types the way format_type prints them
(integer, boolean, timestamp(3) with time zone, numeric(12,2)); the type
tables only knew the pg_type names, so those parameters and computed columns
fell back to string, and postgres.js sends a string given for a boolean
parameter as false. Both spellings now map to the same type in the postgres
and pg drivers, modifiers dropped.
- Enum types become string literal unions, from the catalog.
- postgres driver: date and timestamp parameters take Date | string.
- The query is emitted as a template literal with backslash, backtick and
${ escaped, so `'\%'` reaches the database as written.
- Each query file is emitted once instead of once per query.
- Code generation moves to src/codegen.ts so tests run it under Node:
npm test (no database) and npm run test:postgres (analyzer-generated code
run with postgres.js); CI runs both against PostgreSQL 17.
- A vX.Y.Z tag publishes the WASM as a release asset with its sha256.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
…query text
sqlc's database analyzer names types the way format_type prints them (integer, boolean, timestamp(3) with time zone, numeric(12,2)); the type tables only knew the pg_type names, so those parameters and computed columns fell back to string, and postgres.js sends a string given for a boolean parameter as false. Both spellings now map to the same type in the postgres and pg drivers, modifiers dropped.
'\%'reaches the database as written.