Jack Christensen
1d557f9116
Remove PlanScan memoization
...
Previously, PlanScan used a cache to improve performance. However, the
cache could get confused in certain cases. For example, the following
would fail:
m := pgtype.NewMap()
var err error
var tags any
err = m.Scan(pgtype.TextArrayOID, pgx.TextFormatCode, []byte("{foo,bar,baz}"), &tags)
require.NoError(t, err)
var cells [][]string
err = m.Scan(pgtype.TextArrayOID, pgx.TextFormatCode, []byte("{{foo,bar},{baz,quz}}"), &cells)
require.NoError(t, err)
This commit removes the memoization and adds a test to ensure that this
case works.
The benchmarks were also updated to include an array of strings to
ensure this path is benchmarked. As it turned out, there was next to no
performance difference between the cached and non-cached versions.
It's possible there may be a performance impact in certain complicated
cases, but I have not encountered any. If there are any performance
issues, we can optimize the narrower case rather than adding memoization
everywhere.
2025-05-17 16:34:01 -05:00
Jack Christensen
de7fe81d78
Use reflect.TypeFor instead of reflect.TypeOf
...
Simplified function became available in Go 1.22.
2025-05-17 09:11:31 -05:00
Jack Christensen
d9eb089bd7
Remove unused function
2025-05-17 09:09:07 -05:00
Jack Christensen
6be24eb08d
Fix comment typo
2025-05-17 09:01:55 -05:00
Jack Christensen
07871c0a34
Zero internal baseRows references to allow GC earlier
...
See https://github.com/jackc/pgx/pull/2269
2025-05-17 08:39:54 -05:00
Jack Christensen
777e7e5cdf
Merge pull request #2313 from stampy88/tracelog_pool_additions
...
Implement AcquireTracer and ReleaseTracer for TraceLog
2025-05-10 11:30:57 -05:00
dave sinclair
151bd026ec
Switched to LogLevelDebug
2025-05-10 12:28:26 -04:00
Jack Christensen
540fcaa9b9
Add support for PGOPTIONS environment variable
...
Match libpq behavior for PGOPTIONS environment variable. See
https://www.postgresql.org/docs/current/libpq-envars.html
2025-05-10 11:09:39 -05:00
Jack Christensen
3a248e3822
Add support for PGTZ environment variable
...
Match libpq behavior for PGTZ environment variable. See
https://www.postgresql.org/docs/current/libpq-envars.html
2025-05-10 10:58:35 -05:00
dave sinclair
baca2d848a
Implement AcquireTracer and ReleaseTracer for TraceLog
...
- `TraceLog` now implements the `pgxpool.AcquireTracer` and `pgxpool.ReleaseTracer` interfaces to log connection pool interactions.
2025-05-08 16:28:21 -04:00
Jack Christensen
c911d86cff
Merge pull request #2309 from dzherb/fix_doc
...
chore: fix typo in doc
2025-05-03 13:46:46 -05:00
dzherb
2bac99e2ae
chore: fix typo
2025-04-28 20:58:11 +03:00
Jack Christensen
c92d0a9045
Update golang.org/x/crypto to v0.37.0
...
This required bumping the minimum Go version to 1.23.0.
2025-04-26 10:09:29 -05:00
Jack Christensen
e9aad0fb0b
Add test for tracer within transaction
...
https://github.com/jackc/pgx/issues/2304
2025-04-26 09:55:31 -05:00
Jack Christensen
9e7f38cd50
Merge pull request #2302 from usernameisnull/pgconn-error
...
chore: should be pgconn.PgError
2025-04-17 08:52:47 -05:00
bing.ma
e779a5c072
chore: should be pgconn.PgError
2025-04-17 18:30:06 +08:00
Jack Christensen
ff9c26d851
Make OpenDBFromPool docs explicit about closing the *sql.DB
...
https://github.com/jackc/pgx/issues/2295
2025-04-05 09:01:11 -05:00
Jack Christensen
0f77a2d028
Merge pull request #2293 from divyam234/master
...
feat: add support for direct sslnegotiation
2025-03-31 08:13:19 -05:00
divyam234
ddd966f09f
update
2025-03-31 15:06:55 +02:00
divyam234
924834b5b4
add pgmock tests
2025-03-31 15:02:07 +02:00
divyam234
9b15554c51
respect sslmode set by user
2025-03-30 16:35:43 +02:00
divyam234
037e4cf9a2
feat: add support for direct sslnegotiation
2025-03-30 16:21:52 +02:00
Jack Christensen
04bcc0219d
Add v5.7.4 to changelog
v5.7.4
2025-03-24 20:04:45 -05:00
Jack Christensen
0e0a7d8344
Merge pull request #2288 from felix-roehrich/fr/fix-plan-scan
...
Revert change in `if` from #2236 .
2025-03-24 19:46:22 -05:00
Felix Röhrich
63422c7d6c
revert change in if
2025-03-24 15:01:50 +01:00
Jack Christensen
5c1fbf4806
Update changelog for v5.7.3
v5.7.3
2025-03-21 21:02:03 -05:00
Jack Christensen
05fe5f8b05
Explain seemingly redundant rows.Close() in CollectOneRow
...
fixes https://github.com/jackc/pgx/issues/2282
2025-03-21 20:33:32 -05:00
Jack Christensen
70c9a147a2
Merge pull request #2279 from djahandarie/min-idle-conns
...
Add MinIdleConns
2025-03-21 20:25:19 -05:00
Darius Jahandarie
6603ddfbe4
add MinIdleConns
2025-03-15 19:14:26 +09:00
Jack Christensen
70f7cad222
Add link to https://github.com/Arlandaren/pgxWrappy
2025-02-28 20:59:28 -06:00
Jack Christensen
6bf1b0b1b9
Add database/sql to overview of scanning
2025-02-22 08:42:26 -06:00
Jack Christensen
14bda65a0c
Correct pgtype docs
2025-02-22 08:34:31 -06:00
Jack Christensen
9e3c4fb40f
Merge pull request #2257 from felix-roehrich/fr/change-connect-logic
...
Change connection logic to be more forgiving
2025-02-19 07:36:35 -06:00
Felix Röhrich
05e72a5ab1
make connection logic more forgiving
2025-02-17 21:24:38 +01:00
Jack Christensen
47d631e34b
Added missed change to v5.7.2 changelog
2025-02-08 10:21:39 -06:00
Jack Christensen
58b05f567c
Add https://github.com/nikolayk812/pgx-outbox to README.md
...
fixes https://github.com/jackc/pgx/issues/2239
2025-01-25 08:59:52 -06:00
Jack Christensen
dcb7193669
Merge pull request #2236 from felix-roehrich/fr/fix-plan-scan
...
Alternative implementation for JSONCodec.PlanScan
2025-01-25 08:56:38 -06:00
Jack Christensen
1abf7d9050
Merge pull request #2240 from bonnefoa/fix-watch-panic
...
Unwatch and close connection on a batch write error
2025-01-25 08:38:33 -06:00
Jack Christensen
b5efc90a32
Merge pull request #2028 from jackc/enable-composite-tests-on-cockroachdb
...
Enable composite tests on cockroachdb
2025-01-25 08:22:32 -06:00
Jack Christensen
a26c93551f
Skip TestCompositeCodecTranscodeStructWrapperForTable
2025-01-25 08:15:40 -06:00
Jack Christensen
2100e1da46
Use latest version of CockroachDB for CI
2025-01-25 08:04:42 -06:00
Jack Christensen
2d21a2b80d
Merge pull request #2228 from jackc/fix-xml-decode-value
...
XMLCodec: fix DecodeValue to return a []byte
2025-01-25 07:24:30 -06:00
Jack Christensen
5f33ee5f07
Call out []byte in QueryExecModeSimpleProtocol documentation
...
https://github.com/jackc/pgx/issues/2231
2025-01-25 07:15:02 -06:00
Anthonin Bonnefoy
228cfffc20
Unwatch and close connection on a batch write error
...
Previously, a conn.Write would simply unlock pgconn, leaving the
connection as Idle and reusable while the multiResultReader would be
closed. From this state, calling multiResultReader.Close won't try to
receiveMessage and thus won't unwatch and close the connection since it
is already closed. This leaves the connection "open" and the next time
it's used, a "Watch already in progress" panic could be triggered.
This patch fixes the issue by unwatching and closing the connection on a
batch write error. The same was done on Sync.Encode error even if the
path is unreachable as Sync.Error never returns an error.
2025-01-24 08:49:07 +01:00
Felix Röhrich
a5353af354
rework JSONCodec.PlanScan
2025-01-22 22:35:35 +01:00
Jack Christensen
0bc29e3000
Merge pull request #2225 from logicbomb/improve-error-message
...
Include the field name in error messages when scanning structs
2025-01-18 10:41:13 -06:00
Jack Christensen
9cce05944a
Merge pull request #2216 from pconstantinou/master
...
Timestamp incorrectly adds 'Z' when serializing from JSON to indicate GMT, fixes bug #2215
2025-01-18 10:17:43 -06:00
Jason Turim
9c0ad690a9
Include the field name in error messages when scanning structs
2025-01-11 14:31:24 -05:00
Jack Christensen
03f08abda3
Fix in Unmarshal function rather than DecodeValue
...
This preserves backwards compatibility in the unlikely event someone is
using an alternative XML unmarshaler that does support unmarshalling
into *any.
2025-01-11 11:26:46 -06:00
Jack Christensen
2c1b1c389a
Merge pull request #2200 from zenkovev/flush_request_in_pipeline
...
add flush request in pipeline
2025-01-11 11:15:36 -06:00