3613 Commits

Author SHA1 Message Date
Chris Frank
9346d48035 fix OpenDBFromPool example 2024-01-13 09:39:16 -06:00
jeremy.spriet
1fdd17041a feat(pgproto3): expose MaxExpectedBodyLen and ActualBodyLen in ExceededMaxBodyLenErr struct 2024-01-12 18:21:07 -06:00
Jack Christensen
f654d61d79 Make note about possible parse config error message redaction change 2024-01-12 17:56:13 -06:00
Jack Christensen
5d26bbefd8 Make pgconn.ConnectError and pgconn.ParseConfigError public
fixes #1773
2024-01-12 17:52:25 -06:00
vahid-sohrabloo
44768b5a01 fix a typo in config_test.go
fix a typo in config_test.go
2024-01-12 17:36:43 -06:00
Jack Christensen
6f2ce92356 Upgrade golang.org/x/crypto to v0.17.0
pgx is unaffected by CVE-2023-48795 because it does not use SSH.
However, dependabot and other vulnerability scanners may complain so
bump the dependency anyway.
2023-12-29 18:14:09 -06:00
Tikhon Fedulov
4367ee0598 Update TestRowToStructByName with snake case support 2023-12-25 09:47:10 -06:00
Tikhon Fedulov
d2c9ebc2ef Use local variables in fieldPosByName and fix errors 2023-12-25 09:47:10 -06:00
Tikhon Fedulov
0c7acf9481 Add snake_case support to RowToStructByName 2023-12-25 09:47:10 -06:00
Jack Christensen
cbc5a7055f Fix: close conn on read failure in pipeline
Suggested by @jameshartig in https://github.com/jackc/pgx/issues/1847
2023-12-23 12:11:23 -06:00
James Hartig
4c14caae07 update description cache after exec prepare 2023-12-23 12:08:02 -06:00
James Hartig
22fe50149b pgconn: check if pipeline i closed in Sync/GetResults
Otherwise there will be a nil pointer exception accessing the conn
2023-12-23 12:04:21 -06:00
Ryan Fowler
dfd198003a Fix panic in Pipeline when PgConn is busy or closed 2023-12-23 10:30:59 -06:00
jeremy.spriet
603c8c1e90 feat(pgproto3/backend): add a SetMaxBodyLen to limit the max body length for the receive 2023-12-23 10:25:35 -06:00
Samuel Stauffer
9ab9e3c40b Unwrap errors in normalizeTimeoutError 2023-12-16 11:15:35 -06:00
Samuel Stauffer
2daeb8dc5f pgconn: normalize starTLS connection error
Normalize the error that is returned by startTLS in pgconn.connect. This
makes it possible to determine if the error was a context error.
2023-12-16 11:15:35 -06:00
Jack Christensen
df3c5f4df8 Use "Pg" instead of "PG" in new PgError related identifiers
Arguably, PGError might have been better. But since the precedent is
long since established it is better to be consistent.
2023-12-15 18:33:51 -06:00
James Hartig
b1631e8e35 pgconn: add OnPGError to Config for error handling
OnPGError is called on every error response received from Postgres and can
be used to close connections on specific errors. Defaults to closing on
FATAL-severity errors.

Fixes #1803
2023-12-15 18:29:32 -06:00
Jack Christensen
ba05097642 Release v5.5.1 v5.5.1 2023-12-09 12:59:44 -06:00
Evan Jones
384fe7775c Batch.Queue: document always uses the conn's DefaultQueryExecMode
The only way to change the query mode used by Batch.Queue and
SendBatch is to use a connection with a different
DefaultQueryExecMode. Add this to the function documentation.

Conn.SendBatch: Move where mode is defined to make this clearer in
the code. I spent time looking for the option that does not exist.
2023-12-09 11:47:56 -06:00
Eshton Robateau
20bf953a17 pull out changes into new public function 2023-12-09 11:20:14 -06:00
Eshton Robateau
12582a0fd4 bitsize largest option is 64 2023-12-09 11:20:14 -06:00
Eshton Robateau
905f252667 uncomment tests 2023-12-09 11:20:14 -06:00
Eshton Robateau
9927e14bbf remove dead line 2023-12-09 11:20:14 -06:00
Eshton Robateau
95b2f85e60 support scientific notation big floats 2023-12-09 11:20:14 -06:00
Jack Christensen
913e4c8487 Update changelog 2023-12-02 09:36:03 -06:00
Jack Christensen
31321c2017 Add race detector to bug report template 2023-12-02 09:27:57 -06:00
maksymnevajdev
319c3172f2 fix panic in prepared sql 2023-12-01 18:34:41 -06:00
Simon Paredes
4678e69599 fix error message to print the unexpected rune 2023-12-01 18:23:23 -06:00
Simon Paredes
89d699c2e8 wrap errors instead of just formatting them 2023-12-01 18:23:23 -06:00
Jacopo
7ebced92b5 Fix issue with order of json encoding #1805 2023-11-24 19:01:48 -06:00
Sam Whited
94e56e61ba Fix usage of logger in stdlib docs
The documentation previously showed the old way of logging and not the
newer tracer adapter. This patch updates the example to build correctly
with pgx/v5.

Signed-off-by: Sam Whited <sam@samwhited.com>
2023-11-22 08:15:05 -06:00
Jack Christensen
9103457384 Improve docs 2023-11-18 07:44:24 -06:00
Jack Christensen
9782306287 Only remove statement from map if deallocate succeeds
https://github.com/jackc/pgx/pull/1795
2023-11-18 07:44:24 -06:00
Jack Christensen
7d5a3969d0 Improve docs and tests 2023-11-18 07:44:24 -06:00
Jack Christensen
e5015e2fac pgx.Conn.Deallocate uses PgConn.Deallocate
This uses the PostgreSQL protocol to deallocate a prepared statement
instead of a SQL statement. This allows it to work even in an aborted
transaction.
2023-11-18 07:44:24 -06:00
Jack Christensen
4dbd57a7ed Add PgConn.Deallocate method
This method uses the PostgreSQL protocol Close method to deallocate a
prepared statement. This means that it can succeed in an aborted
transaction.
2023-11-18 07:44:24 -06:00
Jack Christensen
0570b0e196 Better document PgConn.Prepare implementation 2023-11-18 07:44:24 -06:00
Jack Christensen
df5d00eb60 Remove PostgreSQL 11 from supported versions 2023-11-11 10:09:47 -06:00
robford
d38dd85756 Allowed nxtf to signal end of data by returning nil,nil
Added some test
Improved documentation
2023-11-11 10:06:58 -06:00
robford
9b6d3809d6 added tests 2023-11-11 10:06:58 -06:00
robford
b4d72d4fce copyFromFunc 2023-11-11 10:06:58 -06:00
robford
ccdd85a5eb added ChopyFromCh 2023-11-11 10:06:58 -06:00
Jack Christensen
96f5f9cd95 Release v5.5.0 v5.5.0 2023-11-04 10:27:32 -05:00
Kirill Mironov
d3fb6e00da implement json.Marshaler and json.Unmarshaler for Float4, Float8 2023-11-04 10:25:31 -05:00
Jack Christensen
cf6ef75f91 stdlib: Use Ping instead of CheckConn in ResetSession
CheckConn is deprecated. It doesn't detect all network outages. It
causes a 1ms delay while it tries to read the connection. Ping incurs a
round trip but that means it is a much stronger guarantee that the
connection is usable. In addition, if the application and the database
are on the same network it will actually be faster as round trip times
are typically a few hundred microseconds.
2023-10-26 20:41:44 -05:00
Jack Christensen
7a4bb7edb5
Add link to pgx presentation to README.md 2023-10-20 18:49:41 -05:00
Ivan Posazhennikov
6f7400f428 fix typo in the comment in the pgconn.go 2023-10-14 18:02:35 -05:00
Anton Levakin
304697de36 CancelRequest: Wait for the cancel request to be acknowledged by the server 2023-10-14 17:48:16 -05:00
Anton Levakin
5d0f904831 update TestConnContextCanceledCancelsRunningQueryOnServer
Check cancellation of the request for pgbouncer
2023-10-14 17:48:16 -05:00