2734 Commits

Author SHA1 Message Date
Jack Christensen
120139a206 Add link to PG docs for connString format
fixes #62
2021-01-14 18:22:21 -06:00
Stephane Martin
6830cc0984 Fix: also consider \r, \f, \t as whitespace (jackc/pgtype#86) 2021-01-14 18:10:48 -06:00
Stephane Martin
59b79a2e49 Fix: escaped strings when they start or end with a newline char (jackc/pgtype#86) 2021-01-14 18:10:48 -06:00
Vasilii Novikov
1e141d8c32 Add tsrange array type. 2021-01-09 09:40:43 -06:00
Moshe Katz
724bf94515 use proper pgpass location on Windows 2021-01-09 09:36:36 -06:00
Robert Froehlich
210a217818 Add BeforeConnect callback to pgxpool.Config.
This allows for connection settings to be updated without having to create
a new pool. The callback is passed a copy of the pgx.ConnConfig and will
not impact existing live connections.
2021-01-02 15:08:59 -08:00
Jack Christensen
b23d41c399 Add CI badge 2020-12-28 13:11:36 -06:00
Jack Christensen
6e11216708 Yet another CI tweak 2020-12-28 13:02:34 -06:00
Jack Christensen
be67555d02 Another CI tweak 2020-12-28 12:56:41 -06:00
Jack Christensen
e2115310b7 More CI 2020-12-28 12:50:42 -06:00
Jack Christensen
ea92194719 Add PostgreSQL service to CI 2020-12-28 12:35:01 -06:00
Jack Christensen
97f8f6a25a
Begin CI with Github Actions 2020-12-28 12:22:56 -06:00
Jack Christensen
e276d9b832 Add more documentation to TxStatus 2020-12-23 12:21:34 -06:00
Jack Christensen
b77cee2a28 Fix scanning int into **sql.Scanner implementor
See https://github.com/jackc/pgx/issues/897.
2020-12-23 11:17:02 -06:00
Musbah Sinno
b664891853 Updated CopyFromSlice example in doc.go
The example had a syntax error and didn't explain what user was to begin with. Fixed it.
2020-12-23 10:42:48 -06:00
Jack Christensen
fc4d50f6c2 Release v4.10.1 v4.10.1 2020-12-19 10:18:49 -06:00
Jack Christensen
9b0e57c4a9 Fix panic on query error with nil stmtcache
fixes #895
2020-12-19 10:17:41 -06:00
Jack Christensen
e8f959e0e1 Add QueryFunc
refs #821
2020-12-12 09:39:58 -06:00
Jack Christensen
0cbbf55dde Fix typo 2020-12-12 08:28:55 -06:00
ip.novikov
e0d22c1100 improve regexp
get shortest sequence between : and @
2020-12-05 22:11:52 +03:00
ip.novikov
a581247a12 Add check for url with broken password
replace broken password in parseConfigError message
2020-12-05 15:28:01 +03:00
Jack Christensen
e14638e125 Release v4.10.0 v4.10.0 2020-12-03 19:50:07 -06:00
Jack Christensen
8c7667376e Update dependencies 2020-12-03 19:43:27 -06:00
Jack Christensen
82bac82213 stdlib: consider any Ping failure as fatal
refs #672
2020-12-03 19:41:03 -06:00
Jack Christensen
880863b70a Release v1.6.2 2020-12-03 19:20:11 -06:00
Jack Christensen
7a47d60bbd Update missing changelog entries for v1.6.0 and v1.6.1 2020-12-03 19:18:40 -06:00
Jack Christensen
3742d6209e Release v1.8.0 2020-12-03 19:12:18 -06:00
Jack Christensen
0a2b67c5c5 CopyFromSlice should remember error 2020-12-02 09:32:01 -06:00
Egon Elbre
e23c5bec24 add pgx.CopyFromSlice
Using CopyFromRows can often be inconvenient to use, because you would
need to convert a typed array to an [][]interface{}. Similarly,
implementing a custom CopyFromSource is too verbose for one-off things.

Add CopyFromSlice that allows to more easily convert a slice to a
CopyFromSource. Example:

    copyCount, err := conn.CopyFrom(
        context.Background(),
        pgx.Identifier{"people"},
        []string{"first_name", "last_name", "age"},
        pgx.CopyFromSlice(len(rows), func(i int) ([]interface{}, error) {
            return []interface{user.FirstName, user.LastName, user.Age}, nil
        }),
    )
2020-12-02 11:16:36 +02:00
Jack Christensen
00d516f5c4 Fix panic on assigning empty array to non-slice or array
See https://github.com/jackc/pgx/issues/881
2020-11-27 11:56:21 -06:00
Ethan Pailes
1df45d758d fix stmtcache invalidation
This patch fixes jackc/pgx#841. The meat of the fix lives
in [a PR to the pgconn repo][1]. This change just checks
for errors after executing a prepared statement and informs
the underlying stmtcache about them so that it can properly
clean up. We don't try to get fancy with retries or anything
like that, just return the error and allow the application to handle it.

I had to make [some][1] [changes][2] to to the jackc/pgconn package as well
as this package.

Fixes #841

[1]: https://github.com/jackc/pgconn/pull/56
[2]: https://github.com/jackc/pgconn/pull/55
2020-11-12 08:15:13 -05:00
Jack Christensen
cba610c245 StatementErrored does not need context nor return an error 2020-11-11 15:52:59 -06:00
Jack Christensen
426124b32f Add stmtcache.LRU test thjat integrates over the database 2020-11-11 15:48:49 -06:00
Ethan Pailes
a885de9c94 stmtcache: add new StatementErrored method
This patch adds a new StatementErrored method to the stmtcache.
This routine MUST be called by users of the cache whenever the
execution of a statement results in an error. This will allow
the cache to make an intelligent decision about whether or not
the statement needs to be purged from the cache.
2020-11-11 11:18:21 -05:00
Jack Christensen
93c6b60429 Explicityly state pgxpool's concurrency-safety
refs #866
2020-11-09 17:01:51 -06:00
Jack Christensen
740b3a5115 Fix: Text array parsing disambiguates NULL and "NULL".
This solution is a little awkward, but it avoids breaking backwards
compatibility.

fixes #78
2020-11-07 07:41:49 -06:00
Jack Christensen
eeaa26abee Release v4.9.2 v4.9.2 2020-11-03 19:24:54 -06:00
Jack Christensen
d660c48ffc Upgrade pgconn to 1.7.2 to fix slice capacity issue
fixes #859
2020-11-03 19:23:01 -06:00
Jack Christensen
b82b993fa8 Release v1.7.2 2020-11-03 19:20:03 -06:00
Jack Christensen
0f17ba2cf3 Fix unconstrained data value slices
See https://github.com/jackc/pgx/issues/859
2020-11-03 19:17:52 -06:00
Jack Christensen
36a8da55cc Fix Timestamptz.DecodeText with too short text
fixes #74
2020-11-03 08:31:05 -06:00
Jack Christensen
9898beaa2d Release v4.9.1 v4.9.1 2020-10-31 17:36:36 -05:00
Jack Christensen
59a40dbf84 Upgrade pgconn and pgtype 2020-10-31 17:30:27 -05:00
Jack Christensen
af0ca3a39b Fix simple protocol empty array and original recursive empty array issue
Original issue https://github.com/jackc/pgtype/issues/68

This crash occurred in the recursive assignment system used to support
multidimensional arrays.

This was fixed in 9639a69d451f55456f598c1aa8b93053f8df3088. However,
that fix incorrectly used nil instead of an empty slice.

In hindsight, it appears the fundamental error is that an assignment to
a slice of a type that is not specified is handled with the recursive /
reflection path. Or another way of looking at it is as an unexpected
feature where []T can now be scanned if individual elements are
assignable to T even if []T is not specifically handled.

But this new reflection / recursive path did not handle empty arrays.

This fix handles the reflection path for an empty slice by allocating an
empty slice.
2020-10-31 17:12:16 -05:00
Jack Christensen
9c2888b49e Release v1.7.1 2020-10-31 16:25:01 -05:00
Jack Christensen
340bfece2c Do not asyncClose in response to a FATAL PG error
This will reduce spurious server log messages on authentication
failures. See https://github.com/jackc/pgconn/pull/53.
2020-10-29 21:20:28 -05:00
Feike Steenbergen
f3f5b70a87 Ensure the example code snippet compiles again
There were 2 errors when using the example code:

- not enough arguments in call to pgConn.Close
- no new variables on left side of :=

With these changes, the example works again.
2020-10-29 20:49:03 -05:00
Jack Christensen
7c47415150 Fix SendBatch of all prepared statements with statement cache disabled
fixes #856
2020-10-29 20:28:57 -05:00
Jack Christensen
9d7fc8e63a AssignTo pointer to pointer to slice and named types
fixes #69
2020-10-24 09:21:42 -05:00
Simo Haasanen
9639a69d45 Adds checks for zero length arrays.
Assigning values from nil or zero length elements or dimensions now return immediately as there are no values to assign.
2020-10-20 19:52:05 +01:00