Open optimuspaul opened 1 week ago
1.27.0
created some tables and queries to insert values into the tables. the generated code doesn't generate sensible or expected results.
:execresult
pgconn.CommandTag
:execlastid
No response
CREATE TABLE users ( id uuid PRIMARY KEY DEFAULT gen_random_uuid(), email text NOT NULL UNIQUE, password text, enabled boolean NOT NULL DEFAULT TRUE ); CREATE TABLE lusers ( id serial PRIMARY KEY, email text NOT NULL UNIQUE, password text, enabled boolean NOT NULL DEFAULT TRUE );
-- name: CreateUserA :execresult insert into users (email, password, enabled) values ($1, $2, $3) returning *; -- name: CreateUserB :execlastid insert into users (email, password, enabled) values ($1, $2, $3) returning *; -- name: CreateUserC :execrows insert into users (email, password, enabled) values ($1, $2, $3) returning *; -- name: CreateUserD :exec insert into users (email, password, enabled) values ($1, $2, $3) returning *;
{ "version": "2", "sql": [{ "schema": "schema.sql", "queries": "query.sql", "engine": "postgresql", "gen": { "go": { "out": "db", "sql_package": "pgx/v5" } } }] }
https://play.sqlc.dev/p/1f7b12addc3f2d40a3e92ab77d5ea4e6e988e3c1cb1a521801a4023e2dc5b4dc
macOS
PostgreSQL
Go
You have to use :one or :many rather than :execresult
:one
:many
Version
1.27.0
What happened?
created some tables and queries to insert values into the tables. the generated code doesn't generate sensible or expected results.
:execresult
producespgconn.CommandTag
:execlastid
doesn't even generate the function at allRelevant log output
No response
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/1f7b12addc3f2d40a3e92ab77d5ea4e6e988e3c1cb1a521801a4023e2dc5b4dc
What operating system are you using?
macOS
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go