346 Commits

Author SHA1 Message Date
Jack Christensen
4380e23ae1 CompositeTextScanner handles backslash escapes
fixes https://github.com/jackc/pgx/issues/874
2021-04-24 08:08:34 -05:00
Jack Christensen
4a3a424dff Release v1.7.0 2021-03-25 09:16:43 -04:00
Jack Christensen
63e2dbefaf Update copyright date 2021-03-25 09:08:27 -04:00
Jack Christensen
dd160540c4 Use Go 1.13 errors instead of xerrors 2021-03-25 09:08:27 -04:00
drewdogg
aa89720576 go 1.13 2021-03-13 07:23:29 -06:00
Jack Christensen
0f1bda20b0 Fix numeric NaN support
fixes #93
2021-03-11 19:49:03 -06:00
Jack Christensen
abeb337246 Accept nil *time.Time in Time.Set 2021-02-20 09:28:14 -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
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
b77cee2a28 Fix scanning int into **sql.Scanner implementor
See https://github.com/jackc/pgx/issues/897.
2020-12-23 11:17:02 -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
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
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
36a8da55cc Fix Timestamptz.DecodeText with too short text
fixes #74
2020-11-03 08:31:05 -06: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
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
Tomas Volf
e92478ec70
Fix Inet.Set to handle nil net.IP correctly
When nil IP is returned from net.ParseIP, it is accepted into Inet type,
but not properly marked as being Null. That introduces issues later on
when calling for example EncodeBinary, since it does not assume this can
happen.

This commit resolves that by properly detecting zero-length net.IP and
setting status to Null if that is the case.
2020-10-13 15:26:09 +02:00
duohedron
2bc8c67e4a Fix misleading names parseString and parseFloat64 in polygon.go 2020-10-08 07:59:44 -05:00
duohedron
b55f972f49 Add comment to Polygon.Set() 2020-10-08 07:59:44 -05:00
duohedron
8aa7211df5 Add tests to Polygon 2020-10-08 07:59:44 -05:00
duohedron
6166c99b77 Add Undefined status to invalid Polygon 2020-10-08 07:59:44 -05:00
duohedron
e09987f1d6 Add tests to Polygon 2020-10-08 07:59:44 -05:00
duohedron
2dca42ee7d Add Set(string|[]Vec2|[]float64) to Polygon 2020-10-08 07:59:44 -05:00
Erik Agsjö
66c36ff24f Support setting infinite timestamps 2020-10-08 07:58:57 -05:00
Jack Christensen
376361f53d Add tests for Int(2|4|8).Set accepting float(32|64) 2020-10-03 08:36:40 -05:00
lqu3j
909d814f65 support float64, float32 convert to int2, int4, int8 2020-09-29 13:10:38 +08:00
Jack Christensen
116eba4401 Release v1.5.0 2020-09-26 11:48:37 -05:00
Bekmamat
d7f92427ad fixed marshaling and unmarshaling 2020-09-22 08:18:39 -05:00
Jack Christensen
fbe354aea1 Remove editor specific .gitignore 2020-09-15 17:21:13 -05:00
bakmataliev
6777e0294b eliminate regex dep 2020-09-15 13:24:17 +03:00
bakmataliev
cd9b888ff6 Remove unnecessary check for null 2020-09-11 16:28:49 +03:00
bakmataliev
d540ca39be New marshalers have been added 2020-09-11 16:24:48 +03:00
Jack Christensen
e7d2b057a7 Text formatted values except bytea can be directly scanned to []byte
This significantly improves performance of scanning text to []byte as it
avoids multiple allocations and copies.
2020-09-05 11:13:53 -05:00
Jack Christensen
9da6afcad7 Fix selecting empty array
Failing test was in pgx: TestReadingValueAfterEmptyArray
2020-09-05 10:56:22 -05:00
Jack Christensen
79b05217d1 Fix JSONBArray to have elements of JSONB 2020-09-04 18:41:34 -05:00
Simo Haasanen
ec14212d30 Add comments to explain the use of reflection after type assertion.
Removes one local variable, which is used twice only in an error.
2020-08-09 09:17:40 +01:00
Simo Haasanen
b90570feb5 Restored more optimised array type conversions for a few select 1D-slice types.
Results of calls to the reflect lib are now stored as local variables for small performance gains.
2020-08-08 19:51:37 +01:00
Simo Haasanen
449a8a4f8e Add multidimensional array and slice support.
Adds array support - previously only slices were supported.
Adds new test cases for multidimensional arrays and slices.
All previous test cases are unmodified and passed (fully backwards compatible).
Removes hard-coded type conversions for arrays, instead now relies on the type support of the array element's type conversion support.
Less maintenance for arrays, new type conversions are automatically supported when array's element gains new type support.
Simplifies typed_array_gen.sh generator script by removing the hard-coded single-dimensional types for arrays.
Only typed_array.go.erb and typed_array_gen.sh have been changed + 1 new auxiliary function in array.go file + additional tests in test files for each array. Other changes are from generated code.
2020-08-07 13:10:32 +01:00
Jack Christensen
d831ba712a Release v1.4.2 2020-07-22 06:46:27 -05:00
Jack Christensen
7673c8578d Update changelog 2020-07-22 06:45:10 -05:00
Yaz Saito
b939bc8d68 Fix encoding of a large composite data type
If encoding a field caused a buffer reallocation, the its length would be
written to a wrong place.
2020-07-21 23:52:20 -07:00