lib / pq

Pure Go Postgres driver for database/sql
https://pkg.go.dev/github.com/lib/pq
MIT License
8.86k stars 908 forks source link

How to query multi-dimensional array of float64 ? #960

Open b3j0f opened 4 years ago

b3j0f commented 4 years ago

According to this query:

db.Query("SELECT data FROM chunk", array)

where data is type double precision[][]

I tried with those types without success:

var (
    data [][]sql.NullFloat64
    array = pq.Array(pq.GenericArray{A: &data})
)

error: sql: Scan error on column index 1, name "data": unsupported Scan, storing driver.Value type []uint8 into type *interface { Scan(interface {}) error; Value() (driver.Value, error) }

var (
    data [][]sql.NullFloat64
    array = pq.GenericArray{A: &data}
)

error: sql: Scan error on column index 1, name "data": pq: scanning from multidimensional ARRAY[54614][12] is not implemented

...

Do you have any advice ?

WilliamSoler commented 3 months ago

As far I am aware currently is not possible. Which to me seems quite a standard use case to be ignored.