[COMMITTERS] pgsql: Fix inclusions of c.h from .h files.

2017-03-08 Thread Tom Lane
Fix inclusions of c.h from .h files. We have a project policy that every .c file should start by including postgres.h, postgres_fe.h, or c.h as appropriate; and then there is no need for any .h file to explicitly include any of these. Fix a few headers that were violating this policy by including

[COMMITTERS] pgsql: Fix inclusions of postgres_fe.h from .h files.

2017-03-08 Thread Tom Lane
Fix inclusions of postgres_fe.h from .h files. We have a project policy that every .c file should start by including postgres.h, postgres_fe.h, or c.h as appropriate; and then there is no need for any .h file to explicitly include any of these. Fix a few headers that were violating this policy by

[COMMITTERS] pgsql: Bring plpgsql into line with header inclusion policy.

2017-03-08 Thread Tom Lane
Bring plpgsql into line with header inclusion policy. We have a project policy that every .c file should start by including postgres.h, postgres_fe.h, or c.h as appropriate; and then there is no need for any .h file to explicitly include any of these. (The core reason for this policy is to make i

[COMMITTERS] pgsql: Document intentional violations of header inclusion policy.

2017-03-08 Thread Tom Lane
Document intentional violations of header inclusion policy. Although there are good reasons for our policy of including postgres.h as the first #include in every .c file, never from .h files, there are two places where it seems expedient to violate the policy because the alternative is to modify e

[COMMITTERS] pgsql: Suppress compiler warning in slab.c.

2017-03-08 Thread Tom Lane
Suppress compiler warning in slab.c. Compilers that don't realize that elog(ERROR) doesn't return complained that SlabRealloc() failed to return a value. While at it, fix the rather muddled header comment for the function. Per buildfarm. Branch -- master Details --- http://git.postgres

[COMMITTERS] pgsql: Suppress compiler warning in non-USE_LIBXML builds.

2017-03-08 Thread Tom Lane
Suppress compiler warning in non-USE_LIBXML builds. Compilers that don't realize that ereport(ERROR) doesn't return complained that XmlTableGetValue() failed to return a value. Also, make XmlTableFetchRow's non-USE_LIBXML case look more like the other ones. As coded, it could lead to "unreachabl

Re: [COMMITTERS] pgsql: Suppress compiler warnings in ecpg test on newer Windows toolcha

2017-03-08 Thread Tom Lane
David Rowley writes: > On 25 February 2017 at 10:45, Tom Lane wrote: >> Suppress compiler warnings in ecpg test on newer Windows toolchains. > This seems to have caused some new compiler warnings [1] on earlier > MSVC toolchains. That didn't make any sense to me, because the commit you mention

[COMMITTERS] pgsql: Put back in a few files that need it for _isnan().

2017-03-08 Thread Tom Lane
Put back in a few files that need it for _isnan(). Further fallout from commit c29aff959: there are some files that need , and were getting it from datatype/timestamp.h, but it was not apparent in my (tgl's) testing because the requirement for exists only on certain Windows toolchains. Report a

[COMMITTERS] pgsql: Expose explain's SUMMARY option

2017-03-08 Thread Stephen Frost
Expose explain's SUMMARY option This exposes the existing explain summary option to users to allow them to choose if they wish to have the planning time and totalled run time included in the EXPLAIN result. The existing default behavior is retained if SUMMARY is not specified- running explain wit

Re: [COMMITTERS] pgsql: Fix XMLTABLE on older libxml2

2017-03-08 Thread Tom Lane
Alvaro Herrera writes: > Fix XMLTABLE on older libxml2 > libxml2 older than 2.9.1 does not have xmlXPathSetContextNode (released > in 2013, so reasonable platforms have trouble). That function is fairly > trivial, so I have inlined it in the one added caller. This passes > tests on my machine; l

[COMMITTERS] pgsql: Silence compiler warnings in BitmapHeapNext().

2017-03-08 Thread Tom Lane
Silence compiler warnings in BitmapHeapNext(). Same disease as 270d7dd8a5a7128fc2b859f3bf95e2c1fb45be79. Branch -- master Details --- http://git.postgresql.org/pg/commitdiff/15d03e597662847e13428a8b3ce9dd59c38decf3 Modified Files -- src/backend/executor/nodeBitmapHeapscan.c

[COMMITTERS] pgsql: Use doubly-linked block lists in aset.c to reduce large-chunk ov

2017-03-08 Thread Tom Lane
Use doubly-linked block lists in aset.c to reduce large-chunk overhead. Large chunks (those too large for any palloc freelist) are managed as separate blocks. Formerly, realloc'ing or pfree'ing such a chunk required O(N) time in a context with N blocks, since we had to traipse down the singly-lin

[COMMITTERS] pgsql: Use doubly-linked block lists in aset.c to reduce large-chunk ov

2017-03-08 Thread Tom Lane
Use doubly-linked block lists in aset.c to reduce large-chunk overhead. Large chunks (those too large for any palloc freelist) are managed as separate blocks. Formerly, realloc'ing or pfree'ing such a chunk required O(N) time in a context with N blocks, since we had to traipse down the singly-lin

[COMMITTERS] pgsql: Use doubly-linked block lists in aset.c to reduce large-chunk ov

2017-03-08 Thread Tom Lane
Use doubly-linked block lists in aset.c to reduce large-chunk overhead. Large chunks (those too large for any palloc freelist) are managed as separate blocks. Formerly, realloc'ing or pfree'ing such a chunk required O(N) time in a context with N blocks, since we had to traipse down the singly-lin

[COMMITTERS] pgsql: Use doubly-linked block lists in aset.c to reduce large-chunk ov

2017-03-08 Thread Tom Lane
Use doubly-linked block lists in aset.c to reduce large-chunk overhead. Large chunks (those too large for any palloc freelist) are managed as separate blocks. Formerly, realloc'ing or pfree'ing such a chunk required O(N) time in a context with N blocks, since we had to traipse down the singly-lin

[COMMITTERS] pgsql: Support parallel bitmap heap scans.

2017-03-08 Thread Robert Haas
Support parallel bitmap heap scans. The index is scanned by a single process, but then all cooperating processes can iterate jointly over the resulting set of heap blocks. In the future, we might also want to support using a parallel bitmap index scan to set up for a parallel bitmap heap scan, but

[COMMITTERS] pgsql: Prevent logical rep workers with removed subscriptions from star

2017-03-08 Thread Fujii Masao
Prevent logical rep workers with removed subscriptions from starting. Any logical rep workers must have their subscription entries in pg_subscription. To ensure this, we need to prevent the launcher from starting new worker corresponding to the subscription that DROP SUBSCRIPTION command is removi

[COMMITTERS] pgsql: Fix XMLTABLE on older libxml2

2017-03-08 Thread Alvaro Herrera
Fix XMLTABLE on older libxml2 libxml2 older than 2.9.1 does not have xmlXPathSetContextNode (released in 2013, so reasonable platforms have trouble). That function is fairly trivial, so I have inlined it in the one added caller. This passes tests on my machine; let's see what the buildfarm think

[COMMITTERS] pgsql: Add tests for foreign partitions.

2017-03-08 Thread Robert Haas
Add tests for foreign partitions. Amit Langote, reviewed by Ashutosh Bapat Discussion: http://postgr.es/m/[email protected] Branch -- master Details --- http://git.postgresql.org/pg/commitdiff/0d130c7abc85f828dced6c134a5fcbff3215c497 Modified Files ---

Re: [COMMITTERS] pgsql: Support XMLTABLE query expression

2017-03-08 Thread Alvaro Herrera
Tom Lane wrote: > Alvaro Herrera writes: > > Tom Lane wrote: > >> This fails immediately on RHEL6: > > > Yeah, i noticed on termite as well. Apparently xmlXPathSetContextNode > > appeared in 2.9.1 only, which was released in 2013. :-( > > > The easiest for now is to disable XMLTABLE completely

Re: [COMMITTERS] pgsql: Support XMLTABLE query expression

2017-03-08 Thread Tom Lane
Alvaro Herrera writes: > Tom Lane wrote: >> This fails immediately on RHEL6: > Yeah, i noticed on termite as well. Apparently xmlXPathSetContextNode > appeared in 2.9.1 only, which was released in 2013. :-( > The easiest for now is to disable XMLTABLE completely with older > libxml2. That doe

Re: [COMMITTERS] pgsql: Support XMLTABLE query expression

2017-03-08 Thread Alvaro Herrera
Tom Lane wrote: > Alvaro Herrera writes: > > Support XMLTABLE query expression > > This fails immediately on RHEL6: Yeah, i noticed on termite as well. Apparently xmlXPathSetContextNode appeared in 2.9.1 only, which was released in 2013. :-( The easiest for now is to disable XMLTABLE complete

Re: [COMMITTERS] pgsql: Support XMLTABLE query expression

2017-03-08 Thread Tom Lane
Alvaro Herrera writes: > Support XMLTABLE query expression This fails immediately on RHEL6: $ ./configure --with-libxml [ other usual arguments ] $ make -s xml.c: In function 'XmlTableGetValue': xml.c:4434: warning: implicit declaration of function 'xmlXPathSetContextNode' utils/adt/xml.o: In fu

[COMMITTERS] pgsql: Support XMLTABLE query expression

2017-03-08 Thread Alvaro Herrera
Support XMLTABLE query expression XMLTABLE is defined by the SQL/XML standard as a feature that allows turning XML-formatted data into relational form, so that it can be used as a in the FROM clause of a query. This new construct provides significant simplicity and performance benefit for XML da

[COMMITTERS] pgsql: Silence compiler warnings in tbm_prepare_shared_iterate().

2017-03-08 Thread Tom Lane
Silence compiler warnings in tbm_prepare_shared_iterate(). Maybe Robert's compiler can convince itself that these variables are never used uninitialized, but mine can't. Branch -- master Details --- http://git.postgresql.org/pg/commitdiff/270d7dd8a5a7128fc2b859f3bf95e2c1fb45be79 Modifie

[COMMITTERS] pgsql: pg_xlogdump: Remove extra newline in error message

2017-03-08 Thread Peter Eisentraut
pg_xlogdump: Remove extra newline in error message fatal_error() already prints out a trailing newline. Branch -- REL9_3_STABLE Details --- http://git.postgresql.org/pg/commitdiff/5c7ce2d03a7380f8049a7ba1d9336ebed144d97c Modified Files -- contrib/pg_xlogdump/pg_xlogdump.c |

[COMMITTERS] pgsql: pg_waldump: Remove extra newline in error message

2017-03-08 Thread Peter Eisentraut
pg_waldump: Remove extra newline in error message fatal_error() already prints out a trailing newline. Branch -- master Details --- http://git.postgresql.org/pg/commitdiff/911244610cd08fcdc28bd57db4a0d810cffc5080 Modified Files -- src/bin/pg_waldump/pg_waldump.c | 2 +- 1 fil

[COMMITTERS] pgsql: pg_xlogdump: Remove extra newline in error message

2017-03-08 Thread Peter Eisentraut
pg_xlogdump: Remove extra newline in error message fatal_error() already prints out a trailing newline. Branch -- REL9_4_STABLE Details --- http://git.postgresql.org/pg/commitdiff/9420ea88f95de86114f70460e7c86638330e7155 Modified Files -- contrib/pg_xlogdump/pg_xlogdump.c |

[COMMITTERS] pgsql: pg_xlogdump: Remove extra newline in error message

2017-03-08 Thread Peter Eisentraut
pg_xlogdump: Remove extra newline in error message fatal_error() already prints out a trailing newline. Branch -- REL9_5_STABLE Details --- http://git.postgresql.org/pg/commitdiff/197a4c41eef8086e983a442a509bcb510685a895 Modified Files -- src/bin/pg_xlogdump/pg_xlogdump.c |

[COMMITTERS] pgsql: pg_xlogdump: Remove extra newline in error message

2017-03-08 Thread Peter Eisentraut
pg_xlogdump: Remove extra newline in error message fatal_error() already prints out a trailing newline. Branch -- REL9_6_STABLE Details --- http://git.postgresql.org/pg/commitdiff/feb4d35406dddeda0fa6f4e16ea3c64dbd898a0e Modified Files -- src/bin/pg_xlogdump/pg_xlogdump.c |

[COMMITTERS] pgsql: Fix connection leak in DROP SUBSCRIPTION command, take 2.

2017-03-08 Thread Fujii Masao
Fix connection leak in DROP SUBSCRIPTION command, take 2. Commit 898a792eb8283e31efc0b6fcbc03bbcd5f7df667 fixed the connection leak issue, but it was an unreliable way of bugfix. This bugfix was assuming that walrcv_command() subroutine cannot throw an error, but it's untenable assumption. For exa

Re: [COMMITTERS] pgsql: Fix connection leak in DROP SUBSCRIPTION command.

2017-03-08 Thread Fujii Masao
On Wed, Feb 22, 2017 at 1:27 PM, Michael Paquier wrote: > On Wed, Feb 22, 2017 at 8:39 AM, Fujii Masao wrote: >> On Wed, Feb 22, 2017 at 6:57 AM, Michael Paquier >> wrote: >>> On Wed, Feb 22, 2017 at 4:12 AM, Tom Lane wrote: Fujii Masao writes: > Fix connection leak in DROP SUBSCRIPTI

Re: [COMMITTERS] pgsql: Create INSTALL file via XSLT

2017-03-08 Thread Tom Lane
Peter Eisentraut writes: > Replacing jade with xsltproc removes jade from the requirements for > distribution building. If we no longer need jade, surely we should remove the configure infrastructure for finding it, as well as the assorted mentions of it in docguide.sgml and elsewhere.

[COMMITTERS] pgsql: Create INSTALL file via XSLT

2017-03-08 Thread Peter Eisentraut
Create INSTALL file via XSLT As before, create an INSTALL.html file for processing with lynx, but use xsltproc and a new XSLT stylesheet instead of jade and DSSSL. Replacing jade with xsltproc removes jade from the requirements for distribution building. Reviewed-by: Magnus Hagander Branch ---

[COMMITTERS] pgsql: Remove inclusion of postgres.h from a few header files.

2017-03-08 Thread Robert Haas
Remove inclusion of postgres.h from a few header files. Thomas Munro, per project policy articuled by Andres Freund and Tom Lane. Discussion: http://postgr.es/m/CAEepm=2zCoeq3QxVwhS5DFeUh=yu6z81pbwmgfob8ozyibw...@mail.gmail.com Branch -- master Details --- http://git.postgresql.org/pg/

[COMMITTERS] pgsql: Fix parallel index and index-only scans to fall back to serial.

2017-03-08 Thread Robert Haas
Fix parallel index and index-only scans to fall back to serial. Parallel executor nodes can't assume that parallel execution will happen in every case where the plan calls for it, because it might not work out that way. However, parallel index scan and parallel index-only scan failed to do the ri

[COMMITTERS] pgsql: tidbitmap: Support shared iteration.

2017-03-08 Thread Robert Haas
tidbitmap: Support shared iteration. When a shared iterator is used, each call to tbm_shared_iterate() returns a result that has not yet been returned to any process attached to the shared iterator. In other words, each cooperating processes gets a disjoint subset of the full result set, but all