You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The parameter data type is not generated by sqlc if in a situation query for a column with datatype jsonb where named parameters are on each side of an equal sign.
This type should be generated but it isn't
type GetFooByBarNumberedParams struct {
key pqtype.NullRawMessage
value pqtype.NullRawMessage
}
Also the query generated is not what is expected
const getFooByBarNamed = `-- name: GetFooByBarNamed :one
SELECT bar_named FROM foo_named
WHERE bar_named->>@key = $1
LIMIT 1
`
It would be expected that this query is generated
const getFooByBarNamed = `-- name: GetFooByBarNamed :one
SELECT bar_named FROM foo_named
WHERE bar_named->>@key = @value
LIMIT 1
`
Relevant log output
No response
Database schema
CREATETABLEfoo_named (
bar_named jsonb
);
SQL queries
-- name: GetFooByBarNamed :oneSELECT bar_named FROM foo_named
WHERE bar_named->>@key = @value
LIMIT1;
@kyleconroy We forgot about sqlc.arg, this solves the problem for us. The dollar sign variant did not really produce good field names on the struct, so this was not really an option for us.
Is this a now limitation of using @, which comes from the postgres SQL parser or is it still a bug, that @ can not be used?
Version
1.10.0
What happened?
The parameter data type is not generated by sqlc if in a situation query for a column with datatype
jsonb
where named parameters are on each side of an equal sign.This type should be generated but it isn't
Also the query generated is not what is expected
It would be expected that this query is generated
Relevant log output
No response
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/357e581cff2aec6d6d835ec993dc17eb8480686b7377d2704508a58da1a71313
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: