pgsql: Rotate instead of shifting hash join batch number.

2019-12-23 Thread Thomas Munro
Rotate instead of shifting hash join batch number.

Our algorithm for choosing batch numbers turned out not to work
effectively for multi-billion key inner relations.  We would use
more hash bits than we have, and effectively concentrate all tuples
into a smaller number of batches than we intended.  While ideally
we should switch to wider hashes, for now, change the algorithm to
one that effectively gives up bits from the bucket number when we
don't have enough bits.  That means we'll finish up with longer
bucket chains than would be ideal, but that's better than having
batches that don't fit in work_mem and can't be divided.

Batch-patch to all supported releases.

Author: Thomas Munro
Reviewed-by: Tom Lane, thanks also to Tomas Vondra, Alvaro Herrera, Andres 
Freund for testing and discussion
Reported-by: James Coleman
Discussion: https://postgr.es/m/16104-dc11ed911f1ab9df%40postgresql.org

Branch
--
REL9_5_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/893eaf0be8be32f1d6ee364d5d9e2dae0d87ebfd

Modified Files
--
src/backend/executor/nodeHash.c | 21 +
1 file changed, 17 insertions(+), 4 deletions(-)



pgsql: Rotate instead of shifting hash join batch number.

2019-12-23 Thread Thomas Munro
Rotate instead of shifting hash join batch number.

Our algorithm for choosing batch numbers turned out not to work
effectively for multi-billion key inner relations.  We would use
more hash bits than we have, and effectively concentrate all tuples
into a smaller number of batches than we intended.  While ideally
we should switch to wider hashes, for now, change the algorithm to
one that effectively gives up bits from the bucket number when we
don't have enough bits.  That means we'll finish up with longer
bucket chains than would be ideal, but that's better than having
batches that don't fit in work_mem and can't be divided.

Batch-patch to all supported releases.

Author: Thomas Munro
Reviewed-by: Tom Lane, thanks also to Tomas Vondra, Alvaro Herrera, Andres 
Freund for testing and discussion
Reported-by: James Coleman
Discussion: https://postgr.es/m/16104-dc11ed911f1ab9df%40postgresql.org

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/8052aaf521e4885477bd1af100edcf21031e6d11

Modified Files
--
src/backend/executor/nodeHash.c | 13 +
src/include/port/pg_bitutils.h  |  9 +
2 files changed, 18 insertions(+), 4 deletions(-)



pgsql: Rotate instead of shifting hash join batch number.

2019-12-23 Thread Thomas Munro
Rotate instead of shifting hash join batch number.

Our algorithm for choosing batch numbers turned out not to work
effectively for multi-billion key inner relations.  We would use
more hash bits than we have, and effectively concentrate all tuples
into a smaller number of batches than we intended.  While ideally
we should switch to wider hashes, for now, change the algorithm to
one that effectively gives up bits from the bucket number when we
don't have enough bits.  That means we'll finish up with longer
bucket chains than would be ideal, but that's better than having
batches that don't fit in work_mem and can't be divided.

Batch-patch to all supported releases.

Author: Thomas Munro
Reviewed-by: Tom Lane, thanks also to Tomas Vondra, Alvaro Herrera, Andres 
Freund for testing and discussion
Reported-by: James Coleman
Discussion: https://postgr.es/m/16104-dc11ed911f1ab9df%40postgresql.org

Branch
--
REL_11_STABLE

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

Modified Files
--
src/backend/executor/nodeHash.c | 21 +
1 file changed, 17 insertions(+), 4 deletions(-)



pgsql: Rotate instead of shifting hash join batch number.

2019-12-23 Thread Thomas Munro
Rotate instead of shifting hash join batch number.

Our algorithm for choosing batch numbers turned out not to work
effectively for multi-billion key inner relations.  We would use
more hash bits than we have, and effectively concentrate all tuples
into a smaller number of batches than we intended.  While ideally
we should switch to wider hashes, for now, change the algorithm to
one that effectively gives up bits from the bucket number when we
don't have enough bits.  That means we'll finish up with longer
bucket chains than would be ideal, but that's better than having
batches that don't fit in work_mem and can't be divided.

Batch-patch to all supported releases.

Author: Thomas Munro
Reviewed-by: Tom Lane, thanks also to Tomas Vondra, Alvaro Herrera, Andres 
Freund for testing and discussion
Reported-by: James Coleman
Discussion: https://postgr.es/m/16104-dc11ed911f1ab9df%40postgresql.org

Branch
--
master

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

Modified Files
--
src/backend/executor/nodeHash.c | 13 +
src/include/port/pg_bitutils.h  |  9 +
2 files changed, 18 insertions(+), 4 deletions(-)



Re: pgsql: Partially deduplicate interrupt handling for background processe

2019-12-18 Thread Thomas Munro
On Wed, Dec 18, 2019 at 7:18 AM Robert Haas  wrote:
> src/backend/postmaster/checkpointer.c  |  60 ++--

-#include 

I think we still need this for time() (looking at warnings on Windows
BF members).




pgsql: Fix mdsyncfiletag(), take II.

2019-12-13 Thread Thomas Munro
Fix mdsyncfiletag(), take II.

The previous commit failed to consider that FileGetRawDesc() might
not return a valid fd, as discovered on the build farm.  Switch to
using the File interface only.

Back-patch to 12, like the previous commit.

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/7c85be08a2d404ec2a1a6a3b089e7f08d62e5db8

Modified Files
--
src/backend/storage/smgr/md.c | 25 +
1 file changed, 9 insertions(+), 16 deletions(-)



pgsql: Fix mdsyncfiletag(), take II.

2019-12-13 Thread Thomas Munro
Fix mdsyncfiletag(), take II.

The previous commit failed to consider that FileGetRawDesc() might
not return a valid fd, as discovered on the build farm.  Switch to
using the File interface only.

Back-patch to 12, like the previous commit.

Branch
--
REL_12_STABLE

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

Modified Files
--
src/backend/storage/smgr/md.c | 25 +
1 file changed, 9 insertions(+), 16 deletions(-)



pgsql: Don't use _mdfd_getseg() in mdsyncfiletag().

2019-12-13 Thread Thomas Munro
Don't use _mdfd_getseg() in mdsyncfiletag().

_mdfd_getseg() opens all segments up to the requested one.  That
causes problems for mdsyncfiletag(), if mdunlinkfork() has
already unlinked other segment files.  Open the file we want
directly by name instead, if it's not already open.

The consequence of this bug was a rare panic in the checkpointer,
made more likely if you saturated the sync request queue so that
the SYNC_FORGET_REQUEST messages for a given relation were more
likely to be absorbed in separate cycles by the checkpointer.

Back-patch to 12.  Defect in commit 3eb77eba.

Author: Thomas Munro
Reported-by: Justin Pryzby
Discussion: https://postgr.es/m/20191119115759.GI30362%40telsasoft.com

Branch
--
REL_12_STABLE

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

Modified Files
--
src/backend/storage/smgr/md.c | 57 ++-
1 file changed, 40 insertions(+), 17 deletions(-)



pgsql: Don't use _mdfd_getseg() in mdsyncfiletag().

2019-12-13 Thread Thomas Munro
Don't use _mdfd_getseg() in mdsyncfiletag().

_mdfd_getseg() opens all segments up to the requested one.  That
causes problems for mdsyncfiletag(), if mdunlinkfork() has
already unlinked other segment files.  Open the file we want
directly by name instead, if it's not already open.

The consequence of this bug was a rare panic in the checkpointer,
made more likely if you saturated the sync request queue so that
the SYNC_FORGET_REQUEST messages for a given relation were more
likely to be absorbed in separate cycles by the checkpointer.

Back-patch to 12.  Defect in commit 3eb77eba.

Author: Thomas Munro
Reported-by: Justin Pryzby
Discussion: https://postgr.es/m/20191119115759.GI30362%40telsasoft.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/7bb3102cea02101efcbb4c4fba3fdd452a52bdab

Modified Files
--
src/backend/storage/smgr/md.c | 57 ++-
1 file changed, 40 insertions(+), 17 deletions(-)



pgsql: doc: Fix whitespace in syntax.

2019-11-24 Thread Thomas Munro
doc: Fix whitespace in syntax.

Back-patch to 10.

Author: Andreas Karlsson
Discussion: https://postgr.es/m/043acae2-a369-b7fa-be48-1933aa2e82d1%40proxel.se

Branch
--
REL_10_STABLE

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

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



pgsql: doc: Fix whitespace in syntax.

2019-11-24 Thread Thomas Munro
doc: Fix whitespace in syntax.

Back-patch to 10.

Author: Andreas Karlsson
Discussion: https://postgr.es/m/043acae2-a369-b7fa-be48-1933aa2e82d1%40proxel.se

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/14512879364144e6c6b4762902e6a551d709280d

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



pgsql: doc: Fix whitespace in syntax.

2019-11-24 Thread Thomas Munro
doc: Fix whitespace in syntax.

Back-patch to 10.

Author: Andreas Karlsson
Discussion: https://postgr.es/m/043acae2-a369-b7fa-be48-1933aa2e82d1%40proxel.se

Branch
--
REL_12_STABLE

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

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



pgsql: doc: Fix whitespace in syntax.

2019-11-24 Thread Thomas Munro
doc: Fix whitespace in syntax.

Back-patch to 10.

Author: Andreas Karlsson
Discussion: https://postgr.es/m/043acae2-a369-b7fa-be48-1933aa2e82d1%40proxel.se

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/1974853d899db69a72361a9052fd699c9dcd028e

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



pgsql: Handle ReadFile() EOF correctly on Windows.

2019-11-19 Thread Thomas Munro
Handle ReadFile() EOF correctly on Windows.

When ReadFile() encounters the end of a file while reading from
a synchronous handle with an offset provided via OVERLAPPED, it
reports an error instead of returning 0.  By not handling that
(undocumented) result correctly, we caused some noisy LOG
messages about an unknown error code.  Repair.

Back-patch to 12, where we started using pread()/ReadFile() with
an offset.

Reported-by: ZhenHua Cai, Amit Kapila
Diagnosed-by: Juan Jose Santamaria Flecha
Tested-by: Amit Kapila
Discussion: 
https://postgr.es/m/CAA4eK1LK3%2BWRtpz68TiRdpHwxxWm%3D%2Bt1BMf-G68hhQsAQ41PZg%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/6969deeb8d3991cc533a5bcf451ae5eecaa9a517

Modified Files
--
src/port/pread.c | 3 +++
1 file changed, 3 insertions(+)



pgsql: Handle ReadFile() EOF correctly on Windows.

2019-11-19 Thread Thomas Munro
Handle ReadFile() EOF correctly on Windows.

When ReadFile() encounters the end of a file while reading from
a synchronous handle with an offset provided via OVERLAPPED, it
reports an error instead of returning 0.  By not handling that
(undocumented) result correctly, we caused some noisy LOG
messages about an unknown error code.  Repair.

Back-patch to 12, where we started using pread()/ReadFile() with
an offset.

Reported-by: ZhenHua Cai, Amit Kapila
Diagnosed-by: Juan Jose Santamaria Flecha
Tested-by: Amit Kapila
Discussion: 
https://postgr.es/m/CAA4eK1LK3%2BWRtpz68TiRdpHwxxWm%3D%2Bt1BMf-G68hhQsAQ41PZg%40mail.gmail.com

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/2189f49c420f2bf49dfac122f9fbae51c3565594

Modified Files
--
src/port/pread.c | 3 +++
1 file changed, 3 insertions(+)



pgsql: Allow invisible PROMPT2 in psql.

2019-11-18 Thread Thomas Munro
Allow invisible PROMPT2 in psql.

Keep track of the visible width of PROMPT1, and provide %w as a way
for PROMPT2 to generate the same number of spaces.

Author: Thomas Munro, with ideas from others
Reviewed-by: Tom Lane (earlier version)
Discussion: 
https://postgr.es/m/CA%2BhUKG%2BzGd7RigjWbxwhzGW59gUpf76ydQECeGdEdodH6nd__A%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/7f338369ca624ca6c2e4f579623274c88d325bce

Modified Files
--
doc/src/sgml/ref/psql-ref.sgml | 12 ++
src/bin/psql/prompt.c  | 52 ++
2 files changed, 64 insertions(+)



pgsql: Always call ExecShutdownNode() if appropriate.

2019-11-15 Thread Thomas Munro
Always call ExecShutdownNode() if appropriate.

Call ExecShutdownNode() after ExecutePlan()'s loop, rather than at each
break.  We had forgotten to do that in one case.  The omission caused
intermittent "temporary file leak" warnings from multi-batch parallel
hash joins with a LIMIT clause.

Back-patch to 11.  Though the problem exists in theory in earlier
parallel query releases, nothing really depended on it.

Author: Kyotaro Horiguchi
Reviewed-by: Thomas Munro, Amit Kapila
Discussion: 
https://postgr.es/m/2019.212418.262873417235945.horikyota.ntt%40gmail.com

Branch
--
REL_11_STABLE

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

Modified Files
--
src/backend/executor/execMain.c | 23 +++
1 file changed, 7 insertions(+), 16 deletions(-)



pgsql: Always call ExecShutdownNode() if appropriate.

2019-11-15 Thread Thomas Munro
Always call ExecShutdownNode() if appropriate.

Call ExecShutdownNode() after ExecutePlan()'s loop, rather than at each
break.  We had forgotten to do that in one case.  The omission caused
intermittent "temporary file leak" warnings from multi-batch parallel
hash joins with a LIMIT clause.

Back-patch to 11.  Though the problem exists in theory in earlier
parallel query releases, nothing really depended on it.

Author: Kyotaro Horiguchi
Reviewed-by: Thomas Munro, Amit Kapila
Discussion: 
https://postgr.es/m/2019.212418.262873417235945.horikyota.ntt%40gmail.com

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/24897e1a1af27dc759fb41afba2a663ff9af4ef6

Modified Files
--
src/backend/executor/execMain.c | 23 +++
1 file changed, 7 insertions(+), 16 deletions(-)



pgsql: Always call ExecShutdownNode() if appropriate.

2019-11-15 Thread Thomas Munro
Always call ExecShutdownNode() if appropriate.

Call ExecShutdownNode() after ExecutePlan()'s loop, rather than at each
break.  We had forgotten to do that in one case.  The omission caused
intermittent "temporary file leak" warnings from multi-batch parallel
hash joins with a LIMIT clause.

Back-patch to 11.  Though the problem exists in theory in earlier
parallel query releases, nothing really depended on it.

Author: Kyotaro Horiguchi
Reviewed-by: Thomas Munro, Amit Kapila
Discussion: 
https://postgr.es/m/2019.212418.262873417235945.horikyota.ntt%40gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/76cbfcdf3a0dff3f029ca079701418b861ce86c8

Modified Files
--
src/backend/executor/execMain.c | 23 +++
1 file changed, 7 insertions(+), 16 deletions(-)



pgsql: Optimize PredicateLockTuple().

2019-11-10 Thread Thomas Munro
Optimize PredicateLockTuple().

PredicateLockTuple() has a fast exit if tuple was written by the current
transaction, as in that case it already has a lock.  This check can be
performed using TransactionIdIsCurrentTransactionId() instead of
SubTransGetTopmostTransaction(), to avoid any chance of having to hit the
disk.

Author: Ashwin Agrawal, based on a suggestion from Andres Freund
Reviewed-by: Thomas Munro
Discussion: 
https://postgr.es/m/CALfoeiv0k3hkEb3Oqk%3DziWqtyk2Jys1UOK5hwRBNeANT_yX%2Bng%40mail.gmail.com

Branch
--
master

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

Modified Files
--
src/backend/storage/lmgr/predicate.c | 22 +++---
1 file changed, 3 insertions(+), 19 deletions(-)



pgsql: Optimize TransactionIdIsCurrentTransactionId().

2019-11-10 Thread Thomas Munro
Optimize TransactionIdIsCurrentTransactionId().

If the passed in xid is the current top transaction, we can do a fast
check and exit early.  This should work well for the current heap but
also works very well for proposed AMs that don't use a separate xid
for subtransactions.

Author: Ashwin Agrawal, based on a suggestion from Andres Freund
Reviewed-by: Thomas Munro
Discussion: 
https://postgr.es/m/CALfoeiv0k3hkEb3Oqk%3DziWqtyk2Jys1UOK5hwRBNeANT_yX%2Bng%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/695c5977c8bc115029a85dcc1821d7b0136b4e4c

Modified Files
--
src/backend/access/transam/xact.c | 3 +++
1 file changed, 3 insertions(+)



pgsql: Add reusable routine for making arrays unique.

2019-11-06 Thread Thomas Munro
Add reusable routine for making arrays unique.

Introduce qunique() and qunique_arg(), which can be used after qsort()
and qsort_arg() respectively to remove duplicate values.  Use it where
appropriate.

Author: Thomas Munro
Reviewed-by: Tom Lane (in an earlier version)
Discussion: 
https://postgr.es/m/CAEepm%3D2vmFTNpAmwbGGD2WaryM6T3hSDVKQPfUwjdD_5XY6vAA%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/7815e7efdb4ce9575b5d8460beb0dd2569d7ca3a

Modified Files
--
contrib/hstore/hstore_io.c   |  5 +++
contrib/intarray/_int_tool.c | 19 +++
contrib/pg_trgm/trgm_op.c| 25 ++
src/backend/access/nbtree/nbtutils.c | 19 ++-
src/backend/executor/nodeTidscan.c   | 13 ++--
src/backend/utils/adt/acl.c  | 15 +++--
src/backend/utils/adt/tsgistidx.c| 29 ++--
src/backend/utils/adt/tsquery_op.c   | 29 +++-
src/backend/utils/adt/tsvector.c |  5 +--
src/backend/utils/adt/tsvector_op.c  | 59 +---
src/backend/utils/adt/txid.c | 19 ++-
src/backend/utils/cache/syscache.c   | 21 
src/include/lib/qunique.h| 65 
13 files changed, 115 insertions(+), 208 deletions(-)



Re: pgsql: Fix bug that could try to freeze running multixacts.

2019-10-17 Thread Thomas Munro
On Thu, Oct 17, 2019 at 7:36 PM Alvaro Herrera  wrote:
> On 2019-Oct-16, Thomas Munro wrote:
> > Fix bug that could try to freeze running multixacts.
> >
> > Commits 801c2dc7 and 801c2dc7 made it possible for vacuum to
> > try to freeze a multixact that is still running.
>
> Hmm, is that one commit or two commits that are the same?

The second one was supposed to be 53bb309d2d5 but I must have fumbled
a copy-and-paste.  I hope that someone looking for that in the future
will find their way to the email that gives the commit hashes, namely
https://www.postgresql.org/message-id/CA%2BhUKGLXna28c_skfJFtCMc3BDrVbSn%2BEK_kLgFE%3DACPKdGnTA%40mail.gmail.com
.




pgsql: When restoring GUCs in parallel workers, show an error context.

2019-10-16 Thread Thomas Munro
When restoring GUCs in parallel workers, show an error context.

Otherwise it can be hard to see where an error is coming from, when
the parallel worker sets all the GUCs that it received from the
leader.  Bug #15726.  Back-patch to 9.5, where RestoreGUCState()
appeared.

Reported-by: Tiago Anastacio
Reviewed-by: Daniel Gustafsson, Tom Lane
Discussion: https://postgr.es/m/15726-6d67e4fa14f027b3%40postgresql.org

Branch
--
REL_10_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/89a3cdb32a9e1a6545abd43ef385e6bb91d66cb9

Modified Files
--
src/backend/utils/misc/guc.c | 29 +
1 file changed, 29 insertions(+)



pgsql: When restoring GUCs in parallel workers, show an error context.

2019-10-16 Thread Thomas Munro
When restoring GUCs in parallel workers, show an error context.

Otherwise it can be hard to see where an error is coming from, when
the parallel worker sets all the GUCs that it received from the
leader.  Bug #15726.  Back-patch to 9.5, where RestoreGUCState()
appeared.

Reported-by: Tiago Anastacio
Reviewed-by: Daniel Gustafsson, Tom Lane
Discussion: https://postgr.es/m/15726-6d67e4fa14f027b3%40postgresql.org

Branch
--
REL9_6_STABLE

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

Modified Files
--
src/backend/utils/misc/guc.c | 29 +
1 file changed, 29 insertions(+)



pgsql: When restoring GUCs in parallel workers, show an error context.

2019-10-16 Thread Thomas Munro
When restoring GUCs in parallel workers, show an error context.

Otherwise it can be hard to see where an error is coming from, when
the parallel worker sets all the GUCs that it received from the
leader.  Bug #15726.  Back-patch to 9.5, where RestoreGUCState()
appeared.

Reported-by: Tiago Anastacio
Reviewed-by: Daniel Gustafsson, Tom Lane
Discussion: https://postgr.es/m/15726-6d67e4fa14f027b3%40postgresql.org

Branch
--
REL9_5_STABLE

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

Modified Files
--
src/backend/utils/misc/guc.c | 29 +
1 file changed, 29 insertions(+)



pgsql: When restoring GUCs in parallel workers, show an error context.

2019-10-16 Thread Thomas Munro
When restoring GUCs in parallel workers, show an error context.

Otherwise it can be hard to see where an error is coming from, when
the parallel worker sets all the GUCs that it received from the
leader.  Bug #15726.  Back-patch to 9.5, where RestoreGUCState()
appeared.

Reported-by: Tiago Anastacio
Reviewed-by: Daniel Gustafsson, Tom Lane
Discussion: https://postgr.es/m/15726-6d67e4fa14f027b3%40postgresql.org

Branch
--
master

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

Modified Files
--
src/backend/utils/misc/guc.c | 29 +
1 file changed, 29 insertions(+)



pgsql: When restoring GUCs in parallel workers, show an error context.

2019-10-16 Thread Thomas Munro
When restoring GUCs in parallel workers, show an error context.

Otherwise it can be hard to see where an error is coming from, when
the parallel worker sets all the GUCs that it received from the
leader.  Bug #15726.  Back-patch to 9.5, where RestoreGUCState()
appeared.

Reported-by: Tiago Anastacio
Reviewed-by: Daniel Gustafsson, Tom Lane
Discussion: https://postgr.es/m/15726-6d67e4fa14f027b3%40postgresql.org

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/6737111a7ae1fac6b4781250be7c0719c5a7ed48

Modified Files
--
src/backend/utils/misc/guc.c | 29 +
1 file changed, 29 insertions(+)



pgsql: When restoring GUCs in parallel workers, show an error context.

2019-10-16 Thread Thomas Munro
When restoring GUCs in parallel workers, show an error context.

Otherwise it can be hard to see where an error is coming from, when
the parallel worker sets all the GUCs that it received from the
leader.  Bug #15726.  Back-patch to 9.5, where RestoreGUCState()
appeared.

Reported-by: Tiago Anastacio
Reviewed-by: Daniel Gustafsson, Tom Lane
Discussion: https://postgr.es/m/15726-6d67e4fa14f027b3%40postgresql.org

Branch
--
REL_12_STABLE

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

Modified Files
--
src/backend/utils/misc/guc.c | 29 +
1 file changed, 29 insertions(+)



pgsql: Fix bug that could try to freeze running multixacts.

2019-10-16 Thread Thomas Munro
Fix bug that could try to freeze running multixacts.

Commits 801c2dc7 and 801c2dc7 made it possible for vacuum to
try to freeze a multixact that is still running.  That was
prevented by a check, but raised an error.  Repair.

Back-patch all the way.

Author: Nathan Bossart, Jeremy Schneider
Reported-by: Jeremy Schneider
Reviewed-by: Jim Nasby, Thomas Munro
Discussion: 
https://postgr.es/m/DAFB8AFF-2F05-4E33-AD7F-FF8B0F760C17%40amazon.com

Branch
--
REL9_4_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/080cf32d22317591cd8891c797a4d925cf1dbda2

Modified Files
--
src/backend/commands/vacuum.c | 10 --
1 file changed, 8 insertions(+), 2 deletions(-)



pgsql: Fix bug that could try to freeze running multixacts.

2019-10-16 Thread Thomas Munro
Fix bug that could try to freeze running multixacts.

Commits 801c2dc7 and 801c2dc7 made it possible for vacuum to
try to freeze a multixact that is still running.  That was
prevented by a check, but raised an error.  Repair.

Back-patch all the way.

Author: Nathan Bossart, Jeremy Schneider
Reported-by: Jeremy Schneider
Reviewed-by: Jim Nasby, Thomas Munro
Discussion: 
https://postgr.es/m/DAFB8AFF-2F05-4E33-AD7F-FF8B0F760C17%40amazon.com

Branch
--
REL9_5_STABLE

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

Modified Files
--
src/backend/commands/vacuum.c | 10 --
1 file changed, 8 insertions(+), 2 deletions(-)



pgsql: Fix bug that could try to freeze running multixacts.

2019-10-16 Thread Thomas Munro
Fix bug that could try to freeze running multixacts.

Commits 801c2dc7 and 801c2dc7 made it possible for vacuum to
try to freeze a multixact that is still running.  That was
prevented by a check, but raised an error.  Repair.

Back-patch all the way.

Author: Nathan Bossart, Jeremy Schneider
Reported-by: Jeremy Schneider
Reviewed-by: Jim Nasby, Thomas Munro
Discussion: 
https://postgr.es/m/DAFB8AFF-2F05-4E33-AD7F-FF8B0F760C17%40amazon.com

Branch
--
REL9_6_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/0640f032abe58973d254a113b19d2dec981fcf2f

Modified Files
--
src/backend/commands/vacuum.c | 10 --
1 file changed, 8 insertions(+), 2 deletions(-)



pgsql: Fix bug that could try to freeze running multixacts.

2019-10-16 Thread Thomas Munro
Fix bug that could try to freeze running multixacts.

Commits 801c2dc7 and 801c2dc7 made it possible for vacuum to
try to freeze a multixact that is still running.  That was
prevented by a check, but raised an error.  Repair.

Back-patch all the way.

Author: Nathan Bossart, Jeremy Schneider
Reported-by: Jeremy Schneider
Reviewed-by: Jim Nasby, Thomas Munro
Discussion: 
https://postgr.es/m/DAFB8AFF-2F05-4E33-AD7F-FF8B0F760C17%40amazon.com

Branch
--
master

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

Modified Files
--
src/backend/commands/vacuum.c | 10 --
1 file changed, 8 insertions(+), 2 deletions(-)



pgsql: Fix bug that could try to freeze running multixacts.

2019-10-16 Thread Thomas Munro
Fix bug that could try to freeze running multixacts.

Commits 801c2dc7 and 801c2dc7 made it possible for vacuum to
try to freeze a multixact that is still running.  That was
prevented by a check, but raised an error.  Repair.

Back-patch all the way.

Author: Nathan Bossart, Jeremy Schneider
Reported-by: Jeremy Schneider
Reviewed-by: Jim Nasby, Thomas Munro
Discussion: 
https://postgr.es/m/DAFB8AFF-2F05-4E33-AD7F-FF8B0F760C17%40amazon.com

Branch
--
REL_11_STABLE

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

Modified Files
--
src/backend/commands/vacuum.c | 10 --
1 file changed, 8 insertions(+), 2 deletions(-)



pgsql: Fix bug that could try to freeze running multixacts.

2019-10-16 Thread Thomas Munro
Fix bug that could try to freeze running multixacts.

Commits 801c2dc7 and 801c2dc7 made it possible for vacuum to
try to freeze a multixact that is still running.  That was
prevented by a check, but raised an error.  Repair.

Back-patch all the way.

Author: Nathan Bossart, Jeremy Schneider
Reported-by: Jeremy Schneider
Reviewed-by: Jim Nasby, Thomas Munro
Discussion: 
https://postgr.es/m/DAFB8AFF-2F05-4E33-AD7F-FF8B0F760C17%40amazon.com

Branch
--
REL_10_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/583d86f92aabdccb569e5d1faa3284f717bb1d64

Modified Files
--
src/backend/commands/vacuum.c | 10 --
1 file changed, 8 insertions(+), 2 deletions(-)



pgsql: Fix bug that could try to freeze running multixacts.

2019-10-16 Thread Thomas Munro
Fix bug that could try to freeze running multixacts.

Commits 801c2dc7 and 801c2dc7 made it possible for vacuum to
try to freeze a multixact that is still running.  That was
prevented by a check, but raised an error.  Repair.

Back-patch all the way.

Author: Nathan Bossart, Jeremy Schneider
Reported-by: Jeremy Schneider
Reviewed-by: Jim Nasby, Thomas Munro
Discussion: 
https://postgr.es/m/DAFB8AFF-2F05-4E33-AD7F-FF8B0F760C17%40amazon.com

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/486a8f152233520b0c841d2e9c32b1ae7949e85c

Modified Files
--
src/backend/commands/vacuum.c | 10 --
1 file changed, 8 insertions(+), 2 deletions(-)



pgsql: Remove obsolete collation test.

2019-10-15 Thread Thomas Munro
Remove obsolete collation test.

The previous commit forgot to remove this test, which no longer
holds on all systems.

Branch
--
master

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

Modified Files
--
src/test/regress/expected/collate.linux.utf8.out | 2 --
src/test/regress/sql/collate.linux.utf8.sql  | 1 -
2 files changed, 3 deletions(-)



pgsql: Use libc version as a collation version on glibc systems.

2019-10-15 Thread Thomas Munro
Use libc version as a collation version on glibc systems.

Using glibc's version string to detect potential collation definition
changes is not 100% reliable, but it's better than nothing.  Currently
this affects only collations explicitly provided by "libc".  More work
will be needed to handle the default collation.

Author: Thomas Munro, based on a suggestion from Christoph Berg
Reviewed-by: Peter Eisentraut
Discussion: 
https://postgr.es/m/4b76c6d4-ae5e-0dc6-7d0d-b5c796a07e34%402ndquadrant.com

Branch
--
master

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

Modified Files
--
doc/src/sgml/ref/alter_collation.sgml | 10 ++
src/backend/utils/adt/pg_locale.c | 14 --
src/bin/pg_dump/t/002_pg_dump.pl  |  4 ++--
3 files changed, 24 insertions(+), 4 deletions(-)



Re: pgsql: Reorder EPQ work, to fix rowmark related bugs and improve effici

2019-09-09 Thread Thomas Munro
On Tue, Sep 10, 2019 at 12:32 AM Andres Freund  wrote:
> Reorder EPQ work, to fix rowmark related bugs and improve efficiency.

Did this cause the following failure in eval-plan-qual on REL_12_STABLE?

https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=prairiedog&dt=2019-09-09%2019%3A08%3A41

-- 
Thomas Munro
https://enterprisedb.com




pgsql: Avoid catalog lookups in RelationAllowsEarlyPruning().

2019-08-28 Thread Thomas Munro
Avoid catalog lookups in RelationAllowsEarlyPruning().

RelationAllowsEarlyPruning() performed a catalog scan, but is used
in two contexts where that was a bad idea:

1.  In heap_page_prune_opt(), which runs very frequently in some large
scans.  This caused major performance problems in a field report
that was easy to reproduce.

2.  In TestForOldSnapshot(), which runs while we hold a buffer content
lock.  It's not clear if this was guaranteed to be free of buffer
deadlock risk.

The check was introduced in commit 2cc41acd8 and defended against a
real problem: 9.6's hash indexes have no page LSN and so we can't
allow early pruning (ie the snapshot-too-old feature).  We can remove
the check from all later releases though: hash indexes are now logged,
and there is no way to create UNLOGGED indexes on regular logged
tables.

If a future release allows such a combination, it might need to put
a similar check in place, but it'll need some more thought.

Back-patch to 10.

Author: Thomas Munro
Reviewed-by: Tom Lane, who spotted the second problem
Discussion: 
https://postgr.es/m/CA%2BhUKGKT8oTkp5jw_U4p0S-7UG9zsvtw_M47Y285bER6a2gD%2Bg%40mail.gmail.com
Discussion: 
https://postgr.es/m/CAA4eK1%2BWy%2BN4eE5zPm765h68LrkWc3Biu_8rzzi%2BOYX4j%2BiHRw%40mail.gmail.com

Branch
--
REL_10_STABLE

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

Modified Files
--
src/backend/utils/cache/relcache.c | 42 --
src/include/utils/rel.h|  1 -
src/include/utils/snapmgr.h|  1 -
3 files changed, 44 deletions(-)



pgsql: Avoid catalog lookups in RelationAllowsEarlyPruning().

2019-08-28 Thread Thomas Munro
Avoid catalog lookups in RelationAllowsEarlyPruning().

RelationAllowsEarlyPruning() performed a catalog scan, but is used
in two contexts where that was a bad idea:

1.  In heap_page_prune_opt(), which runs very frequently in some large
scans.  This caused major performance problems in a field report
that was easy to reproduce.

2.  In TestForOldSnapshot(), which runs while we hold a buffer content
lock.  It's not clear if this was guaranteed to be free of buffer
deadlock risk.

The check was introduced in commit 2cc41acd8 and defended against a
real problem: 9.6's hash indexes have no page LSN and so we can't
allow early pruning (ie the snapshot-too-old feature).  We can remove
the check from all later releases though: hash indexes are now logged,
and there is no way to create UNLOGGED indexes on regular logged
tables.

If a future release allows such a combination, it might need to put
a similar check in place, but it'll need some more thought.

Back-patch to 10.

Author: Thomas Munro
Reviewed-by: Tom Lane, who spotted the second problem
Discussion: 
https://postgr.es/m/CA%2BhUKGKT8oTkp5jw_U4p0S-7UG9zsvtw_M47Y285bER6a2gD%2Bg%40mail.gmail.com
Discussion: 
https://postgr.es/m/CAA4eK1%2BWy%2BN4eE5zPm765h68LrkWc3Biu_8rzzi%2BOYX4j%2BiHRw%40mail.gmail.com

Branch
--
REL_11_STABLE

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

Modified Files
--
src/backend/utils/cache/relcache.c | 42 --
src/include/utils/rel.h|  1 -
src/include/utils/snapmgr.h|  1 -
3 files changed, 44 deletions(-)



pgsql: Avoid catalog lookups in RelationAllowsEarlyPruning().

2019-08-28 Thread Thomas Munro
Avoid catalog lookups in RelationAllowsEarlyPruning().

RelationAllowsEarlyPruning() performed a catalog scan, but is used
in two contexts where that was a bad idea:

1.  In heap_page_prune_opt(), which runs very frequently in some large
scans.  This caused major performance problems in a field report
that was easy to reproduce.

2.  In TestForOldSnapshot(), which runs while we hold a buffer content
lock.  It's not clear if this was guaranteed to be free of buffer
deadlock risk.

The check was introduced in commit 2cc41acd8 and defended against a
real problem: 9.6's hash indexes have no page LSN and so we can't
allow early pruning (ie the snapshot-too-old feature).  We can remove
the check from all later releases though: hash indexes are now logged,
and there is no way to create UNLOGGED indexes on regular logged
tables.

If a future release allows such a combination, it might need to put
a similar check in place, but it'll need some more thought.

Back-patch to 10.

Author: Thomas Munro
Reviewed-by: Tom Lane, who spotted the second problem
Discussion: 
https://postgr.es/m/CA%2BhUKGKT8oTkp5jw_U4p0S-7UG9zsvtw_M47Y285bER6a2gD%2Bg%40mail.gmail.com
Discussion: 
https://postgr.es/m/CAA4eK1%2BWy%2BN4eE5zPm765h68LrkWc3Biu_8rzzi%2BOYX4j%2BiHRw%40mail.gmail.com

Branch
--
REL_12_STABLE

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

Modified Files
--
src/backend/utils/cache/relcache.c | 42 --
src/include/utils/rel.h|  1 -
src/include/utils/snapmgr.h|  1 -
3 files changed, 44 deletions(-)



pgsql: Avoid catalog lookups in RelationAllowsEarlyPruning().

2019-08-28 Thread Thomas Munro
Avoid catalog lookups in RelationAllowsEarlyPruning().

RelationAllowsEarlyPruning() performed a catalog scan, but is used
in two contexts where that was a bad idea:

1.  In heap_page_prune_opt(), which runs very frequently in some large
scans.  This caused major performance problems in a field report
that was easy to reproduce.

2.  In TestForOldSnapshot(), which runs while we hold a buffer content
lock.  It's not clear if this was guaranteed to be free of buffer
deadlock risk.

The check was introduced in commit 2cc41acd8 and defended against a
real problem: 9.6's hash indexes have no page LSN and so we can't
allow early pruning (ie the snapshot-too-old feature).  We can remove
the check from all later releases though: hash indexes are now logged,
and there is no way to create UNLOGGED indexes on regular logged
tables.

If a future release allows such a combination, it might need to put
a similar check in place, but it'll need some more thought.

Back-patch to 10.

Author: Thomas Munro
Reviewed-by: Tom Lane, who spotted the second problem
Discussion: 
https://postgr.es/m/CA%2BhUKGKT8oTkp5jw_U4p0S-7UG9zsvtw_M47Y285bER6a2gD%2Bg%40mail.gmail.com
Discussion: 
https://postgr.es/m/CAA4eK1%2BWy%2BN4eE5zPm765h68LrkWc3Biu_8rzzi%2BOYX4j%2BiHRw%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/720b59b55b84c8a346098cdbf3d34c7e554b0bf5

Modified Files
--
src/backend/utils/cache/relcache.c | 42 --
src/include/utils/rel.h|  1 -
src/include/utils/snapmgr.h|  1 -
3 files changed, 44 deletions(-)



pgsql: Don't rely on llvm::make_unique.

2019-08-24 Thread Thomas Munro
Don't rely on llvm::make_unique.

Bleeding-edge LLVM has stopped supplying replacements for various
C++14 library features, for people on older C++ versions.  Since we're
not ready to require C++14 yet, just use plain old new instead of
make_unique.  As revealed by buildfarm animal seawasp.

Back-patch to 11.

Reviewed-by: Andres Freund
Discussion: 
https://postgr.es/m/CA%2BhUKGJWG7unNqmkxg7nC5o3o-0p2XP6co4r%3D9epqYMm8UY4Mw%40mail.gmail.com

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/54ff1c34f11b3f899be66fa55f85dbace83be741

Modified Files
--
src/backend/jit/llvm/llvmjit_inline.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Don't rely on llvm::make_unique.

2019-08-24 Thread Thomas Munro
Don't rely on llvm::make_unique.

Bleeding-edge LLVM has stopped supplying replacements for various
C++14 library features, for people on older C++ versions.  Since we're
not ready to require C++14 yet, just use plain old new instead of
make_unique.  As revealed by buildfarm animal seawasp.

Back-patch to 11.

Reviewed-by: Andres Freund
Discussion: 
https://postgr.es/m/CA%2BhUKGJWG7unNqmkxg7nC5o3o-0p2XP6co4r%3D9epqYMm8UY4Mw%40mail.gmail.com

Branch
--
REL_11_STABLE

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

Modified Files
--
src/backend/jit/llvm/llvmjit_inline.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Don't rely on llvm::make_unique.

2019-08-24 Thread Thomas Munro
Don't rely on llvm::make_unique.

Bleeding-edge LLVM has stopped supplying replacements for various
C++14 library features, for people on older C++ versions.  Since we're
not ready to require C++14 yet, just use plain old new instead of
make_unique.  As revealed by buildfarm animal seawasp.

Back-patch to 11.

Reviewed-by: Andres Freund
Discussion: 
https://postgr.es/m/CA%2BhUKGJWG7unNqmkxg7nC5o3o-0p2XP6co4r%3D9epqYMm8UY4Mw%40mail.gmail.com

Branch
--
master

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

Modified Files
--
src/backend/jit/llvm/llvmjit_inline.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



Re: pgsql: Fix incidental warnings from cpluspluscheck.

2019-08-18 Thread Thomas Munro
On Mon, Aug 19, 2019 at 11:01 AM Tom Lane  wrote:
> Remove use of "register" keyword in hashfn.c.  It's obsolescent
> according to recent C++ compilers, and no modern C compiler pays
> much attention to it either.

We have some more of those:

src/backend/regex/regexec.c
src/common/md5.c
src/include/port/atomics/arch-x86.h
src/include/storage/s_lock.h
src/pl/plperl/ppport.h

-- 
Thomas Munro
https://enterprisedb.com




Re: pgsql: Adjust string comparison in jsonpath

2019-08-11 Thread Thomas Munro
On Mon, Aug 12, 2019 at 10:30 AM Alexander Korotkov
 wrote:
> > > This appears to have upset prion when testing on en_US.iso885915.
> >
> > Also lapwing's "InstallCheck-fr_FR" stage crashed on this commit, when
> > running JSON queries, on HEAD and REL_12_STABLE:

> Thank you for pointing!  I hope I can investigate this shortly.

Hi Alexander,

I can reproduce this by running LANG="fr_FR.ISO8859-1" initdb, then
running installcheck (on some other OSes that might be called just
"fr_FR").  See this comment in mbutils.c:

 * The functions return a palloc'd, null-terminated string if conversion
 * is required.  However, if no conversion is performed, the given source
 * string pointer is returned as-is.

You call pfree() on the result of pg_server_to_any() without checking
if it just returned in the input pointer (for example, it does that if
you give it an empty string).  That triggers an assertion failure
somewhere inside pfree().  The following fixes that for me, and is
based on code I found elsewhere in the tree.

--- a/src/backend/utils/adt/jsonpath_exec.c
+++ b/src/backend/utils/adt/jsonpath_exec.c
@@ -2028,8 +2028,10 @@ compareStrings(const char *mbstr1, int mblen1,
cmp = binaryCompareStrings(utf8str1, strlen(utf8str1),

utf8str2, strlen(utf8str2));

-   pfree(utf8str1);
-   pfree(utf8str2);
+   if (mbstr1 != utf8str1)
+   pfree(utf8str1);
+   if (mbstr2 != utf8str2)
+   pfree(utf8str2);

With that fixed it no longer crashes, but then the regression test
fails due to differences in the output, which look like locale
ordering differences.

-- 
Thomas Munro
https://enterprisedb.com




Re: pgsql: Adjust string comparison in jsonpath

2019-08-11 Thread Thomas Munro
On Mon, Aug 12, 2019 at 9:04 AM Andrew Dunstan
 wrote:
> On 8/11/19 4:10 PM, Alexander Korotkov wrote:
> > Adjust string comparison in jsonpath
> >
> > We have implemented jsonpath string comparison using default database 
> > locale.
> > However, standard requires us to compare Unicode codepoints.  This commit
> > implements that, but for performance reasons we still use per-byte 
> > comparison
> > for "==" operator.  Thus, for consistency other comparison operators do 
> > per-byte
> > comparison if Unicode codepoints appear to be equal.
> >
> > In some edge cases, when same Unicode codepoints have different binary
> > representations in database encoding, we diverge standard to achieve better
> > performance of "==" operator.  In future to implement strict standard
> > conformance, we can do normalization of input JSON strings.
> >
>
>
> This appears to have upset prion when testing on en_US.iso885915.

Also lapwing's "InstallCheck-fr_FR" stage crashed on this commit, when
running JSON queries, on HEAD and REL_12_STABLE:

https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=lapwing&dt=2019-08-11%2021%3A02%3A32
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=lapwing&dt=2019-08-11%2020%3A40%3A07

-- 
Thomas Munro
https://enterprisedb.com




pgsql: Avoid macro clash with LLVM 9.

2019-07-28 Thread Thomas Munro
Avoid macro clash with LLVM 9.

Early previews of LLVM 9 reveal that our Min() macro causes compiler
errors in LLVM headers reached by the #include directives in
llvmjit_inline.cpp.  Let's just undefine it.  Per buildfarm animal
seawasp.  Back-patch to 11.

Reviewed-by: Fabien Coelho, Tom Lane
Discussion: https://postgr.es/m/20190606173216.GA6306%40alvherre.pgsql

Branch
--
master

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

Modified Files
--
src/backend/jit/llvm/llvmjit_inline.cpp | 3 +++
1 file changed, 3 insertions(+)



pgsql: Avoid macro clash with LLVM 9.

2019-07-28 Thread Thomas Munro
Avoid macro clash with LLVM 9.

Early previews of LLVM 9 reveal that our Min() macro causes compiler
errors in LLVM headers reached by the #include directives in
llvmjit_inline.cpp.  Let's just undefine it.  Per buildfarm animal
seawasp.  Back-patch to 11.

Reviewed-by: Fabien Coelho, Tom Lane
Discussion: https://postgr.es/m/20190606173216.GA6306%40alvherre.pgsql

Branch
--
REL_11_STABLE

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

Modified Files
--
src/backend/jit/llvm/llvmjit_inline.cpp | 3 +++
1 file changed, 3 insertions(+)



pgsql: Avoid macro clash with LLVM 9.

2019-07-28 Thread Thomas Munro
Avoid macro clash with LLVM 9.

Early previews of LLVM 9 reveal that our Min() macro causes compiler
errors in LLVM headers reached by the #include directives in
llvmjit_inline.cpp.  Let's just undefine it.  Per buildfarm animal
seawasp.  Back-patch to 11.

Reviewed-by: Fabien Coelho, Tom Lane
Discussion: https://postgr.es/m/20190606173216.GA6306%40alvherre.pgsql

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/180825fe43ece9bf13c27929b7fdeec5a457e9c3

Modified Files
--
src/backend/jit/llvm/llvmjit_inline.cpp | 3 +++
1 file changed, 3 insertions(+)



pgsql: Fix LDAP test instability.

2019-07-25 Thread Thomas Munro
Fix LDAP test instability.

After starting slapd, wait until it can accept a connection before
beginning the real test work.  This avoids occasional test failures.
Back-patch to 11, where the LDAP tests arrived.

Author: Thomas Munro
Reviewed-by: Michael Paquier
Discussion: https://postgr.es/m/20190719033013.GI1859%40paquier.xyz

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/77d5dea386f5747ca56bac1ae745e4604111adda

Modified Files
--
src/test/ldap/t/001_auth.pl | 16 
1 file changed, 16 insertions(+)



pgsql: Fix LDAP test instability.

2019-07-25 Thread Thomas Munro
Fix LDAP test instability.

After starting slapd, wait until it can accept a connection before
beginning the real test work.  This avoids occasional test failures.
Back-patch to 11, where the LDAP tests arrived.

Author: Thomas Munro
Reviewed-by: Michael Paquier
Discussion: https://postgr.es/m/20190719033013.GI1859%40paquier.xyz

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/3964d3bce9ca1e45301f99800fc798768f7b57ac

Modified Files
--
src/test/ldap/t/001_auth.pl | 16 
1 file changed, 16 insertions(+)



pgsql: Fix LDAP test instability.

2019-07-25 Thread Thomas Munro
Fix LDAP test instability.

After starting slapd, wait until it can accept a connection before
beginning the real test work.  This avoids occasional test failures.
Back-patch to 11, where the LDAP tests arrived.

Author: Thomas Munro
Reviewed-by: Michael Paquier
Discussion: https://postgr.es/m/20190719033013.GI1859%40paquier.xyz

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/27cd521e6e7084516fbc5e5a8492316b3ba8c25c

Modified Files
--
src/test/ldap/t/001_auth.pl | 16 
1 file changed, 16 insertions(+)



pgsql: Move some md.c-specific logic from smgr.c to md.c.

2019-07-16 Thread Thomas Munro
Move some md.c-specific logic from smgr.c to md.c.

Potential future SMGR implementations may not want to create
tablespace directories when creating an SMGR relation.  Move that
logic to mdcreate().  Move the initialization of md-specific
data structures from smgropen() to a new callback mdopen().

Author: Thomas Munro
Reviewed-by: Shawn Debnath (as part of an earlier patch set)
Discussion: 
https://postgr.es/m/CA%2BhUKG%2BOZqOiOuDm5tC5DyQZtJ3FH4%2BFSVMqtdC4P1atpJ%2Bqhg%40mail.gmail.com

Branch
--
master

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

Modified Files
--
src/backend/storage/smgr/md.c   | 37 +++--
src/backend/storage/smgr/smgr.c | 33 -
src/include/storage/md.h|  1 +
3 files changed, 36 insertions(+), 35 deletions(-)



pgsql: Provide pgbench --show-script to dump built-in scripts.

2019-07-15 Thread Thomas Munro
Provide pgbench --show-script to dump built-in scripts.

Author: Fabien Coelho
Reviewed-by: Ibrar Ahmed
Discussion: https://postgr.es/m/alpine.DEB.2.21.1904081737390.5867%40lancre

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/5823677acc567d7790cc68972de12f6718913d7d

Modified Files
--
doc/src/sgml/ref/pgbench.sgml  | 11 ++-
src/bin/pgbench/pgbench.c  | 12 +++-
src/bin/pgbench/t/002_pgbench_no_server.pl |  9 +
3 files changed, 30 insertions(+), 2 deletions(-)



pgsql: Report the time taken by pgbench initialization steps.

2019-07-15 Thread Thomas Munro
Report the time taken by pgbench initialization steps.

Author: Fabien Coelho
Reviewed-by: Ibrar Ahmed
Discussion: https://postgr.es/m/alpine.DEB.2.21.1904061810510.3678%40lancre

Branch
--
master

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

Modified Files
--
src/bin/pgbench/pgbench.c| 38 +++-
src/bin/pgbench/t/001_pgbench_with_server.pl |  8 +++---
2 files changed, 42 insertions(+), 4 deletions(-)



pgsql: Provide XLogRecGetFullXid().

2019-07-14 Thread Thomas Munro
Provide XLogRecGetFullXid().

In order to be able to work with FullTransactionId values during replay
without increasing the size of the WAL, infer the epoch.  In general we
can't do that safely, but during replay we can because we know that
nextFullXid can't advance concurrently.

Prevent frontend code from seeing this new function, due to the above
restriction.  Perhaps in future it will be possible to extract the value
entirely from independent WAL records, and then this restriction can be
lifted.

Author: Thomas Munro, based on earlier code from Andres Freund
Discussion: 
https://postgr.es/m/CA%2BhUKG%2BmLmuDjMi6o1dxkKvGRL56Y2Rz%2BiXAcrZV03G9ZuFQ8Q%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/67b9b3ca328392f9afc4e66fe03564f5fc87feff

Modified Files
--
src/backend/access/transam/xlogreader.c | 35 +
src/include/access/xlogreader.h |  8 
2 files changed, 43 insertions(+)



pgsql: Fix documentation for pgbench tpcb-like.

2019-07-13 Thread Thomas Munro
Fix documentation for pgbench tpcb-like.

We choose a random value for delta, not balance.  Back-patch to 9.6 where
the mistake arrived.

Author: Fabien Coelho
Discussion: https://postgr.es/m/alpine.DEB.2.21.1904081752210.5867@lancre

Branch
--
REL9_6_STABLE

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

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



pgsql: Fix documentation for pgbench tpcb-like.

2019-07-13 Thread Thomas Munro
Fix documentation for pgbench tpcb-like.

We choose a random value for delta, not balance.  Back-patch to 9.6 where
the mistake arrived.

Author: Fabien Coelho
Discussion: https://postgr.es/m/alpine.DEB.2.21.1904081752210.5867@lancre

Branch
--
REL_11_STABLE

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

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



pgsql: Fix documentation for pgbench tpcb-like.

2019-07-13 Thread Thomas Munro
Fix documentation for pgbench tpcb-like.

We choose a random value for delta, not balance.  Back-patch to 9.6 where
the mistake arrived.

Author: Fabien Coelho
Discussion: https://postgr.es/m/alpine.DEB.2.21.1904081752210.5867@lancre

Branch
--
REL_10_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/15f2f2759ecd0c2cf2a72644f3b1407478876968

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



pgsql: Fix documentation for pgbench tpcb-like.

2019-07-13 Thread Thomas Munro
Fix documentation for pgbench tpcb-like.

We choose a random value for delta, not balance.  Back-patch to 9.6 where
the mistake arrived.

Author: Fabien Coelho
Discussion: https://postgr.es/m/alpine.DEB.2.21.1904081752210.5867@lancre

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/0369f4736665864edd7bf43736df190afa223c4c

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



pgsql: Fix documentation for pgbench tpcb-like.

2019-07-13 Thread Thomas Munro
Fix documentation for pgbench tpcb-like.

We choose a random value for delta, not balance.  Back-patch to 9.6 where
the mistake arrived.

Author: Fabien Coelho
Discussion: https://postgr.es/m/alpine.DEB.2.21.1904081752210.5867@lancre

Branch
--
REL_12_STABLE

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

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



pgsql: Fix tab completion for UPDATE.

2019-07-12 Thread Thomas Munro
Fix tab completion for UPDATE.

Previously it suggested an extra "=" after "SET x=".

Reported-by: Kyotaro Horiguchi
Discussion: 
https://postgr.es/m/CA%2BhUKGLk%3D0yLDjfviONJLzcHEzygj%3Dx6VbGH43LnXbBUvQb52g%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/5b51bbfbd52a444a490247e66751d6a47d2ba7dd

Modified Files
--
src/bin/psql/tab-complete.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Tab completion for CREATE TYPE.

2019-07-12 Thread Thomas Munro
Tab completion for CREATE TYPE.

Author: Thomas Munro
Reviewed-by: Kyotaro Horiguchi
Discussion: 
https://postgr.es/m/CA%2BhUKGLk%3D0yLDjfviONJLzcHEzygj%3Dx6VbGH43LnXbBUvQb52g%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/7bdc6556fb325582b02e9a6931c38f873a0c46a0

Modified Files
--
src/bin/psql/tab-complete.c | 39 +++
1 file changed, 39 insertions(+)



pgsql: Introduce timed waits for condition variables.

2019-07-12 Thread Thomas Munro
Introduce timed waits for condition variables.

Provide ConditionVariableTimedSleep(), like ConditionVariableSleep()
but with a timeout argument.

Author: Shawn Debnath
Reviewed-by: Kyotaro Horiguchi, Thomas Munro
Discussion: 
https://postgr.es/m/eeb06007ccfe46e399df6af18bfcd...@ex13d05uwc002.ant.amazon.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/1321509fa43293615c4e5fa5dc8eed5286f479b1

Modified Files
--
src/backend/storage/lmgr/condition_variable.c | 61 ---
src/include/storage/condition_variable.h  |  2 +
2 files changed, 56 insertions(+), 7 deletions(-)



pgsql: Forward received condition variable signals on cancel.

2019-07-12 Thread Thomas Munro
Forward received condition variable signals on cancel.

After a process decides not to wait for a condition variable, it can
still consume a signal before it reaches ConditionVariableCancelSleep().
In that case, pass the signal on to another waiter if possible, so that
a signal doesn't go missing when there is another process ready to
receive it.

Author: Thomas Munro
Reviewed-by: Shawn Debnath
Discussion: 
https://postgr.es/m/CA%2BhUKGLQ_RW%2BXs8znDn36e-%2Bmq2--zrPemBqTQ8eKT-VO1OF4Q%40mail.gmail.com

Branch
--
master

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

Modified Files
--
src/backend/storage/lmgr/condition_variable.c | 11 +++
1 file changed, 11 insertions(+)



pgsql: Warn if wal_level is too low when creating a publication.

2019-07-12 Thread Thomas Munro
Warn if wal_level is too low when creating a publication.

Provide a hint to users that they need to increase wal_level before
subscriptions can work.

Author: Lucas Viecelli, with some adjustments by Thomas Munro
Reviewed-by: Tom Lane
Discussion: 
https://postgr.es/m/CAPjy-57rn5Y9g4e5u--eSOP-7P4QrE9uOZmT2ZcUebF8qxsYhg%40mail.gmail.com

Branch
--
master

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

Modified Files
--
src/backend/commands/publicationcmds.c   |  8 
src/test/regress/expected/object_address.out |  3 +++
src/test/regress/expected/publication.out| 13 +
src/test/regress/sql/object_address.sql  |  3 +++
src/test/regress/sql/publication.sql | 13 +
5 files changed, 40 insertions(+)



pgsql: Pass QueryEnvironment down to EvalPlanQual's EState.

2019-07-09 Thread Thomas Munro
Pass QueryEnvironment down to EvalPlanQual's EState.

Otherwise the executor can't see trigger transition tables during
EPQ evaluation.  Fixes bug #15900 and almost certainly also #15720.
Back-patch to 10, where trigger transition tables landed.

Author: Alex Aktsipetrov
Reviewed-by: Thomas Munro, Tom Lane
Discussion: https://postgr.es/m/15900-bc482754fe8d7415%40postgresql.org
Discussion: https://postgr.es/m/15720-38c2b29e5d720187%40postgresql.org

Branch
--
REL_10_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/72b526779a9320e2dd8ff63237fbaf2e933b5c34

Modified Files
--
src/backend/executor/execMain.c | 1 +
1 file changed, 1 insertion(+)



pgsql: Pass QueryEnvironment down to EvalPlanQual's EState.

2019-07-09 Thread Thomas Munro
Pass QueryEnvironment down to EvalPlanQual's EState.

Otherwise the executor can't see trigger transition tables during
EPQ evaluation.  Fixes bug #15900 and almost certainly also #15720.
Back-patch to 10, where trigger transition tables landed.

Author: Alex Aktsipetrov
Reviewed-by: Thomas Munro, Tom Lane
Discussion: https://postgr.es/m/15900-bc482754fe8d7415%40postgresql.org
Discussion: https://postgr.es/m/15720-38c2b29e5d720187%40postgresql.org

Branch
--
master

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

Modified Files
--
src/backend/executor/execMain.c | 1 +
1 file changed, 1 insertion(+)



pgsql: Pass QueryEnvironment down to EvalPlanQual's EState.

2019-07-09 Thread Thomas Munro
Pass QueryEnvironment down to EvalPlanQual's EState.

Otherwise the executor can't see trigger transition tables during
EPQ evaluation.  Fixes bug #15900 and almost certainly also #15720.
Back-patch to 10, where trigger transition tables landed.

Author: Alex Aktsipetrov
Reviewed-by: Thomas Munro, Tom Lane
Discussion: https://postgr.es/m/15900-bc482754fe8d7415%40postgresql.org
Discussion: https://postgr.es/m/15720-38c2b29e5d720187%40postgresql.org

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/9509173d24309b4ef46790921c07dc4084b6bc62

Modified Files
--
src/backend/executor/execMain.c | 1 +
1 file changed, 1 insertion(+)



pgsql: Pass QueryEnvironment down to EvalPlanQual's EState.

2019-07-09 Thread Thomas Munro
Pass QueryEnvironment down to EvalPlanQual's EState.

Otherwise the executor can't see trigger transition tables during
EPQ evaluation.  Fixes bug #15900 and almost certainly also #15720.
Back-patch to 10, where trigger transition tables landed.

Author: Alex Aktsipetrov
Reviewed-by: Thomas Munro, Tom Lane
Discussion: https://postgr.es/m/15900-bc482754fe8d7415%40postgresql.org
Discussion: https://postgr.es/m/15720-38c2b29e5d720187%40postgresql.org

Branch
--
REL_12_STABLE

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

Modified Files
--
src/backend/executor/execMain.c | 1 +
1 file changed, 1 insertion(+)



pgsql: Force hash joins to be enabled in the hash join regression tests

2019-07-08 Thread Thomas Munro
Force hash joins to be enabled in the hash join regression tests.

Otherwise the regressplans.sh tests generate extremely slow nested
loop joins.  Back-patch to 11 where the hash join tests came in.

Reported-by: Michael Paquier
Discussion: https://postgr.es/m/20190708055256.GB2709%40paquier.xyz

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/3955c50f3762be6f0a63573c5b4efef72b30dc2b

Modified Files
--
src/test/regress/expected/join.out | 1 +
src/test/regress/sql/join.sql  | 1 +
2 files changed, 2 insertions(+)



pgsql: Force hash joins to be enabled in the hash join regression tests

2019-07-08 Thread Thomas Munro
Force hash joins to be enabled in the hash join regression tests.

Otherwise the regressplans.sh tests generate extremely slow nested
loop joins.  Back-patch to 11 where the hash join tests came in.

Reported-by: Michael Paquier
Discussion: https://postgr.es/m/20190708055256.GB2709%40paquier.xyz

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/5526baf54902a56c5bc1b4abe625acb33d7357bf

Modified Files
--
src/test/regress/expected/join_hash.out | 1 +
src/test/regress/sql/join_hash.sql  | 1 +
2 files changed, 2 insertions(+)



pgsql: Force hash joins to be enabled in the hash join regression tests

2019-07-08 Thread Thomas Munro
Force hash joins to be enabled in the hash join regression tests.

Otherwise the regressplans.sh tests generate extremely slow nested
loop joins.  Back-patch to 11 where the hash join tests came in.

Reported-by: Michael Paquier
Discussion: https://postgr.es/m/20190708055256.GB2709%40paquier.xyz

Branch
--
master

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

Modified Files
--
src/test/regress/expected/join_hash.out | 1 +
src/test/regress/sql/join_hash.sql  | 1 +
2 files changed, 2 insertions(+)



pgsql: Improve comment in postgresql.conf.sample.

2019-07-05 Thread Thomas Munro
Improve comment in postgresql.conf.sample.

The Unix manual section that "man tcp" appears in varies, so let's
just leave it out of the command to run.

Branch
--
master

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

Modified Files
--
src/backend/utils/misc/postgresql.conf.sample | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Fix misleading comment in nodeIndexonlyscan.c.

2019-06-27 Thread Thomas Munro
Fix misleading comment in nodeIndexonlyscan.c.

The stated reason for acquiring predicate locks on heap pages hasn't
existed since commit c01262a8, so fix the comment.  Perhaps in a later
release we'll also be able to change the code to use tuple locks.

Back-patch all the way.

Reviewed-by: Ashwin Agrawal
Discussion: 
https://postgr.es/m/CAEepm%3D2GK3FVdnt5V3d%2Bh9njWipCv_fNL%3DwjxyUhzsF%3D0PcbNg%40mail.gmail.com

Branch
--
REL9_4_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/706cb9bf4f43eb2b9e8ad8fd6e0d4190575fe069

Modified Files
--
src/backend/executor/nodeIndexonlyscan.c | 7 ++-
1 file changed, 2 insertions(+), 5 deletions(-)



pgsql: Fix misleading comment in nodeIndexonlyscan.c.

2019-06-27 Thread Thomas Munro
Fix misleading comment in nodeIndexonlyscan.c.

The stated reason for acquiring predicate locks on heap pages hasn't
existed since commit c01262a8, so fix the comment.  Perhaps in a later
release we'll also be able to change the code to use tuple locks.

Back-patch all the way.

Reviewed-by: Ashwin Agrawal
Discussion: 
https://postgr.es/m/CAEepm%3D2GK3FVdnt5V3d%2Bh9njWipCv_fNL%3DwjxyUhzsF%3D0PcbNg%40mail.gmail.com

Branch
--
REL9_6_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/0908c5ecf0833b020b0d95183804ebc22bb6ea6c

Modified Files
--
src/backend/executor/nodeIndexonlyscan.c | 7 ++-
1 file changed, 2 insertions(+), 5 deletions(-)



pgsql: Fix misleading comment in nodeIndexonlyscan.c.

2019-06-27 Thread Thomas Munro
Fix misleading comment in nodeIndexonlyscan.c.

The stated reason for acquiring predicate locks on heap pages hasn't
existed since commit c01262a8, so fix the comment.  Perhaps in a later
release we'll also be able to change the code to use tuple locks.

Back-patch all the way.

Reviewed-by: Ashwin Agrawal
Discussion: 
https://postgr.es/m/CAEepm%3D2GK3FVdnt5V3d%2Bh9njWipCv_fNL%3DwjxyUhzsF%3D0PcbNg%40mail.gmail.com

Branch
--
REL9_5_STABLE

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

Modified Files
--
src/backend/executor/nodeIndexonlyscan.c | 7 ++-
1 file changed, 2 insertions(+), 5 deletions(-)



pgsql: Fix misleading comment in nodeIndexonlyscan.c.

2019-06-27 Thread Thomas Munro
Fix misleading comment in nodeIndexonlyscan.c.

The stated reason for acquiring predicate locks on heap pages hasn't
existed since commit c01262a8, so fix the comment.  Perhaps in a later
release we'll also be able to change the code to use tuple locks.

Back-patch all the way.

Reviewed-by: Ashwin Agrawal
Discussion: 
https://postgr.es/m/CAEepm%3D2GK3FVdnt5V3d%2Bh9njWipCv_fNL%3DwjxyUhzsF%3D0PcbNg%40mail.gmail.com

Branch
--
REL_10_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/69da8c1e69efd3a5b1b0f1d9bd8b7b79a696fbc8

Modified Files
--
src/backend/executor/nodeIndexonlyscan.c | 7 ++-
1 file changed, 2 insertions(+), 5 deletions(-)



pgsql: Fix misleading comment in nodeIndexonlyscan.c.

2019-06-27 Thread Thomas Munro
Fix misleading comment in nodeIndexonlyscan.c.

The stated reason for acquiring predicate locks on heap pages hasn't
existed since commit c01262a8, so fix the comment.  Perhaps in a later
release we'll also be able to change the code to use tuple locks.

Back-patch all the way.

Reviewed-by: Ashwin Agrawal
Discussion: 
https://postgr.es/m/CAEepm%3D2GK3FVdnt5V3d%2Bh9njWipCv_fNL%3DwjxyUhzsF%3D0PcbNg%40mail.gmail.com

Branch
--
master

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

Modified Files
--
src/backend/executor/nodeIndexonlyscan.c | 7 ++-
1 file changed, 2 insertions(+), 5 deletions(-)



pgsql: Fix misleading comment in nodeIndexonlyscan.c.

2019-06-27 Thread Thomas Munro
Fix misleading comment in nodeIndexonlyscan.c.

The stated reason for acquiring predicate locks on heap pages hasn't
existed since commit c01262a8, so fix the comment.  Perhaps in a later
release we'll also be able to change the code to use tuple locks.

Back-patch all the way.

Reviewed-by: Ashwin Agrawal
Discussion: 
https://postgr.es/m/CAEepm%3D2GK3FVdnt5V3d%2Bh9njWipCv_fNL%3DwjxyUhzsF%3D0PcbNg%40mail.gmail.com

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/6827e46cdf351678f71577efd4736f5d443b6e01

Modified Files
--
src/backend/executor/nodeIndexonlyscan.c | 7 ++-
1 file changed, 2 insertions(+), 5 deletions(-)



pgsql: Don't unset MAKEFLAGS in non-GNU Makefile.

2019-06-24 Thread Thomas Munro
Don't unset MAKEFLAGS in non-GNU Makefile.

It's useful to be able to pass down options like -s and -j.

Back-patch to 9.5, like commit a76200de.

Discussion: 
https://postgr.es/m/CA%2BhUKG%2Be1M8-BbL%3DPqhTp6oO6XPO6%2Bs9WGQMLfbuZ%3DG9CtzyXg%40mail.gmail.com

Branch
--
REL9_5_STABLE

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

Modified Files
--
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Don't unset MAKEFLAGS in non-GNU Makefile.

2019-06-24 Thread Thomas Munro
Don't unset MAKEFLAGS in non-GNU Makefile.

It's useful to be able to pass down options like -s and -j.

Back-patch to 9.5, like commit a76200de.

Discussion: 
https://postgr.es/m/CA%2BhUKG%2Be1M8-BbL%3DPqhTp6oO6XPO6%2Bs9WGQMLfbuZ%3DG9CtzyXg%40mail.gmail.com

Branch
--
REL_10_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/956611e4c480a2b7edeb2f1581e99f19f1983ca5

Modified Files
--
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Don't unset MAKEFLAGS in non-GNU Makefile.

2019-06-24 Thread Thomas Munro
Don't unset MAKEFLAGS in non-GNU Makefile.

It's useful to be able to pass down options like -s and -j.

Back-patch to 9.5, like commit a76200de.

Discussion: 
https://postgr.es/m/CA%2BhUKG%2Be1M8-BbL%3DPqhTp6oO6XPO6%2Bs9WGQMLfbuZ%3DG9CtzyXg%40mail.gmail.com

Branch
--
REL9_6_STABLE

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

Modified Files
--
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Don't unset MAKEFLAGS in non-GNU Makefile.

2019-06-24 Thread Thomas Munro
Don't unset MAKEFLAGS in non-GNU Makefile.

It's useful to be able to pass down options like -s and -j.

Back-patch to 9.5, like commit a76200de.

Discussion: 
https://postgr.es/m/CA%2BhUKG%2Be1M8-BbL%3DPqhTp6oO6XPO6%2Bs9WGQMLfbuZ%3DG9CtzyXg%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/0089c3059cb6b3dd20cf072f26d1a7a33412df39

Modified Files
--
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Don't unset MAKEFLAGS in non-GNU Makefile.

2019-06-24 Thread Thomas Munro
Don't unset MAKEFLAGS in non-GNU Makefile.

It's useful to be able to pass down options like -s and -j.

Back-patch to 9.5, like commit a76200de.

Discussion: 
https://postgr.es/m/CA%2BhUKG%2Be1M8-BbL%3DPqhTp6oO6XPO6%2Bs9WGQMLfbuZ%3DG9CtzyXg%40mail.gmail.com

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/2839bf3538e764c559f79d3cc8f57d5e7b580741

Modified Files
--
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Remove misleading comment from pathnodes.h.

2019-06-24 Thread Thomas Munro
Remove misleading comment from pathnodes.h.

As of commit e5253fdc, it is no longer true that the leader always
executes the subplan of a Gather Merge node.  Remove comment to that
effect.

Back-patch to 11.

Discussion: 
https://postgr.es/m/CA%2BhUKGJEaZJYezXAOutuiWT%2BfxCA44%2BoKtVPAND2ubLiigR%3D-w%40mail.gmail.com

Branch
--
REL_11_STABLE

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

Modified Files
--
src/include/nodes/relation.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)



pgsql: Remove misleading comment from pathnodes.h.

2019-06-24 Thread Thomas Munro
Remove misleading comment from pathnodes.h.

As of commit e5253fdc, it is no longer true that the leader always
executes the subplan of a Gather Merge node.  Remove comment to that
effect.

Back-patch to 11.

Discussion: 
https://postgr.es/m/CA%2BhUKGJEaZJYezXAOutuiWT%2BfxCA44%2BoKtVPAND2ubLiigR%3D-w%40mail.gmail.com

Branch
--
master

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

Modified Files
--
src/include/nodes/pathnodes.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)



pgsql: Remove unnecessary comment.

2019-06-23 Thread Thomas Munro
Remove unnecessary comment.

Author: Vik Fearing
Discussion: 
https://postgr.es/m/150d3e9f-c7ec-3fb3-4fdb-def47c4144af%402ndquadrant.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/89ff7c08eee355195eba6f544d28584e61200665

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



pgsql: Remove obsolete comments about sempahores from proc.c.

2019-06-20 Thread Thomas Munro
Remove obsolete comments about sempahores from proc.c.

Commit 675f switched from a semaphore-based wait to a latch-based
wait for ProcSleep()/ProcWakeup(), but left behind some stray references
to semaphores.

Back-patch to 9.5.

Reviewed-by: Daniel Gustafsson, Michael Paquier
Discussion: 
https://postgr.es/m/CA+hUKGLs5H6zhmgTijZ1OaJvC1sG0=afxc1ahuce32tkiqr...@mail.gmail.com

Branch
--
REL9_6_STABLE

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

Modified Files
--
src/backend/storage/lmgr/proc.c | 14 ++
1 file changed, 6 insertions(+), 8 deletions(-)



pgsql: Remove obsolete comments about sempahores from proc.c.

2019-06-20 Thread Thomas Munro
Remove obsolete comments about sempahores from proc.c.

Commit 675f switched from a semaphore-based wait to a latch-based
wait for ProcSleep()/ProcWakeup(), but left behind some stray references
to semaphores.

Back-patch to 9.5.

Reviewed-by: Daniel Gustafsson, Michael Paquier
Discussion: 
https://postgr.es/m/CA+hUKGLs5H6zhmgTijZ1OaJvC1sG0=afxc1ahuce32tkiqr...@mail.gmail.com

Branch
--
REL9_5_STABLE

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

Modified Files
--
src/backend/storage/lmgr/proc.c | 14 ++
1 file changed, 6 insertions(+), 8 deletions(-)



pgsql: Remove obsolete comments about sempahores from proc.c.

2019-06-20 Thread Thomas Munro
Remove obsolete comments about sempahores from proc.c.

Commit 675f switched from a semaphore-based wait to a latch-based
wait for ProcSleep()/ProcWakeup(), but left behind some stray references
to semaphores.

Back-patch to 9.5.

Reviewed-by: Daniel Gustafsson, Michael Paquier
Discussion: 
https://postgr.es/m/CA+hUKGLs5H6zhmgTijZ1OaJvC1sG0=afxc1ahuce32tkiqr...@mail.gmail.com

Branch
--
REL_10_STABLE

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

Modified Files
--
src/backend/storage/lmgr/proc.c | 14 ++
1 file changed, 6 insertions(+), 8 deletions(-)



pgsql: Remove obsolete comments about sempahores from proc.c.

2019-06-20 Thread Thomas Munro
Remove obsolete comments about sempahores from proc.c.

Commit 675f switched from a semaphore-based wait to a latch-based
wait for ProcSleep()/ProcWakeup(), but left behind some stray references
to semaphores.

Back-patch to 9.5.

Reviewed-by: Daniel Gustafsson, Michael Paquier
Discussion: 
https://postgr.es/m/CA+hUKGLs5H6zhmgTijZ1OaJvC1sG0=afxc1ahuce32tkiqr...@mail.gmail.com

Branch
--
REL_11_STABLE

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

Modified Files
--
src/backend/storage/lmgr/proc.c | 14 ++
1 file changed, 6 insertions(+), 8 deletions(-)



pgsql: Remove obsolete comments about sempahores from proc.c.

2019-06-20 Thread Thomas Munro
Remove obsolete comments about sempahores from proc.c.

Commit 675f switched from a semaphore-based wait to a latch-based
wait for ProcSleep()/ProcWakeup(), but left behind some stray references
to semaphores.

Back-patch to 9.5.

Reviewed-by: Daniel Gustafsson, Michael Paquier
Discussion: 
https://postgr.es/m/CA+hUKGLs5H6zhmgTijZ1OaJvC1sG0=afxc1ahuce32tkiqr...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/25b93a2967a4ebfb90168ca087026cc697fc4b77

Modified Files
--
src/backend/storage/lmgr/proc.c | 14 ++
1 file changed, 6 insertions(+), 8 deletions(-)



pgsql: Prevent Parallel Hash Join for JOIN_UNIQUE_INNER.

2019-06-18 Thread Thomas Munro
Prevent Parallel Hash Join for JOIN_UNIQUE_INNER.

WHERE EXISTS (...) queries cannot be executed by Parallel Hash Join
with jointype JOIN_UNIQUE_INNER, because there is no way to make a
partial plan totally unique.  The consequence of allowing such plans
was duplicate results from some EXISTS queries.

Back-patch to 11.  Bug #15857.

Author: Thomas Munro
Reviewed-by: Tom Lane
Reported-by: Vladimir Kriukov
Discussion: https://postgr.es/m/15857-d1ba2a64bce0795e%40postgresql.org

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/14d8b539d3bd4cf9faf65ca86a733bada202107f

Modified Files
--
src/backend/optimizer/path/joinpath.c | 7 +--
1 file changed, 5 insertions(+), 2 deletions(-)



pgsql: Prevent Parallel Hash Join for JOIN_UNIQUE_INNER.

2019-06-18 Thread Thomas Munro
Prevent Parallel Hash Join for JOIN_UNIQUE_INNER.

WHERE EXISTS (...) queries cannot be executed by Parallel Hash Join
with jointype JOIN_UNIQUE_INNER, because there is no way to make a
partial plan totally unique.  The consequence of allowing such plans
was duplicate results from some EXISTS queries.

Back-patch to 11.  Bug #15857.

Author: Thomas Munro
Reviewed-by: Tom Lane
Reported-by: Vladimir Kriukov
Discussion: https://postgr.es/m/15857-d1ba2a64bce0795e%40postgresql.org

Branch
--
master

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

Modified Files
--
src/backend/optimizer/path/joinpath.c | 7 +--
1 file changed, 5 insertions(+), 2 deletions(-)



pgsql: Update copyright year.

2019-05-23 Thread Thomas Munro
Update copyright year.

Reviewed-by: Michael Paquier
Discussion: 
https://postgr.es/m/CA%2BhUKGJFWXmtYo6Frd77RR8YXCHz7hJ2mRy5aHV%3D7fJOqDnBHA%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/4c9210f34c621639f896d57cf7bfb5e9be139c91

Modified Files
--
src/backend/lib/integerset.c| 2 +-
src/backend/libpq/be-gssapi-common.c| 2 +-
src/backend/libpq/be-gssapi-common.h| 2 +-
src/backend/libpq/be-secure-gssapi.c| 2 +-
src/interfaces/libpq/fe-gssapi-common.c | 2 +-
src/interfaces/libpq/fe-gssapi-common.h | 2 +-
src/interfaces/libpq/fe-secure-gssapi.c | 2 +-
7 files changed, 7 insertions(+), 7 deletions(-)



pgsql: Fix typos.

2019-05-23 Thread Thomas Munro
Fix typos.

Reviewed-by: Michael Paquier
Discussion: 
https://postgr.es/m/CA%2BhUKGJFWXmtYo6Frd77RR8YXCHz7hJ2mRy5aHV%3D7fJOqDnBHA%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/7988cb446d20512ec9d091db66dba6adee3f3d4b

Modified Files
--
src/backend/executor/execTuples.c   | 2 +-
src/backend/replication/logical/reorderbuffer.c | 2 +-
src/backend/storage/file/sharedfileset.c| 2 +-
src/bin/pg_dump/pg_backup.h | 2 +-
src/bin/pg_dump/pg_backup_archiver.h| 2 +-
src/bin/pg_dump/pg_backup_directory.c   | 2 +-
src/bin/pg_dump/pg_backup_null.c| 2 +-
src/bin/pg_dump/pg_backup_tar.c | 2 +-
8 files changed, 8 insertions(+), 8 deletions(-)



<    5   6   7   8   9   10   11   12   13   >