-
Notifications
You must be signed in to change notification settings - Fork 929
Open
Labels
Description
Version
1.30.0
What happened?
I've tried to run an INSERT INTO on postgres with a JSONB column and using sqlc.arg(name)::jsonb as type.
The column is type-overridden with a custom go-struct, which also works when having $1 as parameter in the insert query. It breaks when changing $1 into sqlc.arg(name)::jsonb.
As a user, I'd expect sqlc to track the type overrides.
Relevant log output
Database schema
CREATE TABLE public.sample (
name text not null,
id text not null,
settings jsonb
);
SQL queries
INSERT INTO sample (name, id, settings) VALUES (sqlc.arg(custom_name)::text, sqlc.arg(id)::text, sqlc.arg(default_settings)::jsonb) RETURNING *;
Configuration
version: "2"
sql:
- engine: "postgresql"
schema: "sql/schema.sql"
queries: "sql/queries.sql"
gen:
go:
emit_interface: true
emit_enum_valid_method: true
emit_pointers_for_null_types: true
out: "./database"
package: "database"
sql_package: "pgx/v5"
overrides:
- column: "sample.settings"
go_type:
type: "Settings"
package: dto
import: "my_pkg/dto"
Playground URL
No response
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go