pgsql: Fix typo in commit 82fa3ff8672.

2019-09-19 Thread Amit Kapila
Fix typo in commit 82fa3ff8672.

Reported-By: Kuntal Ghosh (off-list)
Backpatch-through: 9.4, like 82fa3ff8672

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/c53e40a132dca2ea8db73ce705a9019197ec338b

Modified Files
--
doc/src/sgml/maintenance.sgml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Fix typo in commit 82fa3ff8672.

2019-09-19 Thread Amit Kapila
Fix typo in commit 82fa3ff8672.

Reported-By: Kuntal Ghosh (off-list)
Backpatch-through: 9.4, like 82fa3ff8672

Branch
--
REL_10_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/fea48c57b86584760a1e92bb773e082b7171d231

Modified Files
--
doc/src/sgml/maintenance.sgml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Fix typo in commit 82fa3ff8672.

2019-09-19 Thread Amit Kapila
Fix typo in commit 82fa3ff8672.

Reported-By: Kuntal Ghosh (off-list)
Backpatch-through: 9.4, like 82fa3ff8672

Branch
--
REL9_6_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/bad51c723e8f342883e047b3845fa177a48111d1

Modified Files
--
doc/src/sgml/maintenance.sgml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Fix typo in commit 82fa3ff8672.

2019-09-19 Thread Amit Kapila
Fix typo in commit 82fa3ff8672.

Reported-By: Kuntal Ghosh (off-list)
Backpatch-through: 9.4, like 82fa3ff8672

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/2a98eefc1a15dc32e816ced86d1fd768fefb54b0

Modified Files
--
doc/src/sgml/maintenance.sgml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Fix typo in commit 82fa3ff8672.

2019-09-19 Thread Amit Kapila
Fix typo in commit 82fa3ff8672.

Reported-By: Kuntal Ghosh (off-list)
Backpatch-through: 9.4, like 82fa3ff8672

Branch
--
REL9_4_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/c16eb2d530b7c2987a948c7ed070ad607f58ff43

Modified Files
--
doc/src/sgml/maintenance.sgml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Fix typo in commit 82fa3ff8672.

2019-09-19 Thread Amit Kapila
Fix typo in commit 82fa3ff8672.

Reported-By: Kuntal Ghosh (off-list)
Backpatch-through: 9.4, like 82fa3ff8672

Branch
--
REL9_5_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/6133c59e17f98420a30197428f881f469c113f32

Modified Files
--
doc/src/sgml/maintenance.sgml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Fix typo in commit 82fa3ff8672.

2019-09-19 Thread Amit Kapila
Fix typo in commit 82fa3ff8672.

Reported-By: Kuntal Ghosh (off-list)
Backpatch-through: 9.4, like 82fa3ff8672

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/09f8106b968e10c7855c0a9fd07dd3520d30e4eb

Modified Files
--
doc/src/sgml/maintenance.sgml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Remove unstable KNN SP-GiST test

2019-09-19 Thread Alexander Korotkov
Remove unstable KNN SP-GiST test

6cae9d2c10 introduced test for NULL values in KNN SP-GiST.  This test relies on
undetermined ordering showing different results on various platforms.  This
commit removes that test.  Will be replaced with better test later.

Discussion: https://postgr.es/m/6d51305e1159241cabee132f7efc7eff%40xs4all.nl
Backpatch-through: 12

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/340536dd489286d0f98878843390d92ddc593be0

Modified Files
--
src/test/regress/expected/create_index_spgist.out | 10 --
src/test/regress/sql/create_index_spgist.sql  |  4 
2 files changed, 14 deletions(-)



pgsql: Remove unstable KNN SP-GiST test

2019-09-19 Thread Alexander Korotkov
Remove unstable KNN SP-GiST test

6cae9d2c10 introduced test for NULL values in KNN SP-GiST.  This test relies on
undetermined ordering showing different results on various platforms.  This
commit removes that test.  Will be replaced with better test later.

Discussion: https://postgr.es/m/6d51305e1159241cabee132f7efc7eff%40xs4all.nl
Backpatch-through: 12

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/f5f084fc3ec516545d826e1e9b7ab4aabf612698

Modified Files
--
src/test/regress/expected/create_index_spgist.out | 10 --
src/test/regress/sql/create_index_spgist.sql  |  4 
2 files changed, 14 deletions(-)



pgsql: Fix freeing old values in index_store_float8_orderby_distances()

2019-09-19 Thread Alexander Korotkov
Fix freeing old values in index_store_float8_orderby_distances()

6cae9d2c10 has added an error in freeing old values in
index_store_float8_orderby_distances() function.  It looks for old value in
scan->xs_orderbynulls[i] after setting a new value there.
This commit fixes that.  Also it removes short-circuit in handling
distances == NULL situation.  Now distances == NULL will be treated the same
way as array with all null distances.  That is, previous values will be freed
if any.

Reported-by: Tom Lane, Nikita Glukhov
Discussion: 
https://postgr.es/m/CAPpHfdu2wcoAVAm3Ek66rP%3Duo_C-D84%2B%2Buf1VEcbyi_caBXWCA%40mail.gmail.com
Discussion: 
https://postgr.es/m/426580d3-a668-b9d1-7b8e-f74d1a6524e0%40postgrespro.ru
Backpatch-through: 12

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/8c58e480d9ddecbe94badc737d60c866974144b5

Modified Files
--
src/backend/access/index/indexam.c | 40 +++---
1 file changed, 20 insertions(+), 20 deletions(-)



pgsql: Fix freeing old values in index_store_float8_orderby_distances()

2019-09-19 Thread Alexander Korotkov
Fix freeing old values in index_store_float8_orderby_distances()

6cae9d2c10 has added an error in freeing old values in
index_store_float8_orderby_distances() function.  It looks for old value in
scan->xs_orderbynulls[i] after setting a new value there.
This commit fixes that.  Also it removes short-circuit in handling
distances == NULL situation.  Now distances == NULL will be treated the same
way as array with all null distances.  That is, previous values will be freed
if any.

Reported-by: Tom Lane, Nikita Glukhov
Discussion: 
https://postgr.es/m/CAPpHfdu2wcoAVAm3Ek66rP%3Duo_C-D84%2B%2Buf1VEcbyi_caBXWCA%40mail.gmail.com
Discussion: 
https://postgr.es/m/426580d3-a668-b9d1-7b8e-f74d1a6524e0%40postgrespro.ru
Backpatch-through: 12

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/8c8a267201bebb0edeaab2a76b7d3bcc9739924f

Modified Files
--
src/backend/access/index/indexam.c | 40 +++---
1 file changed, 20 insertions(+), 20 deletions(-)



Re: pgsql: Improve handling of NULLs in KNN-GiST and KNN-SP-GiST

2019-09-19 Thread Tom Lane
Alexander Korotkov  writes:
> Both dromedary and tern, where segfault happened, are 32-bit.  Bug
> seems related to USE_FLOAT8_BYVAL or something.

Yeah, I was just about to write back that there's an independent problem.
Look at the logic inside the loop in index_store_float8_orderby_distances:

scan->xs_orderbynulls[i] = distances[i].isnull;

if (scan->xs_orderbynulls[i])
scan->xs_orderbyvals[i] = (Datum) 0;

if (orderByTypes[i] == FLOAT8OID)
{
#ifndef USE_FLOAT8_BYVAL
/* must free any old value to avoid memory leakage */
if (!scan->xs_orderbynulls[i])
pfree(DatumGetPointer(scan->xs_orderbyvals[i]));
#endif
if (!scan->xs_orderbynulls[i])
scan->xs_orderbyvals[i] = Float8GetDatum(distances[i].value);
}

The pfree is being done way too late, as you've already stomped on
both the isnull flag and the pointer value.  I think the first
three lines quoted above need to be moved to after the #ifndef
stanza (and, hence, duplicated for the float4 case), like

#ifndef USE_FLOAT8_BYVAL
/* must free any old value to avoid memory leakage */
if (!scan->xs_orderbynulls[i])
pfree(DatumGetPointer(scan->xs_orderbyvals[i]));
#endif
scan->xs_orderbynulls[i] = distances[i].isnull;
if (scan->xs_orderbynulls[i])
scan->xs_orderbyvals[i] = (Datum) 0;
else
scan->xs_orderbyvals[i] = Float8GetDatum(distances[i].value);

Another issue here is that the short-circuit path above (for !distances)
leaks memory, in not-passbyval cases.  I'd be inclined to get rid of the
short circuit and just handle the case within the main loop, so really
that'd be more like

if (distances)
{
scan->xs_orderbynulls[i] = distances[i].isnull;
if (scan->xs_orderbynulls[i])
scan->xs_orderbyvals[i] = (Datum) 0;
else
scan->xs_orderbyvals[i] = 
Float8GetDatum(distances[i].value);
}
else
{
scan->xs_orderbynulls[i] = true;
scan->xs_orderbyvals[i] = (Datum) 0;
}


regards, tom lane




Re: pgsql: Improve handling of NULLs in KNN-GiST and KNN-SP-GiST

2019-09-19 Thread Alexander Korotkov
On Thu, Sep 19, 2019 at 11:43 PM Alexander Korotkov
 wrote:
> On Thu, Sep 19, 2019 at 11:31 PM Alexander Korotkov
>  wrote:
> >
> > On Thu, Sep 19, 2019 at 11:13 PM Tom Lane  wrote:
> >>
> >> Erik Rijkers  writes:
> >> > Oops:
> >> >   create_index ... ok  634 ms
> >> >   create_index_spgist  ... FAILED  438 ms
> >> >   create_view  ... ok  329 ms
> >>
> >> I'm betting the issue is breaking the Datum abstraction here:
> >>
> >> -   scan->xs_orderbyvals[i] = 
> >> Float8GetDatum(distanceValues[i]);
> >> +   scan->xs_orderbyvals[i] = item->distances[i].value;
> >
> >
> > Overseen by me.  Will fix immediately.
>
>
> Fix pushed from 11 to 9.5, where I made this error during backpatching.
>
> However, I also see set of failures in master, which seems related to
> this patch:
>  * 
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=dromedary&dt=2019-09-19%2020%3A09%3A42
>  * 
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=crake&dt=2019-09-19%2020%3A04%3A22
>  * 
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=tern&dt=2019-09-19%2019%3A22%3A01
>
> Will investigate them.

Both dromedary and tern, where segfault happened, are 32-bit.  Bug
seems related to USE_FLOAT8_BYVAL or something.

--
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company




Re: pgsql: Improve handling of NULLs in KNN-GiST and KNN-SP-GiST

2019-09-19 Thread Alexander Korotkov
On Thu, Sep 19, 2019 at 11:31 PM Alexander Korotkov
 wrote:
>
> On Thu, Sep 19, 2019 at 11:13 PM Tom Lane  wrote:
>>
>> Erik Rijkers  writes:
>> > Oops:
>> >   create_index ... ok  634 ms
>> >   create_index_spgist  ... FAILED  438 ms
>> >   create_view  ... ok  329 ms
>>
>> I'm betting the issue is breaking the Datum abstraction here:
>>
>> -   scan->xs_orderbyvals[i] = 
>> Float8GetDatum(distanceValues[i]);
>> +   scan->xs_orderbyvals[i] = item->distances[i].value;
>
>
> Overseen by me.  Will fix immediately.


Fix pushed from 11 to 9.5, where I made this error during backpatching.

However, I also see set of failures in master, which seems related to
this patch:
 * 
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=dromedary&dt=2019-09-19%2020%3A09%3A42
 * 
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=crake&dt=2019-09-19%2020%3A04%3A22
 * 
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=tern&dt=2019-09-19%2019%3A22%3A01

Will investigate them.

--
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company




pgsql: Fix oversight in backpatch of 6cae9d2c10

2019-09-19 Thread Alexander Korotkov
Fix oversight in backpatch of 6cae9d2c10

During backpatch of 6cae9d2c10 Float8GetDatum() was accidentally removed.  This
commit turns it back.

Reported-by: Erik Rijkers
Discussion: https://postgr.es/m/6d51305e1159241cabee132f7efc7eff%40xs4all.nl
Author: Tom Lane
Backpatch-through: from 11 to 9.5

Branch
--
REL9_5_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/388939748a7683b1e703de8d11ead60b0be3edc7

Modified Files
--
src/backend/access/gist/gistget.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Fix oversight in backpatch of 6cae9d2c10

2019-09-19 Thread Alexander Korotkov
Fix oversight in backpatch of 6cae9d2c10

During backpatch of 6cae9d2c10 Float8GetDatum() was accidentally removed.  This
commit turns it back.

Reported-by: Erik Rijkers
Discussion: https://postgr.es/m/6d51305e1159241cabee132f7efc7eff%40xs4all.nl
Author: Tom Lane
Backpatch-through: from 11 to 9.5

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/984b9ba1d119ee59babea515b2ecab70b7b11910

Modified Files
--
src/backend/access/gist/gistget.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Fix oversight in backpatch of 6cae9d2c10

2019-09-19 Thread Alexander Korotkov
Fix oversight in backpatch of 6cae9d2c10

During backpatch of 6cae9d2c10 Float8GetDatum() was accidentally removed.  This
commit turns it back.

Reported-by: Erik Rijkers
Discussion: https://postgr.es/m/6d51305e1159241cabee132f7efc7eff%40xs4all.nl
Author: Tom Lane
Backpatch-through: from 11 to 9.5

Branch
--
REL_10_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/2f0434e8e96f8850705fbd46a12fb5286cf8922a

Modified Files
--
src/backend/access/gist/gistget.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Fix oversight in backpatch of 6cae9d2c10

2019-09-19 Thread Alexander Korotkov
Fix oversight in backpatch of 6cae9d2c10

During backpatch of 6cae9d2c10 Float8GetDatum() was accidentally removed.  This
commit turns it back.

Reported-by: Erik Rijkers
Discussion: https://postgr.es/m/6d51305e1159241cabee132f7efc7eff%40xs4all.nl
Author: Tom Lane
Backpatch-through: from 11 to 9.5

Branch
--
REL9_6_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/140b7b1f93dcd681bf95fef4e3d9b71289c9af87

Modified Files
--
src/backend/access/gist/gistget.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



Re: pgsql: Improve handling of NULLs in KNN-GiST and KNN-SP-GiST

2019-09-19 Thread Alexander Korotkov
On Thu, Sep 19, 2019 at 11:13 PM Tom Lane  wrote:

> Erik Rijkers  writes:
> > Oops:
> >   create_index ... ok  634 ms
> >   create_index_spgist  ... FAILED  438 ms
> >   create_view  ... ok  329 ms
>
> I'm betting the issue is breaking the Datum abstraction here:
>
> -   scan->xs_orderbyvals[i] =
> Float8GetDatum(distanceValues[i]);
> +   scan->xs_orderbyvals[i] = item->distances[i].value;
>

Overseen by me.  Will fix immediately.

--
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company


Re: pgsql: Improve handling of NULLs in KNN-GiST and KNN-SP-GiST

2019-09-19 Thread Tom Lane
Erik Rijkers  writes:
> Oops:
>   create_index ... ok  634 ms
>   create_index_spgist  ... FAILED  438 ms
>   create_view  ... ok  329 ms

I'm betting the issue is breaking the Datum abstraction here:

-   scan->xs_orderbyvals[i] = Float8GetDatum(distanceValues[i]);
+   scan->xs_orderbyvals[i] = item->distances[i].value;

AFAICS, item->distances[i].value is a double not a Datum, so dropping
the Float8GetDatum call is just wrong.

regards, tom lane




Re: pgsql: Improve handling of NULLs in KNN-GiST and KNN-SP-GiST

2019-09-19 Thread Erik Rijkers

On 2019-09-19 21:11, Alexander Korotkov wrote:

Improve handling of NULLs in KNN-GiST and KNN-SP-GiST



Oops:

 create_index ... ok  634 ms
 create_index_spgist  ... FAILED  438 ms
 create_view  ... ok  329 ms







pgsql: Improve handling of NULLs in KNN-GiST and KNN-SP-GiST

2019-09-19 Thread Alexander Korotkov
Improve handling of NULLs in KNN-GiST and KNN-SP-GiST

This commit improves subject in two ways:

 * It removes ugliness of 02f90879e7, which stores distance values and null
   flags in two separate arrays after GISTSearchItem struct.  Instead we pack
   both distance value and null flag in IndexOrderByDistance struct.  Alignment
   overhead should be negligible, because we typically deal with at most few
   "col op const" expressions in ORDER BY clause.
 * It fixes handling of "col op NULL" expression in KNN-SP-GiST.  Now, these
   expression are not passed to support functions, which can't deal with them.
   Instead, NULL result is implicitly assumed.  It future we may decide to
   teach support functions to deal with NULL arguments, but current solution is
   bugfix suitable for backpatch.

Reported-by: Nikita Glukhov
Discussion: 
https://postgr.es/m/826f57ee-afc7-8977-c44c-6111d18b02ec%40postgrespro.ru
Author: Nikita Glukhov
Reviewed-by: Alexander Korotkov
Backpatch-through: 9.4

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/6cae9d2c10e151f741e7bc64a8b70bb2615c367c

Modified Files
--
src/backend/access/gist/gistget.c | 68 -
src/backend/access/gist/gistscan.c| 16 ++---
src/backend/access/index/indexam.c| 22 +++
src/backend/access/spgist/spgscan.c   | 74 +++
src/include/access/genam.h| 10 ++-
src/include/access/gist_private.h | 27 ++---
src/include/access/spgist_private.h   |  8 ++-
src/test/regress/expected/create_index_spgist.out | 10 +++
src/test/regress/sql/create_index_spgist.sql  |  5 ++
src/tools/pgindent/typedefs.list  |  1 +
10 files changed, 140 insertions(+), 101 deletions(-)



pgsql: Improve handling of NULLs in KNN-GiST and KNN-SP-GiST

2019-09-19 Thread Alexander Korotkov
Improve handling of NULLs in KNN-GiST and KNN-SP-GiST

This commit improves subject in two ways:

 * It removes ugliness of 02f90879e7, which stores distance values and null
   flags in two separate arrays after GISTSearchItem struct.  Instead we pack
   both distance value and null flag in IndexOrderByDistance struct.  Alignment
   overhead should be negligible, because we typically deal with at most few
   "col op const" expressions in ORDER BY clause.
 * It fixes handling of "col op NULL" expression in KNN-SP-GiST.  Now, these
   expression are not passed to support functions, which can't deal with them.
   Instead, NULL result is implicitly assumed.  It future we may decide to
   teach support functions to deal with NULL arguments, but current solution is
   bugfix suitable for backpatch.

Reported-by: Nikita Glukhov
Discussion: 
https://postgr.es/m/826f57ee-afc7-8977-c44c-6111d18b02ec%40postgrespro.ru
Author: Nikita Glukhov
Reviewed-by: Alexander Korotkov
Backpatch-through: 9.4

Branch
--
REL9_6_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/53d9cf2db5ded873fbcc031acb584a2c05e4983b

Modified Files
--
src/backend/access/gist/gistget.c  | 75 ++
src/backend/access/gist/gistscan.c | 16 +++-
src/include/access/genam.h |  7 
src/include/access/gist_private.h  | 27 +++---
src/tools/pgindent/typedefs.list   |  1 +
5 files changed, 47 insertions(+), 79 deletions(-)



pgsql: Improve handling of NULLs in KNN-GiST and KNN-SP-GiST

2019-09-19 Thread Alexander Korotkov
Improve handling of NULLs in KNN-GiST and KNN-SP-GiST

This commit improves subject in two ways:

 * It removes ugliness of 02f90879e7, which stores distance values and null
   flags in two separate arrays after GISTSearchItem struct.  Instead we pack
   both distance value and null flag in IndexOrderByDistance struct.  Alignment
   overhead should be negligible, because we typically deal with at most few
   "col op const" expressions in ORDER BY clause.
 * It fixes handling of "col op NULL" expression in KNN-SP-GiST.  Now, these
   expression are not passed to support functions, which can't deal with them.
   Instead, NULL result is implicitly assumed.  It future we may decide to
   teach support functions to deal with NULL arguments, but current solution is
   bugfix suitable for backpatch.

Reported-by: Nikita Glukhov
Discussion: 
https://postgr.es/m/826f57ee-afc7-8977-c44c-6111d18b02ec%40postgrespro.ru
Author: Nikita Glukhov
Reviewed-by: Alexander Korotkov
Backpatch-through: 9.4

Branch
--
REL9_4_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/332eda5bd3d275fc14b721905b93c2b983a000d3

Modified Files
--
src/backend/access/gist/gistget.c  | 65 ++
src/backend/access/gist/gistscan.c | 16 --
src/include/access/genam.h |  7 
src/include/access/gist_private.h  | 28 
src/tools/pgindent/typedefs.list   |  1 +
5 files changed, 44 insertions(+), 73 deletions(-)



pgsql: Improve handling of NULLs in KNN-GiST and KNN-SP-GiST

2019-09-19 Thread Alexander Korotkov
Improve handling of NULLs in KNN-GiST and KNN-SP-GiST

This commit improves subject in two ways:

 * It removes ugliness of 02f90879e7, which stores distance values and null
   flags in two separate arrays after GISTSearchItem struct.  Instead we pack
   both distance value and null flag in IndexOrderByDistance struct.  Alignment
   overhead should be negligible, because we typically deal with at most few
   "col op const" expressions in ORDER BY clause.
 * It fixes handling of "col op NULL" expression in KNN-SP-GiST.  Now, these
   expression are not passed to support functions, which can't deal with them.
   Instead, NULL result is implicitly assumed.  It future we may decide to
   teach support functions to deal with NULL arguments, but current solution is
   bugfix suitable for backpatch.

Reported-by: Nikita Glukhov
Discussion: 
https://postgr.es/m/826f57ee-afc7-8977-c44c-6111d18b02ec%40postgrespro.ru
Author: Nikita Glukhov
Reviewed-by: Alexander Korotkov
Backpatch-through: 9.4

Branch
--
REL_10_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/2da8e56db35cf3759c22b97bcb22216837dec3e1

Modified Files
--
src/backend/access/gist/gistget.c  | 75 ++
src/backend/access/gist/gistscan.c | 16 +++-
src/include/access/genam.h |  7 
src/include/access/gist_private.h  | 27 +++---
src/tools/pgindent/typedefs.list   |  1 +
5 files changed, 47 insertions(+), 79 deletions(-)



pgsql: Improve handling of NULLs in KNN-GiST and KNN-SP-GiST

2019-09-19 Thread Alexander Korotkov
Improve handling of NULLs in KNN-GiST and KNN-SP-GiST

This commit improves subject in two ways:

 * It removes ugliness of 02f90879e7, which stores distance values and null
   flags in two separate arrays after GISTSearchItem struct.  Instead we pack
   both distance value and null flag in IndexOrderByDistance struct.  Alignment
   overhead should be negligible, because we typically deal with at most few
   "col op const" expressions in ORDER BY clause.
 * It fixes handling of "col op NULL" expression in KNN-SP-GiST.  Now, these
   expression are not passed to support functions, which can't deal with them.
   Instead, NULL result is implicitly assumed.  It future we may decide to
   teach support functions to deal with NULL arguments, but current solution is
   bugfix suitable for backpatch.

Reported-by: Nikita Glukhov
Discussion: 
https://postgr.es/m/826f57ee-afc7-8977-c44c-6111d18b02ec%40postgrespro.ru
Author: Nikita Glukhov
Reviewed-by: Alexander Korotkov
Backpatch-through: 9.4

Branch
--
REL9_5_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/ad458d0cd9d90df4747b48ec60cfde455e878811

Modified Files
--
src/backend/access/gist/gistget.c  | 75 ++
src/backend/access/gist/gistscan.c | 16 +++-
src/include/access/genam.h |  7 
src/include/access/gist_private.h  | 28 --
src/tools/pgindent/typedefs.list   |  1 +
5 files changed, 48 insertions(+), 79 deletions(-)



pgsql: Improve handling of NULLs in KNN-GiST and KNN-SP-GiST

2019-09-19 Thread Alexander Korotkov
Improve handling of NULLs in KNN-GiST and KNN-SP-GiST

This commit improves subject in two ways:

 * It removes ugliness of 02f90879e7, which stores distance values and null
   flags in two separate arrays after GISTSearchItem struct.  Instead we pack
   both distance value and null flag in IndexOrderByDistance struct.  Alignment
   overhead should be negligible, because we typically deal with at most few
   "col op const" expressions in ORDER BY clause.
 * It fixes handling of "col op NULL" expression in KNN-SP-GiST.  Now, these
   expression are not passed to support functions, which can't deal with them.
   Instead, NULL result is implicitly assumed.  It future we may decide to
   teach support functions to deal with NULL arguments, but current solution is
   bugfix suitable for backpatch.

Reported-by: Nikita Glukhov
Discussion: 
https://postgr.es/m/826f57ee-afc7-8977-c44c-6111d18b02ec%40postgrespro.ru
Author: Nikita Glukhov
Reviewed-by: Alexander Korotkov
Backpatch-through: 9.4

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/31cbd760578fc0aeb87db11422c32afaf5de129b

Modified Files
--
src/backend/access/gist/gistget.c | 68 -
src/backend/access/gist/gistscan.c| 16 ++---
src/backend/access/index/indexam.c| 22 +++
src/backend/access/spgist/spgscan.c   | 74 +++
src/include/access/genam.h| 10 ++-
src/include/access/gist_private.h | 27 ++---
src/include/access/spgist_private.h   |  8 ++-
src/test/regress/expected/create_index_spgist.out | 10 +++
src/test/regress/sql/create_index_spgist.sql  |  5 ++
src/tools/pgindent/typedefs.list  |  1 +
10 files changed, 140 insertions(+), 101 deletions(-)



pgsql: Improve handling of NULLs in KNN-GiST and KNN-SP-GiST

2019-09-19 Thread Alexander Korotkov
Improve handling of NULLs in KNN-GiST and KNN-SP-GiST

This commit improves subject in two ways:

 * It removes ugliness of 02f90879e7, which stores distance values and null
   flags in two separate arrays after GISTSearchItem struct.  Instead we pack
   both distance value and null flag in IndexOrderByDistance struct.  Alignment
   overhead should be negligible, because we typically deal with at most few
   "col op const" expressions in ORDER BY clause.
 * It fixes handling of "col op NULL" expression in KNN-SP-GiST.  Now, these
   expression are not passed to support functions, which can't deal with them.
   Instead, NULL result is implicitly assumed.  It future we may decide to
   teach support functions to deal with NULL arguments, but current solution is
   bugfix suitable for backpatch.

Reported-by: Nikita Glukhov
Discussion: 
https://postgr.es/m/826f57ee-afc7-8977-c44c-6111d18b02ec%40postgrespro.ru
Author: Nikita Glukhov
Reviewed-by: Alexander Korotkov
Backpatch-through: 9.4

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/d6a90aac563ecb5b32e2a1d902c9a18d8c21671f

Modified Files
--
src/backend/access/gist/gistget.c  | 75 ++
src/backend/access/gist/gistscan.c | 16 +++-
src/include/access/genam.h |  7 
src/include/access/gist_private.h  | 27 +++---
src/tools/pgindent/typedefs.list   |  1 +
5 files changed, 47 insertions(+), 79 deletions(-)



pgsql: Doc: improve documentation around jsonpath regular expressions.

2019-09-19 Thread Tom Lane
Doc: improve documentation around jsonpath regular expressions.

Provide some documentation about the differences between XQuery
regular expressions and those supported by Spencer's regex engine.
Since SQL now exposes XQuery regexps with the LIKE_REGEX operator,
I made this a standalone section designed to help somebody who
has to translate a LIKE_REGEX query to Postgres.  (Eventually we might
extend Spencer's engine to allow precise implementation of XQuery,
but not today.)

Reference that in the jsonpath docs, provide definitions of the
XQuery flag letters, and add a description of the JavaScript-inspired
string literal syntax used within jsonpath.  Also point out explicitly
that backslashes used within like_regex patterns will need to be doubled.

This also syncs the docs with the decision implemented in commit
d5b90cd64 to desupport XQuery's 'x' flag for now.

Jonathan Katz and Tom Lane

Discussion: 
https://postgr.es/m/capphfdvdci4iqnf9fhrktqhe-5_8hmzelt56drh%2b_rv2rnr...@mail.gmail.com

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/b9cf94c8c2496af30dcdf7cea083463f6464dff0

Modified Files
--
doc/src/sgml/func.sgml | 213 -
doc/src/sgml/json.sgml |  33 ++--
2 files changed, 235 insertions(+), 11 deletions(-)



pgsql: Doc: improve documentation around jsonpath regular expressions.

2019-09-19 Thread Tom Lane
Doc: improve documentation around jsonpath regular expressions.

Provide some documentation about the differences between XQuery
regular expressions and those supported by Spencer's regex engine.
Since SQL now exposes XQuery regexps with the LIKE_REGEX operator,
I made this a standalone section designed to help somebody who
has to translate a LIKE_REGEX query to Postgres.  (Eventually we might
extend Spencer's engine to allow precise implementation of XQuery,
but not today.)

Reference that in the jsonpath docs, provide definitions of the
XQuery flag letters, and add a description of the JavaScript-inspired
string literal syntax used within jsonpath.  Also point out explicitly
that backslashes used within like_regex patterns will need to be doubled.

This also syncs the docs with the decision implemented in commit
d5b90cd64 to desupport XQuery's 'x' flag for now.

Jonathan Katz and Tom Lane

Discussion: 
https://postgr.es/m/capphfdvdci4iqnf9fhrktqhe-5_8hmzelt56drh%2b_rv2rnr...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/0a97edb12ec44f8d2d8828cbca6dd7639408ac88

Modified Files
--
doc/src/sgml/func.sgml | 213 -
doc/src/sgml/json.sgml |  33 ++--
2 files changed, 235 insertions(+), 11 deletions(-)



pgsql: GSSAPI error message improvements

2019-09-19 Thread Peter Eisentraut
GSSAPI error message improvements

Make the error messages around GSSAPI encryption a bit clearer.  Tweak
some messages to avoid plural problems.

Also make a code change for clarity.  Using "conf" for "confidential"
is quite confusing.  Using "conf_state" is perhaps not much better but
that's what the GSSAPI documentation uses, so there is at least some
hope of understanding it.

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/596cf9e806826936869f62232bd011687c467965

Modified Files
--
src/backend/libpq/be-secure-gssapi.c| 38 ++---
src/interfaces/libpq/fe-secure-gssapi.c | 32 +++
2 files changed, 39 insertions(+), 31 deletions(-)



pgsql: GSSAPI error message improvements

2019-09-19 Thread Peter Eisentraut
GSSAPI error message improvements

Make the error messages around GSSAPI encryption a bit clearer.  Tweak
some messages to avoid plural problems.

Also make a code change for clarity.  Using "conf" for "confidential"
is quite confusing.  Using "conf_state" is perhaps not much better but
that's what the GSSAPI documentation uses, so there is at least some
hope of understanding it.

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/e1c8743e6ccd262df84fa2d80bf21d72115ac0d6

Modified Files
--
src/backend/libpq/be-secure-gssapi.c| 38 ++---
src/interfaces/libpq/fe-secure-gssapi.c | 32 +++
2 files changed, 39 insertions(+), 31 deletions(-)



pgsql: doc: Improve a release notes item

2019-09-19 Thread Peter Eisentraut
doc: Improve a release notes item

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/9c4f20066fb20197dfc20e3cf31aa3c890f3646b

Modified Files
--
doc/src/sgml/release-12.sgml | 7 ---
1 file changed, 4 insertions(+), 3 deletions(-)



pgsql: Fix typo in commit 578b229718.

2019-09-19 Thread Amit Kapila
Fix typo in commit 578b229718.

Reported-by: Filip Rembiałkowski
Author: Filip Rembiałkowski
Backpatch-through: 12, where it was introduced
Discussion: 
https://postgr.es/m/CAP_rwwmSNy1=_82rwge3-x4pjwqpsfxtznf43dctgzd7saz...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/70377cf4c6bf4eb4b2d1209752a300d5f3571145

Modified Files
--
doc/src/sgml/ref/create_table_as.sgml | 1 -
1 file changed, 1 deletion(-)



pgsql: Fix typo in commit 578b229718.

2019-09-19 Thread Amit Kapila
Fix typo in commit 578b229718.

Reported-by: Filip Rembiałkowski
Author: Filip Rembiałkowski
Backpatch-through: 12, where it was introduced
Discussion: 
https://postgr.es/m/CAP_rwwmSNy1=_82rwge3-x4pjwqpsfxtznf43dctgzd7saz...@mail.gmail.com

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/a4188a65be9426136fc176430ea646cb0fa04fff

Modified Files
--
doc/src/sgml/ref/create_table_as.sgml | 1 -
1 file changed, 1 deletion(-)



pgsql: doc: Some release notes tweaking

2019-09-19 Thread Peter Eisentraut
doc: Some release notes tweaking

Improve the LDAP DNS SRV item.

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/1aaa3ee34466780d6f050b7d4aa5cc69935c08b5

Modified Files
--
doc/src/sgml/release-12.sgml | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)



pgsql: Revert change of ecpglib major version

2019-09-19 Thread Peter Eisentraut
Revert change of ecpglib major version

The major version of ecpglib was changed in
bd7c95f0c1a38becffceb3ea7234d57167f6d4bf, apparently without
justification.  Revert this, since nothing has changed in this library
except some added functions.

Discussion: 
https://www.postgresql.org/message-id/flat/48ee4c56-e1df-b39d-2cad-c7d80b120eb5%402ndquadrant.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/74f2a8aa27cb7bd2dbab3ed58e6b5c239a6b4a31

Modified Files
--
src/interfaces/ecpg/ecpglib/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Revert change of ecpglib major version

2019-09-19 Thread Peter Eisentraut
Revert change of ecpglib major version

The major version of ecpglib was changed in
bd7c95f0c1a38becffceb3ea7234d57167f6d4bf, apparently without
justification.  Revert this, since nothing has changed in this library
except some added functions.

Discussion: 
https://www.postgresql.org/message-id/flat/48ee4c56-e1df-b39d-2cad-c7d80b120eb5%402ndquadrant.com

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/fbd1cb2fd9796a08a198d929774280ecce933057

Modified Files
--
src/interfaces/ecpg/ecpglib/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)