63 Commits

Author SHA1 Message Date
Yuli Khodorkovskiy
1213b69774 Add support to ErrorResponse for unlocalized severity
Add missing 'V' field for unlocalized severity added in PG versions 9.6
and greater. See https://www.postgresql.org/docs/current/protocol-error-fields.html
2020-12-28 10:22:55 -06:00
Roman Tkachenko
88b6398594 Add CopyData and CopyDone messages support to Backend 2020-11-17 16:57:05 -06:00
Jack Christensen
c34a8731b6 Data row value slices need to be capacity limited
Otherwise, appending to a slice that came from a data row could
overwrite adjacent memory.
2020-11-03 19:15:07 -06:00
Jack Christensen
835cf1b068 Fix: Bind.MarshalJSON when ParameterFormatCodes is nil or single element
refs #10
2020-09-17 17:03:30 -05:00
Jack Christensen
fede0ce5d6 Document that received messages are only valid until the next receive. 2020-09-05 11:30:23 -05:00
Yuli Khodorkovskiy
08088ecf9a Fix notification response
Notification response was missing the PID in the Encode function
2020-08-31 17:09:20 -05:00
Jack Christensen
6677e2430f
Merge pull request #4 from yulicrunchy/fix-malformed-sasl
Fix malformed SASL messages
2020-08-28 16:49:24 -05:00
Jack Christensen
5847a2671a
Merge pull request #3 from yulicrunchy/gss
Add missing GSSEncRequest
2020-08-28 16:48:40 -05:00
Jack Christensen
72288731fc
Merge pull request #8 from mjibson/patch-1
mark CopyDone as frontend too
2020-08-01 05:46:49 -05:00
Matt Jibson
2799a6e9a6
mark CopyDone as frontend too 2020-07-31 16:13:23 -06:00
Jack Christensen
3443d78a73
Merge pull request #7 from mjibson/patch-1
correctly encode CopyInResponse's format field
2020-07-31 17:02:15 -05:00
Matt Jibson
6d0b4c45e4
correctly encode CopyInResponse's format field 2020-07-31 15:42:06 -06:00
Jack Christensen
7746f223e0
Merge pull request #1 from felixge/fix-auth-md5
fix: AuthenticationMD5Password AuthType
2020-05-18 08:52:34 -05:00
Jack Christensen
595780be0f Map io.EOF errors to io.ErrUnexpectedEOF
io.EOF is never expected during valid usage. In addition, database/sql
uses io.EOF as a sentinal value that all rows from a query have been
received.

See https://github.com/jackc/pgx/issues/662.
2020-01-17 16:55:05 -06:00
Yuli Khodorkovskiy
1c20e7d36e Fix malformed SASL messages
Per the PG documentation [0], an AuthenticationSASLContinue message has:

    AuthenticationSASLContinue (B)
	Byte1('R')
	    Identifies the message as an authentication request.
	Int32
	    Length of message contents in bytes, including self.
	Int32(11)
	    Specifies that this message contains a SASL challenge.
	Byten
	    SASL data, specific to the SASL mechanism being used.

The current implementation was mistakenly adding the lengh of msg bytes
in between the Int32(11) and Byten. There was a similar issue for
AuthenticationSASLFinal.

[0] https://www.postgresql.org/docs/current/protocol-message-formats.html
2019-12-17 20:28:01 -05:00
Yuli Khodorkovskiy
e6b823d649 Add missing GSSEncRequest 2019-12-17 20:21:57 -05:00
Felix Geisendörfer
a90ef7ed5b fix: AuthenticationMD5Password AuthType 2019-09-08 17:29:06 +02:00
Jack Christensen
eca1e51822 Add more pgfortune output 2019-09-07 11:41:31 -05:00
Jack Christensen
80f2cbce25 Add pgfortune example 2019-09-07 11:37:43 -05:00
Jack Christensen
4c03ce451f Add MarshalJSON for FieldDescription 2019-08-31 16:00:41 -05:00
Jack Christensen
0d1ceed7a6 Refactor authentication message handling 2019-08-31 15:43:07 -05:00
Jack Christensen
439ea11d47 NewFrontend and NewBackend cannot fail 2019-08-31 14:49:55 -05:00
Jack Christensen
2bc8f2e6af Remove pkg/errors package 2019-08-31 11:53:26 -05:00
Jack Christensen
1ba5dcbe01 Support SSLRequest and CancelRequest 2019-08-31 11:48:01 -05:00
Jack Christensen
76538434cf MarshalJSON should be defined on T not *T
Otherwise "%v" format would be used by json.Marshal(T).
2019-08-27 21:13:45 -05:00
Jack Christensen
432c2951c7 Add a lot of documentation 2019-06-08 19:38:34 -05:00
Jack Christensen
bf3a27ae3f Update to github.com/jackc/chunkreader/v2 2019-06-08 18:34:35 -05:00
Jack Christensen
18e7e777be Import PortalSuspended from pgx v3
0ab6f80f9929384a8cf6cfc299b43233534eb705
2019-06-08 10:26:26 -05:00
Jack Christensen
a340d5f15f CopyFail should be frontend message 2019-05-17 13:27:11 -05:00
Jack Christensen
4acc0f54c6 Import fixes from pgx/pgproto3
Import and adapt commit: fbb8cce
2019-05-03 14:07:55 -05:00
Jack Christensen
c116219b62 Update tests to use v2 2019-04-20 13:01:11 -05:00
Jack Christensen
9b6a681f50 Update go.mod version 2019-04-18 23:15:44 -05:00
Jack Christensen
76e904a5a4 CommandComplete.CommandTag is now []byte
Avoid allocation
2019-04-18 23:12:18 -05:00
Jack Christensen
8d43b38287 RowDescription.Name is now []byte
Avoid allocation
2019-04-18 23:12:00 -05:00
Jack Christensen
2acb7b6d4e Reduce mallocs in RowDescription.Decode 2019-04-18 22:33:11 -05:00
Jack Christensen
b2a540ca81 Add sufficient support for SCRAM 2019-04-16 20:30:55 -05:00
Jack Christensen
97a0ac4ddc Clarify ChunkReader.Next contract 2019-03-30 12:52:55 -05:00
Jack Christensen
bb06e6b3ff Decouple github.com/jackc/chunkreader 2019-03-30 12:46:56 -05:00
Jack Christensen
127e997696 Add travis CI 2019-03-30 12:33:04 -05:00
Jack Christensen
b9d0da5558 Add readme, license, and docs 2019-03-30 12:32:39 -05:00
Jack Christensen
16176b5151 Add go module support 2019-03-30 12:26:24 -05:00
Jack Christensen
440fbf1581 Include missed changes 2019-01-26 12:21:54 -06:00
Jack Christensen
38671ea106 Properly abort CopyFrom on reader error 2019-01-26 10:21:16 -06:00
Josh Leverette
66af2227c0 Fix encoding of ErrorResponse 2019-01-19 11:42:30 -06:00
Jack Christensen
a24d764440 Back out of some over optimization 2019-01-02 18:16:08 -06:00
Jack Christensen
7bd9b776cd Remove another allocation 2019-01-01 13:52:04 -06:00
Jack Christensen
f225b3d4a1 Avoid allocating strings in common message types 2019-01-01 13:47:37 -06:00
Jack Christensen
64b1ecf96f Type modifier should be int32 not uint32 2018-09-22 07:43:18 -05:00
Murat Kabilov
5f39bbaf35 Add *Conn. CopyFromTextual, CopyToTextual, which use textual format for copying data 2018-07-31 08:57:53 +02:00
Jack Christensen
b3d0cbd0e6 Fix reading interrupted messages
When an message is received and a timeout occurs after reading the
header but before reading the entire body the connection state could
be corrupted due to the header being consumed. The next read would
consider the body of the previous message as the header for the next.

fixes #348
2017-12-16 13:45:22 -06:00