Open
Description
Given this SQL:
CREATE TYPE fruit AS ENUM ('apple', 'banana', 'kiwi');
CREATE TABLE choices (
id int PRIMARY KEY,
fruits fruit[] NOT NULL
);
-- name: GetChoice :one
SELECT * FROM choices WHERE id = $1;
along with this config:
version: "2"
sql:
- schema: "query.sql"
queries: "query.sql"
engine: "postgresql"
gen:
go:
out: "db"
sql_package: "pgx/v4"
When calling the generated GetChoice
function, it panics:
panic: reflect.Value.Convert: value of type *[]db.Fruit cannot be converted to type *[]string
I can't work out if the problem lies with sqlc
, pgx
, or (more likely) me. Possibly worth noting that if I modify the generated code to make use of pq.Array
when scanning into the array, it then works.
Anyone able to advise if I'm doing something wrong?