3423 Commits

Author SHA1 Message Date
Jack Christensen
97d1012f42 Use testsetup/postgresql_setup.sql in CI 2022-10-29 17:27:39 -05:00
Jack Christensen
6bedfa7def Use testsetup/pg_hba.conf in CI 2022-10-29 17:23:13 -05:00
Jack Christensen
55b5067ddd Improve testing / contributing instructions
* Extract CONTRIBUTING.md
* Add instructions and scripts to setup standalone PostgreSQL server
  that tests the various connection and authentication types.
2022-10-29 17:14:09 -05:00
Jack Christensen
1ec3816a20 pgconn and pgproto use same environment variable for tests as pgx 2022-10-29 13:23:25 -05:00
Jack Christensen
c9c166b8b2 Fix TestConnCopyFromDataWriteAfterErrorAndReturn always being skipped 2022-10-29 13:17:52 -05:00
Jack Christensen
9a207178f6 Fix TestConnCheckConn always being skipped 2022-10-29 13:16:05 -05:00
Jack Christensen
3feeddd9f1 Fix tests when PGUSER is different than OS user 2022-10-29 13:12:03 -05:00
Jack Christensen
72c89108ad Fix tests when PGPORT set to non-default value 2022-10-29 13:06:53 -05:00
Jack Christensen
c130b2d74a Update CopyFrom documentation to be clearer
Regarding binary requirement and enums in particular.

https://github.com/jackc/pgx/issues/1338
2022-10-29 09:48:45 -05:00
Jack Christensen
7d3b9c1e44 QueryRewriter.RewriteQuery now returns an error
https://github.com/jackc/pgx/issues/1186#issuecomment-1288207250
2022-10-29 09:33:13 -05:00
Jack Christensen
6515e183ff Update doc example for pgx.ForEachRow
fixes https://github.com/jackc/pgx/issues/1360
2022-10-29 08:59:57 -05:00
Jack Christensen
e35041372d Remove mistakenly included replace directive in go.mod 2022-10-29 08:56:49 -05:00
Jack Christensen
6fabd8f5b1 Fix encoding uint64 larger than math.MaxInt64 into numeric
fixes https://github.com/jackc/pgx/issues/1357
2022-10-29 08:47:12 -05:00
Jack Christensen
c00fb5d2a1 Upgrade to puddle v2.0.1 2022-10-29 08:09:54 -05:00
Jack Hopner
55d5d036c0 add pgx xray tracer to readme 2022-10-27 19:42:36 -05:00
Jack Christensen
987de3874e Update changelog v5.0.4 2022-10-24 19:11:50 -05:00
Jack Christensen
3ad9995dfe Exec checks if tx is closed
https://github.com/jackc/pgx/discussions/1350
2022-10-24 18:23:26 -05:00
Baptiste Fontaine
3e825ec898 Fix RowToStructByPos on structs with multiple anonymous sub-structs
Fixes #1343
2022-10-22 10:02:32 -05:00
Jeff Koenig
ba100785cc fix: bump text package for CVE-2022-32149
https://security.snyk.io/vuln/SNYK-GOLANG-GOLANGORGXTEXTLANGUAGE-3043869
2022-10-22 09:07:24 -05:00
Jack Christensen
48b4807b33 Fix some reflect Kind checks to first check for nil
fixes https://github.com/jackc/pgx/issues/1335
2022-10-22 08:57:49 -05:00
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 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 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 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 v5.0.0 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