This will be useful for array and composite types that may have to
support elements that may not support binary encoding.
It also is slightly more convenient for text-ish types to have a default
format of text.
Methods defined on T are also available on *T. Thought this technically
changes the interface, because *T will be automatically dereferenced as
needed it shouldn't be a breaking change.
See a8802b16cc for similar change.
Methods defined on T are also available on *T. This change makes Value
consistent with database/sql Value implementations. It also makes Value,
EncodeBinary, and EncodeText more convenient to use because you can
pass T or *T as an argument to a query.
The MarshalJSON change is even more significant because without it
json.Marshal would generate the "%v" format instead of the implemented
MarshalJSON.
Thought this technically changes the interface, because *T will be
automatically dereferenced as needed it shouldn't be a breaking change.
See: https://github.com/jackc/pgx/issues/538 for initial discussion.
AssignTo can only assign NULL to a **string. Previous code tried to
assign nil to a *string, which did nothing. Correct behavior is to
detect this as an error.
JSON(B) automatically marshals any value. Avoid marshalling values of
pgtype.JSON and pgtype.JSONB. The caller certainly meant to call on a
pointer.
See https://github.com/jackc/pgx/issues/350 for discussion.
refs #350
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.
Because reading a record type requires the decoder to be able to look up oid
to type mapping and types such as hstore have types that are not fixed between
different PostgreSQL servers it was necessary to restructure the pgtype system
so all encoders and decodes take a *ConnInfo that includes oid/name/type
information.