pgsql: Update comment in header of errcodes.txt

2018-08-16 Thread Michael Paquier
Update comment in header of errcodes.txt

This file mentions all the files generated from it, but missed that
errcodes-list.sgml is no more, while errcodes-table.sgml is.

Author: Noriyoshi Shinoda
Discussion: 
https://postgr.es/m/tu4pr8401mb0430855d6b971e49eb55f328ee...@tu4pr8401mb0430.namprd84.prod.outlook.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/3593579bcdc77a70e0f987dca6d47f0bf1337f76

Modified Files
--
src/backend/utils/errcodes.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Try to enable C99 in configure, but do not rely on it (yet).

2018-08-16 Thread Andres Freund
Try to enable C99 in configure, but do not rely on it (yet).

Based on recent discussion it seems possible that we might start to
rely on more of C99. A prerequisite for that is enabling support for
that on used compilers.

Let's see on which buildfarm members autoconf's AC_PROG_CC_C99() is
sufficient to do so. There's probably at least one member where the
compiler is too old, but that'd probably be OK.

If we go for this permanently we'd likely want to clean out / up a few
other configure tests.

Note this does not touch the msvc build infrastructure, which'd need
separate treatment.

Discussion: 
https://postgr.es/m/[email protected]

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/86d78ef50e0195f8181f2b0bd9540f4ddfb73480

Modified Files
--
configure| 177 +++
configure.in |   1 +
2 files changed, 178 insertions(+)



pgsql: Close the file descriptor in ApplyLogicalMappingFile

2018-08-16 Thread Tomas Vondra
Close the file descriptor in ApplyLogicalMappingFile

The function was forgetting to close the file descriptor, resulting
in failures like this:

  ERROR:  53000: exceeded maxAllocatedDescs (492) while trying to open
  file "pg_logical/mappings/map-4000-4eb-1_60DE1E08-5376b5-537c6b"
  LOCATION:  OpenTransientFile, fd.c:2161

Simply close the file at the end, and backpatch to 9.4 (where logical
decoding was introduced). While at it, fix a nearby typo.

Discussion: 
https://www.postgresql.org/message-id/flat/738a590a-2ce5-9394-2bef-7b1caad89b37%402ndquadrant.com

Branch
--
REL9_4_STABLE

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

Modified Files
--
src/backend/replication/logical/reorderbuffer.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)



pgsql: Close the file descriptor in ApplyLogicalMappingFile

2018-08-16 Thread Tomas Vondra
Close the file descriptor in ApplyLogicalMappingFile

The function was forgetting to close the file descriptor, resulting
in failures like this:

  ERROR:  53000: exceeded maxAllocatedDescs (492) while trying to open
  file "pg_logical/mappings/map-4000-4eb-1_60DE1E08-5376b5-537c6b"
  LOCATION:  OpenTransientFile, fd.c:2161

Simply close the file at the end, and backpatch to 9.4 (where logical
decoding was introduced). While at it, fix a nearby typo.

Discussion: 
https://www.postgresql.org/message-id/flat/738a590a-2ce5-9394-2bef-7b1caad89b37%402ndquadrant.com

Branch
--
REL9_5_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/864ecd716a0dd191e587dd09e24992be5e720b26

Modified Files
--
src/backend/replication/logical/reorderbuffer.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)



pgsql: Close the file descriptor in ApplyLogicalMappingFile

2018-08-16 Thread Tomas Vondra
Close the file descriptor in ApplyLogicalMappingFile

The function was forgetting to close the file descriptor, resulting
in failures like this:

  ERROR:  53000: exceeded maxAllocatedDescs (492) while trying to open
  file "pg_logical/mappings/map-4000-4eb-1_60DE1E08-5376b5-537c6b"
  LOCATION:  OpenTransientFile, fd.c:2161

Simply close the file at the end, and backpatch to 9.4 (where logical
decoding was introduced). While at it, fix a nearby typo.

Discussion: 
https://www.postgresql.org/message-id/flat/738a590a-2ce5-9394-2bef-7b1caad89b37%402ndquadrant.com

Branch
--
REL9_6_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/5257b9bfbafdbb17fa7b3a1d387dfaa7d40626cb

Modified Files
--
src/backend/replication/logical/reorderbuffer.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)



pgsql: Close the file descriptor in ApplyLogicalMappingFile

2018-08-16 Thread Tomas Vondra
Close the file descriptor in ApplyLogicalMappingFile

The function was forgetting to close the file descriptor, resulting
in failures like this:

  ERROR:  53000: exceeded maxAllocatedDescs (492) while trying to open
  file "pg_logical/mappings/map-4000-4eb-1_60DE1E08-5376b5-537c6b"
  LOCATION:  OpenTransientFile, fd.c:2161

Simply close the file at the end, and backpatch to 9.4 (where logical
decoding was introduced). While at it, fix a nearby typo.

Discussion: 
https://www.postgresql.org/message-id/flat/738a590a-2ce5-9394-2bef-7b1caad89b37%402ndquadrant.com

Branch
--
REL_10_STABLE

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

Modified Files
--
src/backend/replication/logical/reorderbuffer.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)



pgsql: Close the file descriptor in ApplyLogicalMappingFile

2018-08-16 Thread Tomas Vondra
Close the file descriptor in ApplyLogicalMappingFile

The function was forgetting to close the file descriptor, resulting
in failures like this:

  ERROR:  53000: exceeded maxAllocatedDescs (492) while trying to open
  file "pg_logical/mappings/map-4000-4eb-1_60DE1E08-5376b5-537c6b"
  LOCATION:  OpenTransientFile, fd.c:2161

Simply close the file at the end, and backpatch to 9.4 (where logical
decoding was introduced). While at it, fix a nearby typo.

Discussion: 
https://www.postgresql.org/message-id/flat/738a590a-2ce5-9394-2bef-7b1caad89b37%402ndquadrant.com

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/43ba5ac6aa4879eea2d16f7f531b256c8203a3c3

Modified Files
--
src/backend/replication/logical/reorderbuffer.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)



pgsql: Close the file descriptor in ApplyLogicalMappingFile

2018-08-16 Thread Tomas Vondra
Close the file descriptor in ApplyLogicalMappingFile

The function was forgetting to close the file descriptor, resulting
in failures like this:

  ERROR:  53000: exceeded maxAllocatedDescs (492) while trying to open
  file "pg_logical/mappings/map-4000-4eb-1_60DE1E08-5376b5-537c6b"
  LOCATION:  OpenTransientFile, fd.c:2161

Simply close the file at the end, and backpatch to 9.4 (where logical
decoding was introduced). While at it, fix a nearby typo.

Discussion: 
https://www.postgresql.org/message-id/flat/738a590a-2ce5-9394-2bef-7b1caad89b37%402ndquadrant.com

Branch
--
master

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

Modified Files
--
src/backend/replication/logical/reorderbuffer.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)



pgsql: Fix executor prune failure when plan already pruned

2018-08-16 Thread Alvaro Herrera
Fix executor prune failure when plan already pruned

In a multi-layer partitioning setup, if at plan time all the
sub-partitions are pruned but the intermediate one remains, the executor
later throws a spurious error that there's nothing to prune.  That is
correct, but there's no reason to throw an error.  Therefore, don't.

Reported-by: Andreas Seltenreich 
Author: David Rowley 
Discussion: https://postgr.es/m/[email protected]

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/6589a435d83ba0b22cb56381fc5b410eb0e27834

Modified Files
--
src/backend/executor/execPartition.c  |  9 +++--
src/test/regress/expected/partition_prune.out | 18 ++
src/test/regress/sql/partition_prune.sql  | 12 
3 files changed, 37 insertions(+), 2 deletions(-)



pgsql: Fix executor prune failure when plan already pruned

2018-08-16 Thread Alvaro Herrera
Fix executor prune failure when plan already pruned

In a multi-layer partitioning setup, if at plan time all the
sub-partitions are pruned but the intermediate one remains, the executor
later throws a spurious error that there's nothing to prune.  That is
correct, but there's no reason to throw an error.  Therefore, don't.

Reported-by: Andreas Seltenreich 
Author: David Rowley 
Discussion: https://postgr.es/m/[email protected]

Branch
--
master

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

Modified Files
--
src/backend/executor/execPartition.c  |  9 +++--
src/test/regress/expected/partition_prune.out | 18 ++
src/test/regress/sql/partition_prune.sql  | 12 
3 files changed, 37 insertions(+), 2 deletions(-)



pgsql: Require a C99-compliant snprintf(), and remove related workaroun

2018-08-16 Thread Tom Lane
Require a C99-compliant snprintf(), and remove related workarounds.

Since our substitute snprintf now returns a C99-compliant result,
there's no need anymore to have complicated code to cope with pre-C99
behavior.  We can just make configure substitute snprintf.c if it finds
that the system snprintf() is pre-C99.  (Note: I do not believe that
there are any platforms where this test will trigger that weren't
already being rejected due to our other C99-ish feature requirements for
snprintf.  But let's add the check for paranoia's sake.)  Then, simplify
the call sites that had logic to cope with the pre-C99 definition.

I also dropped some stuff that was being paranoid about the possibility
of snprintf overrunning the given buffer.  The only reports we've ever
heard of that being a problem were for Solaris 7, which is long dead,
and we've sure not heard any reports of these assertions triggering in
a long time.  So let's drop that complexity too.

Likewise, drop some code that wasn't trusting snprintf to set errno
when it returns -1.  That would be not-per-spec, and again there's
no real reason to believe it is a live issue, especially not for
snprintfs that pass all of configure's feature checks.

Discussion: https://postgr.es/m/[email protected]

Branch
--
master

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

Modified Files
--
config/c-library.m4| 27 ++
configure  | 46 +++-
configure.in   | 11 +-
src/backend/utils/misc/guc.c   | 23 +---
src/common/psprintf.c  | 73 --
src/interfaces/libpq/pqexpbuffer.c | 68 +++
6 files changed, 125 insertions(+), 123 deletions(-)



pgsql: Remove remaining GEODEBUG references from geo_ops.c

2018-08-16 Thread Tomas Vondra
Remove remaining GEODEBUG references from geo_ops.c

Commit a7dc63d904a6044d299aebdf59ad3199b6a9e99d removed most of the
GEODEBUG occurrences, but there were a couple remaining. So remove
them too, to get rid of the macro entirely.

Author: Emre Hasegeli

Discussion: 
https://www.postgresql.org/message-id/CAE2gYzxF7-5djV6-cEvqQu-fNsnt%3DEqbOURx7ZDg%2BVv6ZMTWbg%40mail.gmail.com

Branch
--
master

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

Modified Files
--
src/backend/utils/adt/geo_ops.c | 27 ---
1 file changed, 27 deletions(-)



pgsql: Use the built-in float datatypes to implement geometric types

2018-08-16 Thread Tomas Vondra
Use the built-in float datatypes to implement geometric types

This patch makes the geometric operators and functions use the exported
function of the float4/float8 datatypes.  The main reason of doing so is
to check for underflow and overflow, and to handle NaNs consciously.

The float datatypes consider NaNs values to be equal and greater than
all non-NaN values.  This change considers NaNs equal only for equality
operators.  The placement operators, contains, overlaps, left/right of
etc. continue to return false when NaNs are involved.  We don't need
to worry about them being considered greater than any-NaN because there
aren't any basic comparison operators like less/greater than for the
geometric datatypes.

The changes may be summarised as:

* Check for underflow, overflow and division by zero
* Consider NaN values to be equal
* Return NULL when the distance is NaN for all closest point operators
* Favour not-NaN over NaN where it makes sense

The patch also replaces all occurrences of "double" as "float8".  They
are the same, but were used inconsistently in the same file.

Author: Emre Hasegeli
Reviewed-by: Kyotaro Horiguchi, Tomas Vondra

Discussion: 
https://www.postgresql.org/message-id/CAE2gYzxF7-5djV6-cEvqQu-fNsnt%3DEqbOURx7ZDg%2BVv6ZMTWbg%40mail.gmail.com

Branch
--
master

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

Modified Files
--
src/backend/access/gist/gistproc.c | 100 
src/backend/utils/adt/geo_ops.c| 501 -
src/backend/utils/adt/geo_spgist.c |  28 +--
src/include/utils/geo_decls.h  |  19 +-
4 files changed, 343 insertions(+), 305 deletions(-)



pgsql: Remove unused configure test for ldopen()

2018-08-16 Thread Peter Eisentraut
Remove unused configure test for ldopen()

unused since f2cc453dd7e87e800a62a173dea0353bf106668d

Branch
--
master

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

Modified Files
--
configure| 61 
configure.in |  6 --
2 files changed, 67 deletions(-)



pgsql: Proof-reading for documentation.

2018-08-16 Thread Thomas Munro
Proof-reading for documentation.

Somebody accidentally a word.  Back-patch to 9.6.

Reported-by: Justin Pryzby
Discussion: https://postgr.es/m/20180816195431.GA23707%40telsasoft.com

Branch
--
REL9_6_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/3fe8c13a31bcdd0220c0c0891c2a161087600a5d

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



pgsql: Proof-reading for documentation.

2018-08-16 Thread Thomas Munro
Proof-reading for documentation.

Somebody accidentally a word.  Back-patch to 9.6.

Reported-by: Justin Pryzby
Discussion: https://postgr.es/m/20180816195431.GA23707%40telsasoft.com

Branch
--
REL_10_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/07b895aef764fe528af57f04d454336e67d6c6aa

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



pgsql: Proof-reading for documentation.

2018-08-16 Thread Thomas Munro
Proof-reading for documentation.

Somebody accidentally a word.  Back-patch to 9.6.

Reported-by: Justin Pryzby
Discussion: https://postgr.es/m/20180816195431.GA23707%40telsasoft.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/96e98fa2606b2b12805db99196f468152312af14

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



pgsql: Proof-reading for documentation.

2018-08-16 Thread Thomas Munro
Proof-reading for documentation.

Somebody accidentally a word.  Back-patch to 9.6.

Reported-by: Justin Pryzby
Discussion: https://postgr.es/m/20180816195431.GA23707%40telsasoft.com

Branch
--
REL_11_STABLE

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

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



pgsql: Mention ownership requirements for REFRESH MATERIALIZED VIEW in

2018-08-16 Thread Michael Paquier
Mention ownership requirements for REFRESH MATERIALIZED VIEW in docs

Author: Dian Fay
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 9.3

Branch
--
master

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

Modified Files
--
doc/src/sgml/ref/refresh_materialized_view.sgml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



pgsql: Mention ownership requirements for REFRESH MATERIALIZED VIEW in

2018-08-16 Thread Michael Paquier
Mention ownership requirements for REFRESH MATERIALIZED VIEW in docs

Author: Dian Fay
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 9.3

Branch
--
REL9_4_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/777192f0dd444d68a95ed9df0fe8c77f50447f53

Modified Files
--
doc/src/sgml/ref/refresh_materialized_view.sgml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



pgsql: Mention ownership requirements for REFRESH MATERIALIZED VIEW in

2018-08-16 Thread Michael Paquier
Mention ownership requirements for REFRESH MATERIALIZED VIEW in docs

Author: Dian Fay
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 9.3

Branch
--
REL_10_STABLE

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

Modified Files
--
doc/src/sgml/ref/refresh_materialized_view.sgml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



pgsql: Mention ownership requirements for REFRESH MATERIALIZED VIEW in

2018-08-16 Thread Michael Paquier
Mention ownership requirements for REFRESH MATERIALIZED VIEW in docs

Author: Dian Fay
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 9.3

Branch
--
REL9_3_STABLE

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

Modified Files
--
doc/src/sgml/ref/refresh_materialized_view.sgml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



pgsql: Mention ownership requirements for REFRESH MATERIALIZED VIEW in

2018-08-16 Thread Michael Paquier
Mention ownership requirements for REFRESH MATERIALIZED VIEW in docs

Author: Dian Fay
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 9.3

Branch
--
REL_11_STABLE

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

Modified Files
--
doc/src/sgml/ref/refresh_materialized_view.sgml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



pgsql: Mention ownership requirements for REFRESH MATERIALIZED VIEW in

2018-08-16 Thread Michael Paquier
Mention ownership requirements for REFRESH MATERIALIZED VIEW in docs

Author: Dian Fay
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 9.3

Branch
--
REL9_6_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/86e873c01650a0d3cd605e897946d36073ca240e

Modified Files
--
doc/src/sgml/ref/refresh_materialized_view.sgml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



pgsql: Mention ownership requirements for REFRESH MATERIALIZED VIEW in

2018-08-16 Thread Michael Paquier
Mention ownership requirements for REFRESH MATERIALIZED VIEW in docs

Author: Dian Fay
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 9.3

Branch
--
REL9_5_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/82784f088986140bc08ab22ae34f4b1cbce58eae

Modified Files
--
doc/src/sgml/ref/refresh_materialized_view.sgml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)