This patch fixes jackc/pgx#841. The meat of the fix lives
in [a PR to the pgconn repo][1]. This change just checks
for errors after executing a prepared statement and informs
the underlying stmtcache about them so that it can properly
clean up. We don't try to get fancy with retries or anything
like that, just return the error and allow the application to handle it.
I had to make [some][1] [changes][2] to to the jackc/pgconn package as well
as this package.
Fixes#841
[1]: https://github.com/jackc/pgconn/pull/56
[2]: https://github.com/jackc/pgconn/pull/55
A Config object may be created via ParseConfig and then further
modified. Requiring access to the original ConnString via the Config
helps indicate that the Config is the source of truth as to how the
connection was actually established.
Increased data type support for simple protocol. Improved test
coverage of simple protocol. This has the additional advantage of
exercising the text encoders and decoders.
IsAlive is ambiguous because the connection may be dead and we do not
know it. It implies the possibility of a ping. IsClosed is clearer -- it
does not promise the connection is alive only that it hasn't been
closed.
It was a mistake to use it in other contexts. This made interop
difficult between pacakges that depended on pgtype such as pgx and
packages that did not like pgconn and pgproto3. In particular this was
awkward for prepared statements.
This is preparation for removing pgx.PreparedStatement in favor of
pgconn.PreparedStatement.
This simplifies handling default values. Now there is no ambiguity
between a zero value and a default value. All default values are set by
ParseConfig and the user can modify them after the initial creation.
fixes#567
Also remove PrepareEx. It's primary usage was for context. Supplying
parameter OIDs is unnecessary when you can type cast in the query SQL.
If it does become necessary or desirable to add options back it can be
added in a backwards compatible way by adding a varargs as last
argument.