Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version
)?
go version go1.7.3 linux/amd64
What operating system and processor architecture are you using (go env
)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/Catalog"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
What did you do?
Running a query in postgresql where a column in a table is an array.
column description
consistencydate | timestamp without time zone[] | not null
A query i'm running is
rows, err := c.db.Query("select parent, filename, mtime, size, mode, consistencydate from " + appTableName + " where parent ilike '%' || $1 || '%' or filename ilike '%' || $2 || '%'", fs.Name, fs.Name)
if err != nil {
return nil, errors.WithStack(err)
}
defer rows.Close()
for rows.Next() {
var f models.FileRecord
if err := rows.Scan(&f.Parent, &f.Filename, &f.LastModificationTime, &f.Size, &f.Mode, &f.ConsistencyDate); err != nil {
return nil, errors.WithStack(err)
}
records = append(records, &f)
}
if err := rows.Err(); err != nil {
return nil, errors.WithStack(err)
}
return records, nil
What did you expect to see?
a proper conversion from a timestamp without timezone[] field to []time.Time
What did you see instead?
an error
2016/11/07 13:40:15 sql: Scan error on column index 5: unsupported Scan, storing driver.Value type []uint8 into type *[]time.Time
I think that sql.Scan() doesn't support []time.Time. If there's no plan to support it, that's ok. I just want to know.