Wasn't able to get uuid's working. Doesn't seem to work as a UUID, a string or a slice of bytes.
Here's the error I'm seeing:
ERROR: incorrect binary data format (SQLSTATE 22P03)
I took a peak around to see if I could get it working, but it seems like COPY IN needs very specific values. I think there's a mismatch between the postgres uuid type and the encoded uuid string.
Here's the code I'm using:
// ...
events := [][]interface{}{}
for _, ti := range times {
events = append(events, []interface{}{uuid.NewV4(), ti})
}
// bulk insert
_, err = tx.CopyFrom(pgx.Identifier{"events"}, []string{"task", "time"}, pgx.CopyFromRows(events))
if err != nil {
log.WithError(err).Error("Unable to copy in events")
return
}
tx.Commit()
FWIW, I was able to get this working with pq, so there might be something to pull from there.
Wasn't able to get uuid's working. Doesn't seem to work as a UUID, a string or a slice of bytes.
Here's the error I'm seeing:
I took a peak around to see if I could get it working, but it seems like COPY IN needs very specific values. I think there's a mismatch between the postgres uuid type and the encoded uuid string.
Here's the code I'm using:
FWIW, I was able to get this working with pq, so there might be something to pull from there.