pgsql: Fix some trailing whitespace in documentation files

2022-04-16 Thread Peter Eisentraut
Fix some trailing whitespace in documentation files

Branch
--
master

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

Modified Files
--
doc/src/sgml/adminpack.sgml |  2 +-
doc/src/sgml/custom-rmgr.sgml   |  4 ++--
doc/src/sgml/func.sgml  | 20 ++--
doc/src/sgml/high-availability.sgml |  2 +-
doc/src/sgml/pgwalinspect.sgml  |  2 +-
doc/src/sgml/ref/pgbench.sgml   |  2 +-
doc/src/sgml/runtime.sgml   |  2 +-
7 files changed, 17 insertions(+), 17 deletions(-)



pgsql: Build libpq test programs under MSVC

2022-04-16 Thread Andrew Dunstan
Build libpq test programs under MSVC

This allows the newly added TAP tests to run.

Branch
--
master

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

Modified Files
--
src/tools/msvc/Mkvcbuild.pm | 16 
1 file changed, 16 insertions(+)



pgsql: Fix incorrect logic in HaveRegisteredOrActiveSnapshot().

2022-04-16 Thread Tom Lane
Fix incorrect logic in HaveRegisteredOrActiveSnapshot().

This function gave the wrong answer when there's more than one
RegisteredSnapshots entry, whether or not any of them is the
CatalogSnapshot.  This leads to assertion failure in some scenarios
involving fetching toasted data using a cursor.  (As per discussion,
I'm dubious that this is the right contract to be enforcing at all;
but it surely doesn't help to be enforcing it incorrectly.)

Fetching toasted data using a cursor is evidently under-tested,
so add a test case too.

Per report from Erik Rijkers.  This is new code, so no need for
back-patch.

Discussion: https://postgr.es/m/dc9dd229-ed30-6c62-4c41-d7337...@xs4all.nl

Branch
--
master

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

Modified Files
--
src/backend/utils/time/snapmgr.c  |  6 +++---
src/test/regress/expected/portals.out | 25 +
src/test/regress/sql/portals.sql  | 24 
3 files changed, 52 insertions(+), 3 deletions(-)



Re: pgsql: Fix some trailing whitespace in documentation files

2022-04-16 Thread Tom Lane
Peter Eisentraut  writes:
> Fix some trailing whitespace in documentation files

Hmm ... by my count there are still 245 lines with trailing spaces
in the *.sgml files.  (Most but not all are from copied-n-pasted
psql output.)

I'm not quite sure what's the point of retail fixes.  I could
get behind removing *all* these occurrences, and then adjusting
.gitattributes so that git bleats about introducing new ones.
Other folks might find that a little too obsessive-compulsive,
though.

regards, tom lane




pgsql: pgstat: Use correct lock level in pgstat_drop_all_entries().

2022-04-16 Thread Andres Freund
pgstat: Use correct lock level in pgstat_drop_all_entries().

Previously we didn't, which lead to an assertion failure when resetting
partially loaded statistics. This was encountered on the buildfarm, for
as-of-yet unknown reasons.

Ttighten up a validity check when reading the stats file, verifying 'E'
signals the end of the file (rather than just stopping reading). That's then
used in a test appending to the stats file that crashed before the fix in
pgstat_drop_all_entries().

Reported by buildfarm animals mylodon and kestrel, via Tom Lane.

Discussion: https://postgr.es/m/1656446.1650043...@sss.pgh.pa.us

Branch
--
master

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

Modified Files
--
src/backend/utils/activity/pgstat.c   |  4 
src/backend/utils/activity/pgstat_shmem.c |  2 +-
src/test/recovery/t/029_stats_restart.pl  | 30 --
3 files changed, 33 insertions(+), 3 deletions(-)



pgsql: Don't retry restore_command while reading ahead.

2022-04-16 Thread Thomas Munro
Don't retry restore_command while reading ahead.

Suppress further attempts to read ahead in the WAL if we run out of
data, until the records already decoded have been replayed.  This
restores the traditional behavior for continuous archive recovery, which
is to retry the failing restore_command only every 5 seconds.  With the
coding in 5dc0418f, we would start retrying every time through the
recovery loop when our WAL decoding window hit the end of the current
segment and we tried to look ahead into a not-yet-available next file.
That was very slow.

Also change the no_readahead_until mechanism to use <= rather than <,
which seems more useful.  Otherwise we'd either get one extra unwanted
retry of restore_command, or we'd need to add 1 to an LSN.

No change in behavior for regular streaming.  That was already limited
by the flushedUpto variable, which won't be updated until we replay what
we have already.

Reported by Andres Freund while analyzing the failure of a TAP test on
build farm animal skink (investigation ongoing but probably due to
otherwise unrelated timing bugs triggered by this slowness magnified by
valgrind).

Discussion: 
https://postgr.es/m/20220409005910.alw46xqmmgny2sgr%40alap3.anarazel.de

Branch
--
master

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

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



pgsql: Add a temp-install prerequisite to src/interfaces/ecpg "checktcp

2022-04-16 Thread Noah Misch
Add a temp-install prerequisite to src/interfaces/ecpg "checktcp".

The target failed, tested $PATH binaries, or tested a stale temporary
installation.  Commit c66b438db62748000700c9b90b585e756dd54141 missed
this.  Back-patch to v10 (all supported versions).

Branch
--
REL_14_STABLE

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

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



pgsql: Add a temp-install prerequisite to src/interfaces/ecpg "checktcp

2022-04-16 Thread Noah Misch
Add a temp-install prerequisite to src/interfaces/ecpg "checktcp".

The target failed, tested $PATH binaries, or tested a stale temporary
installation.  Commit c66b438db62748000700c9b90b585e756dd54141 missed
this.  Back-patch to v10 (all supported versions).

Branch
--
REL_11_STABLE

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

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



pgsql: Add a temp-install prerequisite to src/interfaces/ecpg "checktcp

2022-04-16 Thread Noah Misch
Add a temp-install prerequisite to src/interfaces/ecpg "checktcp".

The target failed, tested $PATH binaries, or tested a stale temporary
installation.  Commit c66b438db62748000700c9b90b585e756dd54141 missed
this.  Back-patch to v10 (all supported versions).

Branch
--
REL_10_STABLE

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

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



pgsql: Add a temp-install prerequisite to src/interfaces/ecpg "checktcp

2022-04-16 Thread Noah Misch
Add a temp-install prerequisite to src/interfaces/ecpg "checktcp".

The target failed, tested $PATH binaries, or tested a stale temporary
installation.  Commit c66b438db62748000700c9b90b585e756dd54141 missed
this.  Back-patch to v10 (all supported versions).

Branch
--
REL_12_STABLE

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

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



pgsql: Add a temp-install prerequisite to src/interfaces/ecpg "checktcp

2022-04-16 Thread Noah Misch
Add a temp-install prerequisite to src/interfaces/ecpg "checktcp".

The target failed, tested $PATH binaries, or tested a stale temporary
installation.  Commit c66b438db62748000700c9b90b585e756dd54141 missed
this.  Back-patch to v10 (all supported versions).

Branch
--
REL_13_STABLE

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

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



pgsql: Add a temp-install prerequisite to src/interfaces/ecpg "checktcp

2022-04-16 Thread Noah Misch
Add a temp-install prerequisite to src/interfaces/ecpg "checktcp".

The target failed, tested $PATH binaries, or tested a stale temporary
installation.  Commit c66b438db62748000700c9b90b585e756dd54141 missed
this.  Back-patch to v10 (all supported versions).

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/42dbbca58e8e87e461bb0a4fe48a450e90e1e932

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



Re: pgsql: Track LLVM 15 changes.

2022-04-16 Thread Thomas Munro
On Wed, Feb 16, 2022 at 9:18 AM Thomas Munro  wrote:
> On Wed, Feb 16, 2022 at 7:34 AM Tom Lane  wrote:
> > Although seawasp isn't actually failing at the moment, it's emitting
> > a boatload of deprecation warnings, eg
> >
> > In file included from llvmjit_deform.c:27:
> > ../../../../src/include/jit/llvmjit_emit.h:112:23: warning: 
> > 'LLVMBuildStructGEP' is deprecated: Use LLVMBuildStructGEP2 instead to 
> > support opaque pointers [-Wdeprecated-declarations]
> > LLVMValueRef v_ptr = LLVMBuildStructGEP(b, v, idx, "");
> >  ^
> > /home/fabien/clgtk/include/llvm-c/Core.h:3908:1: note: 'LLVMBuildStructGEP' 
> > has been explicitly marked deprecated here
> > LLVM_ATTRIBUTE_C_DEPRECATED(
> > ^
> >
> > Is that on anyone's radar to clean up?
>
> Yeah I mentioned this problem in the other thread.  I got as far as
> finding this write-up:
>
> https://llvm.org/docs/OpaquePointers.html
>
> I haven't yet tried to work out what we really need to do, but I'm
> planning to try.  Possibly requires a bit more book keeping on our
> part, since eg LLVMGetElementType() is going away.

And now seaswap fails with an assertion about that.  I'll try to have
a look this week.  Just to be clear, this is an LLVM 15-to-be problem
so we have some time.

#3  0x7f5eea78e006 in __GI___assert_fail (assertion=0x7f5edce1d730
"NumContainedTys && \\"Attempting to get element type of opaque
pointer\\"", file=0x7f5edce1d668
"/home/fabien/llvm-src/llvm/include/llvm/IR/Type.h", line=380,
function=0x7f5edce1d6d0 "llvm::Type*
llvm::Type::getNonOpaquePointerElementType() const") at assert.c:101
#4  0x7f5edca8deae in llvm::Type::getNonOpaquePointerElementType
(this=0x561441f6eb40) at
/home/fabien/llvm-src/llvm/include/llvm/IR/Type.h:380
#5  0x7f5edcb6e54f in LLVMGetElementType
(WrappedTy=0x561441f6eb40) at
/home/fabien/llvm-src/llvm/lib/IR/Core.cpp:801
#6  0x7f5edf85ffe0 in llvm_pg_var_type () from
/home/fabien/pg/build-farm-14/buildroot/HEAD/pgsql.build/tmp_install/home/fabien/pg/build-farm-14/buildroot/HEAD/inst/lib/postgresql/llvmjit.so
#7  0x7f5edf85f102 in llvm_create_context () from
/home/fabien/pg/build-farm-14/buildroot/HEAD/pgsql.build/tmp_install/home/fabien/pg/build-farm-14/buildroot/HEAD/inst/lib/postgresql/llvmjit.so
#8  0x7f5edf86a3c9 in llvm_compile_expr () from
/home/fabien/pg/build-farm-14/buildroot/HEAD/pgsql.build/tmp_install/home/fabien/pg/build-farm-14/buildroot/HEAD/inst/lib/postgresql/llvmjit.so
#9  0x5614404c24d4 in ExecBuildProjectionInfo ()
#10 0x5614404deb92 in ExecAssignProjectionInfo ()
#11 0x561440505724 in ExecInitNestLoop ()
#12 0x5614404d7851 in ExecInitNode ()
#13 0x561440508064 in ExecInitSort ()
#14 0x5614404d78ab in ExecInitNode ()
#15 0x5614404cfe92 in standard_ExecutorStart ()
#16 0x561440687846 in PortalStart ()
#17 0x561440686cbc in exec_simple_query ()
#18 0x56144068491d in PostgresMain ()
#19 0x5614405e24bb in BackendRun ()
#20 0x5614405e1d1a in ServerLoop ()
#21 0x5614405df217 in PostmasterMain ()
#22 0x56144052dc0c in main ()