Jack Christensen
6e40968cfc
CollectOneRow prefers PostgreSQL error over pgx.ErrorNoRows
...
fixes https://github.com/jackc/pgx/issues/1334
2022-10-22 08:44:06 -05:00
Jack Christensen
11e5f68ff6
Update changelog for v5.0.3
2022-10-14 19:11:11 -05:00
Baptiste Fontaine
7a9e70d1e0
Fix some bad rows.Err() handlings in tests
2022-10-14 19:02:44 -05:00
Jack Christensen
f2e7c8144d
reflect.TypeOf can return nil. Check before using
...
https://github.com/jackc/pgx/issues/1331
2022-10-12 20:03:51 -05:00
Jack Christensen
aff180b192
Remove dead code
2022-10-12 19:58:06 -05:00
Jack Christensen
a581124dea
Encode with driver.Valuer after trying TryWrapEncodePlanFuncs
...
However, all builtin TryWrapEncodePlanFuncs check for driver.Valuer and
skip themselves if it is found.
2022-10-12 19:52:57 -05:00
Jack Christensen
c4407fb36e
Prevent infinite loop for driver.Valuer / Codec edge case
...
A `driver.Valuer()` results in a `string` that the `Codec` for the
PostgreSQL type doesn't know how to handle. That string is scanned into
whatever the default type for that `Codec` is. That new value is
encoded. If the new value is the same type as the original type than an
infinite loop occured. Check that the types are different.
https://github.com/jackc/pgx/issues/1331
2022-10-12 19:46:15 -05:00
Jack Christensen
094ad9c9d8
Update changelog for v5.0.2
2022-10-08 18:58:17 -05:00
Jack Christensen
af0b896290
Allow scanning null even if PG and Go types are incompatible
...
refs https://github.com/jackc/pgx/issues/1326
2022-10-08 09:10:43 -05:00
Jack Christensen
5655f9d593
Fix scan to pointer to pointer to renamed type
...
refs https://github.com/jackc/pgx/issues/1326
2022-10-08 08:10:40 -05:00
Jack Christensen
f803c790d0
Fix docs for listen / notify
...
https://github.com/jackc/pgx/issues/1318
2022-10-01 12:58:49 -05:00
Jack Christensen
222e3b37bc
Prefer driver.Value over wrap plans when encoding
...
This is tricky due to driver.Valuer returning any. For example, we can
plan for fmt.Stringer because it always returns a string.
Because of this driver.Valuer was always handled as the last option. But
with pgx v5 now having the ability to find underlying types like a
string and supporting fmt.Stringer it meant that driver.Valuer was
often not getting called because something else was found first.
This change tries driver.Valuer immediately after the initial PlanScan
for the Codec. So a type that directly implements a pgx interface should
be used, but driver.Valuer will be prefered before all the attempts to
handle renamed types, pointer deferencing, etc.
fixes https://github.com/jackc/pgx/issues/1319
fixes https://github.com/jackc/pgx/issues/1311
2022-10-01 12:20:23 -05:00
Jack Christensen
89f69aaea9
Date text encoding includes leading zero for month and day
...
e.g. 2000-01-01 instead of 2000-1-1. PostgreSQL accepted it without
zeroes but our text decoder didn't. This caused a problem when we needed
to take a value and encode to text so something else could parse it as
if it had come from the PostgreSQL server in text format. e.g.
database/sql compatibility.
2022-10-01 10:41:40 -05:00
Jack Christensen
63ae730fe8
Upgrade CockroachDB on CI
2022-10-01 10:11:11 -05:00
Jack Christensen
305c4ddbc7
Move and rename test
2022-10-01 10:09:57 -05:00
Jack Christensen
fb83fb0cc3
Skip TestCopyFrom on CockroachDB
2022-10-01 10:08:03 -05:00
Tommy Reilly
c48dd7e1f8
Add a test case demonstrating I/O race with CopyFrom
2022-10-01 10:07:38 -05:00
Jack Christensen
cd8b29b0fe
Fix flickering on TestConnectTimeoutStuckOnTLSHandshake
...
Ensure that even if the outer function finishes the goroutine can still
send an error.
2022-09-24 12:54:59 -05:00
Jack Christensen
0aa681f3a3
Update changelog for v5.0.1
2022-09-24 11:15:31 -05:00
Jack Christensen
335c8621ff
Fix sqlScannerWrapper NULL handling
...
https://github.com/jackc/pgx/issues/1312
2022-09-24 10:30:12 -05:00
Jack Christensen
ac9d4f4d96
Encode text for Lseg includes [ and ]
...
https://github.com/jackc/pgtype/issues/187
2022-09-24 10:30:12 -05:00
yogipristiawan
72e4b88e56
feat: add marshalJSON for float8 type
2022-09-24 10:00:40 -05:00
Peter Feichtinger
639fb28846
Fix typo
2022-09-24 09:26:52 -05:00
Jack Christensen
d7c7ddc594
Fix Windows 386 atomic usage
...
https://github.com/jackc/pgx/issues/1307
2022-09-24 09:23:36 -05:00
Jack Christensen
4fc4f9a603
Remove spurious .travis.yml
2022-09-17 10:36:36 -05:00
Jack Christensen
23a59d68fc
Merge branch 'v5-dev'
2022-09-17 10:35:32 -05:00
Jack Christensen
5a055434f2
Upgrade dependencies
2022-09-17 10:24:19 -05:00
Jack Christensen
1a314bda3b
pgconn.Timeout() no longer considers `context.Canceled` as a timeout error.
...
https://github.com/jackc/pgconn/issues/81
2022-09-17 10:18:06 -05:00
Jack Christensen
4f1a8084f1
Various doc and changelog tweaks
2022-09-17 09:03:48 -05:00
Jack Christensen
a05fb80b8a
Update docs and changelog for renamed pgxpool.NewWithConfig
...
fixes https://github.com/jackc/pgx/issues/1306
2022-09-16 18:16:36 -05:00
Jack Christensen
90b69c0ee0
Fix atomic alignment on 32-bit platforms
...
refs #1288
2022-09-08 20:43:53 -05:00
Jack Christensen
ee2622a8e6
RowToStructByPos supports embedded structs
...
https://github.com/jackc/pgx/issues/1273#issuecomment-1236966785
2022-09-06 18:32:10 -05:00
Jack Christensen
d42b399be3
Update changelog
2022-09-03 13:42:36 -05:00
Jack Christensen
f015ced1bf
Use puddle v2.0.0-beta.2 for Acquire in background after cancel
2022-09-03 13:20:19 -05:00
Jack Christensen
782133158f
Test sending CopyData before CopyFrom responds with error
2022-09-03 09:31:41 -05:00
Tom Möller
dfce986bb5
Fix panic when logging batch error
2022-09-03 09:02:23 -05:00
Jack Christensen
f8d088cfb6
Fix JSON scan not completely overwriting destination
...
See https://github.com/jackc/pgtype/pull/185 for original report in
pgx v4 / pgtype.
2022-09-02 18:37:02 -05:00
Jack Christensen
f5cdf0d383
Update changelog
2022-08-27 18:18:41 -05:00
Jack Christensen
72fe594942
Upgrade to puddle v1.3.0
2022-08-27 18:18:34 -05:00
Jack Christensen
bce26b85d1
Fix atomic alignment on 32-bit platforms
...
refs #1288
2022-08-27 09:23:17 -05:00
Jack Christensen
bb6c997102
Add NewCommandTag
...
Useful for mocking and testing.
https://github.com/jackc/pgx/issues/1273#issuecomment-1224154013
2022-08-23 19:39:15 -05:00
Jack Christensen
fe3a4f3150
Standardize casing for NULL in error messages
2022-08-22 21:01:18 -05:00
Jack Christensen
2e73d1e8ee
Improve error message when failing to scan a NULL::json
2022-08-22 20:56:36 -05:00
Jack Christensen
0d5d8e0137
Fallback to other format when encoding query arguments
...
The preferred format may not be possible for certain arguments. For
example, the preferred format for numeric is binary. But if
shopspring/decimal is being used without jackc/pgx-shopspring-decimal
then it will use the database/sql/driver.Valuer interface. This will
return a string. That string should be sent in the text format.
A similar case occurs when encoding a []string into a non-text
PostgreSQL array such as uuid[].
2022-08-22 20:26:38 -05:00
Jack Christensen
ae65a8007b
Use higher pgconn.FieldDescription with string Name
...
Instead of using pgproto3.FieldDescription through pgconn and pgx. This
lets the lowest level pgproto3 still be as memory efficient as possible.
https://github.com/jackc/pgx/pull/1281
2022-08-20 10:04:18 -05:00
Jack Christensen
dbee461dc9
Update previous pgconn merge for v5
2022-08-19 17:42:04 -05:00
Jack Christensen
ef5655c563
Merge remote-tracking branch 'pgconn/master' into v5-dev
2022-08-19 17:36:29 -05:00
Stas Kelvich
15f8e6323e
Fix tests that check tls.Config.ServerName -- with SNI this field
...
is filled, unless SNI is delibaretely disabled. Also, do not set
SNI when host is an IP address as per RFC 6066.
2022-08-19 17:35:33 -05:00
Stas Kelvich
e3406d95f9
Add test coverage for client SNI
2022-08-19 17:35:33 -05:00
Stas Kelvich
067771b2e6
Set SNI for SSL connections
...
This allows an SNI-aware proxy to route connections. Patch adds a new
connection option (`sslsni`) to opt out of the SNI, to have the same
behavior as `libpq` does. See more in `sslsni` sections at
<https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS >.
2022-08-19 17:35:33 -05:00