-
Notifications
You must be signed in to change notification settings - Fork 968
Open
Labels
Description
Version
1.28.0
What happened?
I have the following CTE in my queries.sql
WITH w_pending_sale_status as (
select * from
(values ('SAVED'), ('IDLE'), ('IN PROGRESS'), ('HELD'))
as pending_sale_status(status)
)
SELECT status FROM w_pending_sale_status;Once generated the go file's sql is this
WITH w_pending_sale_status as (
select from
(values ('SAVED'), ('IDLE'), ('IN PROGRESS'), ('HELD'))
as pending_sale_status(status)
)
SELECT status FROM w_pending_sale_status;Notice it is missing the * so that the error when execting from postgres is column status is not a valid column name
Relevant log output
NADatabase schema
SQL queries
-- name: SaleStatus :many
WITH w_pending_sale_status as (
select * from
(values ('SAVED'), ('IDLE'), ('IN PROGRESS'), ('HELD'))
as pending_sale_status(status)
)
SELECT status FROM w_pending_sale_status;Configuration
version: "2"
sql:
- engine: "postgresql"
queries: "db/queries"
schema: "db/migrations"
codegen:
- plugin: golang
out: "gen/db"
options:
package: "gendb"
sql_package: "pgx/v5"
overrides:
- column: "transactions.amount"
go_type:
import: "github.com/shopspring/decimal"
type: "Decimal"
pointer: true
- db_type: "pg_catalog.numeric"
go_type: "github.com/shopspring/decimal.Decimal"
- db_type: "pg_catalog.numeric"
go_type: "github.com/shopspring/decimal.NullDecimal"
nullable: truePlayground URL
No response
What operating system are you using?
Windows
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go