pgtype DecodeText and DecodeBinary do not copy
They now take ownership of the src argument. Needed to change Scan to make a copy of []byte arguments as lib/pq apparently gives Scan a shared memory buffer.
This commit is contained in:
+1
-5
@@ -37,12 +37,8 @@ func (dst *Jsonb) DecodeBinary(ci *ConnInfo, src []byte) error {
|
||||
if src[0] != 1 {
|
||||
return fmt.Errorf("unknown jsonb version number %d", src[0])
|
||||
}
|
||||
src = src[1:]
|
||||
|
||||
buf := make([]byte, len(src))
|
||||
copy(buf, src)
|
||||
|
||||
*dst = Jsonb{Bytes: buf, Status: Present}
|
||||
*dst = Jsonb{Bytes: src[1:], Status: Present}
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user