With a column of type TIMESTAMPTZ aggregated into one row's return column of type TIMESTAMPTZ[] via array_agg, the following doesnt return an error but marks each pq.NullTime.Valid as false.
The stacktrace:
The variables and code location:
The stringified value yields: 2023-03-03 17:43:52.010562+00 (without single or double quotes). Given that its []byte and not time.Time, the assert fails.
type PackageRepoReference struct {
ID int
Scheme string
Name string
Blocked bool
LastCheckedAt *time.Time
}
var ref PackageRepoReference
var (
versionStrings []string
ids []int64
blocked []bool
lastCheckedAt []pq.NullTime
)
err := s.Scan(
&ref.ID,
&ref.Scheme,
&ref.Name,
&ref.Blocked,
&ref.LastCheckedAt,
pq.Array(&ids),
pq.Array(&versionStrings),
pq.Array(&blocked),
pq.Array(&lastCheckedAt),
)
With a column of type
TIMESTAMPTZ
aggregated into one row's return column of typeTIMESTAMPTZ[]
viaarray_agg
, the following doesnt return an error but marks eachpq.NullTime.Valid
as false.The stacktrace:
The variables and code location:
The stringified
value
yields:2023-03-03 17:43:52.010562+00
(without single or double quotes). Given that its[]byte
and nottime.Time
, the assert fails.