Commit Graph

1309 Commits (1257b89df7875d74f83c5eab4047b8f6598c1334)

Author SHA1 Message Date
Jack Christensen fd7b776540 Merge pull request #323 from kelseyfrancis/namespace-oids
Prefix types in namespaces other than pg_catalog or public
2017-09-14 13:59:51 -05:00
Kelsey Francis 953e08df99 Prefix types in namespaces other than pg_catalog or public
It's possible to define a type (e.g., an enum) with the same name in two
different schemas. When initializing data types after connecting, types
defined within schemas other than pg_catalog or public should be
qualified with their schema name to disambiguate them and ensure all
types with the same base name get added to the map of OID to type.

Prior to this commit, the last type scanned would "win", and all others
with the same name would be missing from the ConnInfo type maps, which
would subsequently cause any PREPARE involving columns of those missing
types to return the error "unknown oid".
2017-09-11 11:29:42 -07:00
Jack Christensen 3e49ad8dec Merge branch 'johanbrandhorst-patch-1' 2017-09-09 11:06:16 -05:00
Jack Christensen 9eb21591ee Update sslmode docs 2017-09-09 11:05:39 -05:00
Jack Christensen a1e4d17e58 Fix sslmode require test 2017-09-09 11:05:27 -05:00
Johan Brandhorst 30fa7cc37f Skip certificate verification for sslmode "require"
This more appropriately aligns the behaviour of the library with
that advertised by the postgres documentation.

According to the table on the official documentation page
https://www.postgresql.org/docs/current/static/libpq-ssl.html,
the "require" mode should be used when:

"I want my data to be encrypted, and I accept the overhead. I trust that the network will make sure I always connect to the server I want."

This maps reasonably well to a TLS config that skips certificate verification.
2017-09-08 20:44:10 +01:00
Jack Christensen b70fb1c7cf Merge pull request #318 from kelseyfrancis/zap-logger-adapter
Add zap log adapter
2017-09-08 09:16:17 -05:00
Jack Christensen 6047f4a56e Merge pull request #317 from miktwon/master
Fix doc: Import stdlib
2017-09-08 08:52:56 -05:00
Kelsey Francis 8cb78d376a Add zap log adapter 2017-09-07 11:07:55 -07:00
miktwon 9fafa4ebf3 Fix doc: Import stdlib 2017-09-07 11:48:56 +03:00
Jack Christensen 9c8ef1acdd Fix pgtype types that can Set database/sql/driver.driver.Valuer
Bug was chooseParameterFormatCode would see that type could handle
binary format so binary format would be chosen. But
encodePreparedStatementArgument would see driver.Valuer first and
would encode with that -- which is text mode. So the server would
receive a text format value when expecting a binary format value.

Discovered while investigating #316
2017-09-01 16:00:47 -05:00
Jack Christensen e2695be13b Update examples to use PG envvars 2017-09-01 14:25:03 -05:00
Jack Christensen d0d4002ecf Merge pull request #315 from kelseyfrancis/fix-query-row-nil-return-value
Always return non-nil *Rows from Query to fix QueryRow
2017-08-31 14:00:19 -05:00
Kelsey Francis fc18cc8d76 Always return non-nil *Rows from Query to fix QueryRow
Since QueryRow delegates to Query, it needs Query to always return
non-nil *Rows to prevent a nil pointer deference when the QueryRow
caller calls Scan(). This commit fixes the few returns in QueryEx that
return nil on errors rather than *Rows with its err field set.
2017-08-31 11:37:20 -07:00
Jack Christensen 47c0e9cbac Fix decoding row with same type values
Row decoding was reusing and returning connection owned values for
decoding. Instead allocate new value each time.

fixes #313
2017-08-29 15:38:45 -05:00
Jack Christensen ef9e5159bf Merge branch 'MaerF0x0-master' 2017-08-29 14:54:20 -05:00
Jack Christensen 23c3724fb3 Fix comment on ErrClosedPool 2017-08-29 14:53:31 -05:00
Jack Christensen 8a4681db4a Merge branch 'master' of https://github.com/MaerF0x0/pgx into MaerF0x0-master 2017-08-29 14:53:07 -05:00
Jack Christensen a669dfccfc Merge pull request #311 from kelseyfrancis/fix-one-round-trip-exec-bug
Fix some invalid one round trip execs failing to return non-nil error
2017-08-29 14:49:39 -05:00
Jack Christensen 016888130a Merge branch 'kelseyfrancis-uuid-array' 2017-08-29 14:34:38 -05:00
Jack Christensen 4e26b04d6e Generate UUIDArray from template
- Fix error in Set
- Specifically handle untyped nil
2017-08-29 14:33:25 -05:00
Mike Graf 30896744c8 Return ErrClosedPool when Acquire() with closed pool 2017-08-28 22:30:42 -07:00
Kelsey Francis ea740fb316 Fix some invalid one round trip execs failing to return non-nil error
Prior to this commit, execEx() would write the one round trip exec to
the connection before first calling ensureConnectionReadyForQuery, which
ultimately caused any errors to be suppressed if the exec followed a
valid query, because the receive message processing would finish
successfully as soon as it received the ReadyForQuery that actually
belonged to the preceding query. So, the exec would never actually
receive the error message that it caused, leaving it to be incorrectly
received by the first subsequent query sent.
2017-08-28 18:51:35 -07:00
Kelsey Francis 1e36edf4b0 Add UUIDArray type
Also change UUID.Set() to convert nil to NULL in order for
UUIDArray.Set() to support converting [][]byte slices that contain nil.
2017-08-27 19:36:53 -07:00
Jack Christensen f65776f084 Fix typo 2017-08-25 13:31:50 -05:00
Jack Christensen 5e91defb41 Merge pull request #306 from cyberdelia/rows
Add more ColumnType support
2017-08-22 14:21:47 -05:00
Timothée Peignier 0f84f73c7b
Add more ColumnType support 2017-08-18 18:22:08 -07:00
Jack Christensen 90ee7b66c1 Add QueryEx, QueryRowEx, ExecEx, and RollbackEx to Tx
fixes #303
2017-08-18 14:17:53 -05:00
Jack Christensen 5c21d65b46 Merge pull request #304 from crvv/master
Fix numeric EncodeBinary bug
2017-08-18 13:56:59 -05:00
Jack Christensen 8574e2caed Merge pull request #305 from dvic/logrus-fix
fix logrus updated package name (lowercase)
2017-08-18 13:38:51 -05:00
Damir Vandic 8afa1fd332 fix logrus updated package name (lowercase)
See https://github.com/sirupsen/logrus/issues/570#issuecomment-313933276
2017-08-18 13:46:49 +02:00
Wei Congrui ce654ad1e1 Fix numeric EncodeBinary bug 2017-08-18 15:20:39 +08:00
Jack Christensen 83f4d76e68 Merge pull request #301 from meowgorithm/patch-1
Add missing period in documentation
2017-08-15 16:59:13 -05:00
Christian Rocha d1cfcd9913 Add missing period in documentation 2017-08-14 09:41:22 -04:00
Jack Christensen 66918e80df Release 3.0.1 2017-08-12 17:45:57 -05:00
Jack Christensen 4d0f8f041b Fix pid logging
fixes #300
2017-08-12 17:43:54 -05:00
Jack Christensen d2a8d4ddca Return error on MarshalJSON of status Undefined
Previously "undefined" was returned as a value. While this is a
valid JavaScript value, it is not valid JSON.
2017-08-12 16:40:18 -05:00
Jack Christensen d49a78dd73 Fix compilation on 32-bit platform
fixes #295
2017-08-03 14:17:28 -05:00
Jack Christensen 511b90478f Add Travis CI badge 2017-07-28 15:11:09 -05:00
Jack Christensen e00b151dbc Add source code example 2017-07-28 15:09:56 -05:00
Jack Christensen a1241d4aa9 Fix typo 2017-07-24 18:10:36 -05:00
Jack Christensen 69494780a8 Update changelog for v3 2017-07-24 08:53:57 -05:00
Jack Christensen f79e52f1ee Make v3 main release 2017-07-24 08:51:34 -05:00
Jack Christensen 534ea4a9cb Update README for v3 release 2017-07-24 08:04:01 -05:00
Jack Christensen a147e0f3b8 Fix test on Travis 2017-07-22 08:41:13 -05:00
Jack Christensen 2e5f5e0c9d More README tweaks 2017-07-21 16:35:54 -05:00
Jack Christensen 79517aaa0e Fix batch query with query syntax error 2017-07-21 15:22:32 -05:00
Jack Christensen dde965bc9d README updates 2017-07-21 14:19:45 -05:00
Jack Christensen 88c7dd8da2 Fix typo in changelog 2017-07-21 14:12:19 -05:00
Jack Christensen 05509e1f6f Remove unused files 2017-07-21 14:10:33 -05:00