Open kyleconroy opened 8 months ago
- db_type: "pg_catalog.numeric" nullable: false go_type: import: "yapi/types" type: "Decimal" - db_type: "pg_catalog.numeric" nullable: true go_type: import: "yapi/types" type: "Decimal"
this was generating model ok, but not the queries. I fixed it by duplicating the above for numeric type but without the schema
- db_type: "numeric" nullable: false go_type: import: "yapi/types" type: "Decimal" - db_type: "numeric" nullable: true go_type: import: "yapi/types" type: "Decimal"
The issue appears in gen.go file here
structs := buildStructs(req, options) queries, err := buildQueries(req, options, structs)
buildStructs works off schema.Tables, while buildQueries off req.Queries.Params
These functions need to be aligned to use schema data from the same source.
I'll just stick with my workaround for now, as I don't have time to fix this - it appears some significant changes may be required here.
This misalignment is likely to cause other issues, I'm sure.
Originally posted by @shkvoretz in https://github.com/sqlc-dev/sqlc/issues/3005#issuecomment-1850261768
@shkvortez I can't reproduce this behavior in the playground. Can you take a look at the example and help me out?
this was generating model ok, but not the queries. I fixed it by duplicating the above for numeric type but without the schema
The issue appears in gen.go file here
buildStructs works off schema.Tables, while buildQueries off req.Queries.Params
These functions need to be aligned to use schema data from the same source.
I'll just stick with my workaround for now, as I don't have time to fix this - it appears some significant changes may be required here.
This misalignment is likely to cause other issues, I'm sure.
Originally posted by @shkvoretz in https://github.com/sqlc-dev/sqlc/issues/3005#issuecomment-1850261768