users/c2main/postgres.git
5 years agodoc: Fix incorrect link target
Peter Eisentraut [Sun, 7 Jun 2020 09:16:51 +0000 (11:16 +0200)]
doc: Fix incorrect link target

5 years agoAdd missing source files to nls.mk
Peter Eisentraut [Sat, 6 Jun 2020 17:56:21 +0000 (19:56 +0200)]
Add missing source files to nls.mk

5 years agoFix reference to wrong view in release notes
Magnus Hagander [Sat, 6 Jun 2020 13:35:42 +0000 (15:35 +0200)]
Fix reference to wrong view in release notes

The estimate of total backup size effects the view
pg_stat_progress_basebackup, not pg_stat_progress_analyze.

5 years agoRefresh function name in CRC-associated Valgrind suppressions.
Noah Misch [Sat, 6 Jun 2020 03:10:53 +0000 (20:10 -0700)]
Refresh function name in CRC-associated Valgrind suppressions.

Back-patch to 9.5, where commit 4f700bcd20c087f60346cb8aefd0e269be8e2157
first appeared.

Reviewed by Tom Lane.  Reported by Andrew Dunstan.

Discussion: https://postgr.es/m/4dfabec2-a3ad-0546-2d62-f816c97edd0c@2ndQuadrant.com

5 years agoDoc: remove annotations about multi-row output of set-returning functions.
Tom Lane [Fri, 5 Jun 2020 22:04:37 +0000 (18:04 -0400)]
Doc: remove annotations about multi-row output of set-returning functions.

I thought this added clarity, or at least was consistent with the way
these entries looked before v13 ... but apparently I'm in the minority.

Discussion: https://postgr.es/m/CAFj8pRAXuetiHUfs73zjsJD6B78FWcUsBS-j23sdCMFXkgx5Fg@mail.gmail.com

5 years agoImprove ineq_histogram_selectivity's behavior for non-default orderings.
Tom Lane [Fri, 5 Jun 2020 20:55:16 +0000 (16:55 -0400)]
Improve ineq_histogram_selectivity's behavior for non-default orderings.

ineq_histogram_selectivity() can be invoked in situations where the
ordering we care about is not that of the column's histogram.  We could
be considering some other collation, or even more drastically, the
query operator might not agree at all with what was used to construct
the histogram.  (We'll get here for anything using scalarineqsel-based
estimators, so that's quite likely to happen for extension operators.)

Up to now we just ignored this issue and assumed we were dealing with
an operator/collation whose sort order exactly matches the histogram,
possibly resulting in junk estimates if the binary search gets confused.
It's past time to improve that, since the use of nondefault collations
is increasing.  What we can do is verify that the given operator and
collation match what's recorded in pg_statistic, and use the existing
code only if so.  When they don't match, instead execute the operator
against each histogram entry, and take the fraction of successes as our
selectivity estimate.  This gives an estimate that is probably good to
about 1/histogram_size, with no assumptions about ordering.  (The quality
of the estimate is likely to degrade near the ends of the value range,
since the two orderings probably don't agree on what is an extremal value;
but this is surely going to be more reliable than what we did before.)

At some point we might further improve matters by storing more than one
histogram calculated according to different orderings.  But this code
would still be good fallback logic when no matches exist, so that is
not an argument for not doing this.

While here, also improve get_variable_range() to deal more honestly
with non-default collations.

This isn't back-patchable, because it requires adding another argument
to ineq_histogram_selectivity, and because it might have significant
impact on the estimation results for extension operators relying on
scalarineqsel --- mostly for the better, one hopes, but in any case
destabilizing plan choices in back branches is best avoided.

Per investigation of a report from James Lucas.

Discussion: https://postgr.es/m/CAAFmbbOvfi=wMM=3qRsPunBSLb8BFREno2oOzSBS=mzfLPKABw@mail.gmail.com

5 years agoAdd unlikely() to CHECK_FOR_INTERRUPTS()
Joe Conway [Fri, 5 Jun 2020 20:49:25 +0000 (16:49 -0400)]
Add unlikely() to CHECK_FOR_INTERRUPTS()

Add the unlikely() branch hint macro to CHECK_FOR_INTERRUPTS().
Backpatch to REL_10_STABLE where we first started using unlikely().

Discussion: https://www.postgresql.org/message-id/flat/8692553c-7fe8-17d9-cbc1-7cddb758f4c6%40joeconway.com

5 years agoUse query collation, not column's collation, while examining statistics.
Tom Lane [Fri, 5 Jun 2020 20:18:50 +0000 (16:18 -0400)]
Use query collation, not column's collation, while examining statistics.

Commit 5e0928005 changed the planner so that, instead of blindly using
DEFAULT_COLLATION_OID when invoking operators for selectivity estimation,
it would use the collation of the column whose statistics we're
considering.  This was recognized as still being not quite the right
thing, but it seemed like a good incremental improvement.  However,
shortly thereafter we introduced nondeterministic collations, and that
creates cases where operators can fail if they're passed the wrong
collation.  We don't want planning to fail in cases where the query itself
would work, so this means that we *must* use the query's collation when
invoking operators for estimation purposes.

The only real problem this creates is in ineq_histogram_selectivity, where
the binary search might produce a garbage answer if we perform comparisons
using a different collation than the column's histogram is ordered with.
However, when the query's collation is significantly different from the
column's default collation, the estimate we previously generated would be
pretty irrelevant anyway; so it's not clear that this will result in
noticeably worse estimates in practice.  (A follow-on patch will improve
this situation in HEAD, but it seems too invasive for back-patch.)

The patch requires changing the signatures of mcv_selectivity and allied
functions, which are exported and very possibly are used by extensions.
In HEAD, I just did that, but an API/ABI break of this sort isn't
acceptable in stable branches.  Therefore, in v12 the patch introduces
"mcv_selectivity_ext" and so on, with signatures matching HEAD, and makes
the old functions into wrappers that assume DEFAULT_COLLATION_OID should
be used.  That does not match the prior behavior, but it should avoid risk
of failure in most cases.  (In practice, I think most extension datatypes
aren't collation-aware, so the change probably doesn't matter to them.)

Per report from James Lucas.  Back-patch to v12 where the problem was
introduced.

Discussion: https://postgr.es/m/CAAFmbbOvfi=wMM=3qRsPunBSLb8BFREno2oOzSBS=mzfLPKABw@mail.gmail.com

5 years agoOpenSSL 3.0.0 compatibility in tests
Peter Eisentraut [Fri, 5 Jun 2020 09:18:11 +0000 (11:18 +0200)]
OpenSSL 3.0.0 compatibility in tests

DES has been deprecated in OpenSSL 3.0.0 which makes loading keys
encrypted with DES fail with "fetch failed".  Solve by changing the
cipher used to aes256 which has been supported since 1.0.1 (and is
more realistic to use anyways).

Note that the minimum supported OpenSSL version is 1.0.1 as of
7b283d0e1d1d79bf1c962d790c94d2a53f3bb38a, so this does not introduce
any new version requirements.

Author: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://www.postgresql.org/message-id/flat/FEF81714-D479-4512-839B-C769D2605F8A%40yesql.se

5 years agoPreserve pg_index.indisreplident across REINDEX CONCURRENTLY
Michael Paquier [Fri, 5 Jun 2020 01:26:02 +0000 (10:26 +0900)]
Preserve pg_index.indisreplident across REINDEX CONCURRENTLY

If the flag value is lost, logical decoding would work the same way as
REPLICA IDENTITY NOTHING, meaning that no old tuple values would be
included in the changes anymore produced by logical decoding.

Author: Michael Paquier
Reviewed-by: Euler Taveira
Discussion: https://postgr.es/m/20200603065340.GK89559@paquier.xyz
Backpatch-through: 12

5 years agoReject "23:59:60.nnn" in datetime input.
Tom Lane [Thu, 4 Jun 2020 20:42:08 +0000 (16:42 -0400)]
Reject "23:59:60.nnn" in datetime input.

It's intentional that we don't allow values greater than 24 hours,
while we do allow "24:00:00" as well as "23:59:60" as inputs.
However, the range check was miscoded in such a way that it would
accept "23:59:60.nnn" with a nonzero fraction.  For time or timetz,
the stored result would then be greater than "24:00:00" which would
fail dump/reload, not to mention possibly confusing other operations.

Fix by explicitly calculating the result and making sure it does not
exceed 24 hours.  (This calculation is redundant with what will happen
later in tm2time or tm2timetz.  Maybe someday somebody will find that
annoying enough to justify refactoring to avoid the duplication; but
that seems too invasive for a back-patched bug fix, and the cost is
probably unmeasurable anyway.)

Note that this change also rejects such input as the time portion
of a timestamp(tz) value.

Back-patch to v10.  The bug is far older, but to change this pre-v10
we'd need to ensure that the logic behaves sanely with float timestamps,
which is possibly nontrivial due to roundoff considerations.
Doesn't really seem worth troubling with.

Per report from Christoph Berg.

Discussion: https://postgr.es/m/20200520125807.GB296739@msg.df7cb.de

5 years agopsql: Clean up terminology in \dAp command
Peter Eisentraut [Thu, 4 Jun 2020 20:09:41 +0000 (22:09 +0200)]
psql: Clean up terminology in \dAp command

The preferred terminology has been support "function", not procedure,
for some time, so change that over.  The command stays \dAp, since
\dAf is already something else.

5 years agoFix comment in be-secure-openssl.c
Michael Paquier [Thu, 4 Jun 2020 04:02:59 +0000 (13:02 +0900)]
Fix comment in be-secure-openssl.c

Since 573bd08, hardcoded DH parameters have been moved to a different
file, making the comment on top of load_dh_buffer() incorrect.

Author: Daniel Gustafsson
Discussion: https://postgr.es/m/D9492CCB-9A91-4181-A847-1779630BE2A7@yesql.se

5 years agoFix instance of elog() called while holding a spinlock
Michael Paquier [Thu, 4 Jun 2020 01:17:49 +0000 (10:17 +0900)]
Fix instance of elog() called while holding a spinlock

This broke the project rule to not call any complex code while a
spinlock is held.  Issue introduced by b89e151.

Discussion: https://postgr.es/m/20200602.161518.1399689010416646074.horikyota.ntt@gmail.com
Backpatch-through: 9.5

5 years agoDon't call palloc() while holding a spinlock, either.
Tom Lane [Wed, 3 Jun 2020 16:36:00 +0000 (12:36 -0400)]
Don't call palloc() while holding a spinlock, either.

Fix some more violations of the "only straight-line code inside a
spinlock" rule.  These are hazardous not only because they risk
holding the lock for an excessively long time, but because it's
possible for palloc to throw elog(ERROR), leaving a stuck spinlock
behind.

copy_replication_slot() had two separate places that did pallocs
while holding a spinlock.  We can make the code simpler and safer
by copying the whole ReplicationSlot struct into a local variable
while holding the spinlock, and then referencing that copy.
(While that's arguably more cycles than we really need to spend
holding the lock, the struct isn't all that big, and this way seems
far more maintainable than copying fields piecemeal.  Anyway this
is surely much cheaper than a palloc.)  That bug goes back to v12.

InvalidateObsoleteReplicationSlots() not only did a palloc while
holding a spinlock, but for extra sloppiness then leaked the memory
--- probably for the lifetime of the checkpointer process, though
I didn't try to verify that.  Fortunately that silliness is new
in HEAD.

pg_get_replication_slots() had a cosmetic violation of the rule,
in that it only assumed it's safe to call namecpy() while holding
a spinlock.  Still, that's a hazard waiting to bite somebody, and
there were some other cosmetic coding-rule violations in the same
function, so clean it up.  I back-patched this as far as v10; the
code exists before that but it looks different, and this didn't
seem important enough to adapt the patch further back.

Discussion: https://postgr.es/m/20200602.161518.1399689010416646074.horikyota.ntt@gmail.com

5 years agodoc: PG 13 relnotes: fix link for grouping sets hash overflow
Bruce Momjian [Wed, 3 Jun 2020 02:11:47 +0000 (22:11 -0400)]
doc:  PG 13 relnotes:  fix link for grouping sets hash overflow

Use "guc-enable-groupingsets-hash-disk".

Reported-by: TAKATSUKA Haruka
Discussion: https://postgr.es/m/16468-7939d39f1786516c@postgresql.org

Backpatch-through: master

5 years agodoc: Move wal_init_zero and wal_recycle descriptions to proper section.
Fujii Masao [Wed, 3 Jun 2020 00:59:43 +0000 (09:59 +0900)]
doc: Move wal_init_zero and wal_recycle descriptions to proper section.

The group of wal_init_zero and wal_recycle is WAL_SETTINGS in guc.c,
but previously their documents were located in
"Replication"/"Sending Servers" section. This commit moves them to
the proper section "Write Ahead Log"/"Settings".

Back-patch to v12 where wal_init_zero and wal_recycle parameters
were introduced.

Author: Fujii Masao
Discussion: https://postgr.es/m/b5190ab4-a169-6a42-0e49-aed0807c8976@oss.nttdata.com

5 years agoDon't call elog() while holding spinlock.
Fujii Masao [Tue, 2 Jun 2020 10:18:13 +0000 (19:18 +0900)]
Don't call elog() while holding spinlock.

Previously UpdateSpillStats() called elog(DEBUG2) while holding
the spinlock even though the local variables that the elog() accesses
don't need to be protected by the lock. Since spinlocks are intended
for very short-term locks, they should not be used when calling
elog(DEBUG2). So this commit moves that elog() out of spinlock period.

Author: Kyotaro Horiguchi
Reviewed-by: Amit Kapila and Fujii Masao
Discussion: https://postgr.es/m/20200602.161518.1399689010416646074.horikyota.ntt@gmail.com

5 years agoDoc: Update the documentation for spilled transaction statistics.
Amit Kapila [Tue, 2 Jun 2020 05:41:25 +0000 (11:11 +0530)]
Doc: Update the documentation for spilled transaction statistics.

Reported-by: Sawada Masahiko
Author: Sawada Masahiko, Amit Kapila
Reviewed-by: Amit Kapila
Discussion: https://postgr.es/m/CA+fd4k4vNg7dRO5ECHdtQXXf1=Q4M98pfLW0dU7BKD8h79pkqA@mail.gmail.com

5 years agoMake ssl certificate for ssl_passphrase_callback test via Makefile
Andrew Dunstan [Mon, 1 Jun 2020 21:32:32 +0000 (17:32 -0400)]
Make ssl certificate for ssl_passphrase_callback test via Makefile

The recipe was previously given in comments in the module's test
script, but now we have an explicit recipe in the Makefile. The now
redundant comments in the script are removed.

This recipe shouldn't be needed in normal use, as the certificate and
key are in git and don't need to be regenerated.

Discussion: https://postgr.es/m/ae8f21fc-95cb-c98a-f241-1936133f466f@2ndQuadrant.com

5 years agoUse correct and consistent unit abbreviation
Peter Eisentraut [Mon, 1 Jun 2020 19:18:36 +0000 (21:18 +0200)]
Use correct and consistent unit abbreviation

5 years agoFix use-after-release mistake in currtid() and currtid2() for views
Michael Paquier [Mon, 1 Jun 2020 05:41:18 +0000 (14:41 +0900)]
Fix use-after-release mistake in currtid() and currtid2() for views

This issue has been present since the introduction of this code as of
a3519a2 from 2002, and has been found by buildfarm member prion that
uses RELCACHE_FORCE_RELEASE via the tests introduced recently in
e786be5.

Discussion: https://postgr.es/m/20200601022055.GB4121@paquier.xyz
Backpatch-through: 9.5

5 years agoFix crashes with currtid() and currtid2()
Michael Paquier [Mon, 1 Jun 2020 01:32:06 +0000 (10:32 +0900)]
Fix crashes with currtid() and currtid2()

A relation that has no storage initializes rd_tableam to NULL, which
caused those two functions to crash because of a pointer dereference.
Note that in 11 and older versions, this has always failed with a
confusing error "could not open file".

These two functions are used by the Postgres ODBC driver, which requires
them only when connecting to a backend strictly older than 8.1.  When
connected to 8.2 or a newer version, the driver uses a RETURNING clause
instead whose support has been added in 8.2, so it should be possible to
just remove both functions in the future.  This is left as an issue to
address later.

While on it, add more regression tests for those functions as we never
really had coverage for them, and for aggregates of TIDs.

Reported-by: Jaime Casanova, via sqlsmith
Author: Michael Paquier
Reviewed-by: Álvaro Herrera
Discussion: https://postgr.es/m/CAJGNTeO93u-5APMga6WH41eTZ3Uee9f3s8dCpA-GSSqNs1b=Ug@mail.gmail.com
Backpatch-through: 12

5 years agoMake install-tests target work with vpath builds
Andrew Dunstan [Sun, 31 May 2020 22:33:00 +0000 (18:33 -0400)]
Make install-tests target work with vpath builds

Also add a top-level install-tests target.

Backpatch to all live branches.

Craig Ringer, tweaked by me.

5 years agoUse CP_SMALL_TLIST for hash aggregate
Tomas Vondra [Sun, 31 May 2020 12:43:13 +0000 (14:43 +0200)]
Use CP_SMALL_TLIST for hash aggregate

Commit 1f39bce021 added disk-based hash aggregation, which may spill
incoming tuples to disk. It however did not request projection to make
the tuples as narrow as possible, which may mean having to spill much
more data than necessary (increasing I/O, pushing other stuff from page
cache, etc.).

This adds CP_SMALL_TLIST in places that may use hash aggregation - we do
that only for AGG_HASHED. It's unnecessary for AGG_SORTED, because that
either uses explicit Sort (which already does projection) or pre-sorted
input (which does not need spilling to disk).

Author: Tomas Vondra
Reviewed-by: Jeff Davis
Discussion: https://postgr.es/m/20200519151202.u2p2gpiawoaznsv2%40development

5 years agoDoc: Mention about caveats of --concurrently on reindexdb page
Michael Paquier [Sun, 31 May 2020 01:48:21 +0000 (10:48 +0900)]
Doc: Mention about caveats of --concurrently on reindexdb page

The documentation of REINDEX includes a complete description of
CONCURRENTLY and its advantages as well as its disadvantages, but
reindexdb was not really clear about all that.

From discussion with Tom Lane, based on a report from Andrey Klychkov.

Discussion: https://postgr.es/m/1590486572.205117372@f500.i.mail.ru
Backpatch-through: 12

5 years agodoc: Update the layout of "Viewing Statistics" section.
Fujii Masao [Fri, 29 May 2020 08:14:33 +0000 (17:14 +0900)]
doc: Update the layout of "Viewing Statistics" section.

This commit updates the "Viewing Statistics" section more like
the existing catalogs chapter.

- Change its layout so that an introductory paragrap is put above
   the table for each statistics view. Previously the explanations
   were below the tables.

- Separate each view to different section and add index terms for them.

Author: Fujii Masao
Reviewed-by: Tom Lane
Discussion: https://postgr.es/m/6f8a482c-b3fa-4ed9-21c3-6d222a2cb87d@oss.nttdata.com

5 years agollvmjit: Fix building against LLVM 11 by removing unnecessary include.
Andres Freund [Thu, 28 May 2020 22:08:12 +0000 (15:08 -0700)]
llvmjit: Fix building against LLVM 11 by removing unnecessary include.

LLVM has removed this header, in the branch that will become llvm
11. But as it turns out we didn't actually need it, so just remove it.

Author: Jesse Zhang <sbjesse@gmail.com>
Discussion: https://postgr.es/m/CAGf+fX7bvtP0YXMu7pOsu_NwhxW6dArTkxb=jt7M2-UJkyJ_3g@mail.gmail.com
Backpatch: 11, where JIT support using llvm was introduced.

5 years agoInitialize dblink remoteConn struct in all cases
Joe Conway [Thu, 28 May 2020 17:44:54 +0000 (13:44 -0400)]
Initialize dblink remoteConn struct in all cases

Two of the members of rconn were left uninitialized. When
dblink_open() is called without an outer transaction it
handles the initialization for us, but with an outer
transaction it does not. Arrange for initialization
in all cases. Backpatch to all supported versions.

Reported-by: Alexander Lakhin
Discussion: https://www.postgresql.org/message-id/flat/9bd0744f-5f04-c778-c5b3-809efe9c30c7%40joeconway.com#c545909a41664991aca60c4d70a10ce7

5 years agoAdd CHECK_FOR_INTERRUPTS() to the repeat() function
Joe Conway [Thu, 28 May 2020 17:16:47 +0000 (13:16 -0400)]
Add CHECK_FOR_INTERRUPTS() to the repeat() function

The repeat() function loops for potentially a long time without
ever checking for interrupts. This prevents, for example, a query
cancel from interrupting until the work is all done. Fix by
inserting a CHECK_FOR_INTERRUPTS() into the loop.

Backpatch to all supported versions.

Discussion: https://www.postgresql.org/message-id/flat/8692553c-7fe8-17d9-cbc1-7cddb758f4c6%40joeconway.com

5 years agoAdd missing error code to "cannot attach index ..." error.
Heikki Linnakangas [Thu, 28 May 2020 09:37:00 +0000 (12:37 +0300)]
Add missing error code to "cannot attach index ..." error.

ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE was used in an ereport with the
same message but different errdetail a few lines earlier, so use that
here as well.

Backpatch-through: 11

5 years agoFix typo in test comment.
Heikki Linnakangas [Thu, 28 May 2020 09:35:18 +0000 (12:35 +0300)]
Fix typo in test comment.

The same comment was copied to a few different places, with the same typo.
Backpatch down to v11, where this typo was introduced.

5 years agoFix some comments in xlogreader.h
Michael Paquier [Thu, 28 May 2020 07:40:07 +0000 (16:40 +0900)]
Fix some comments in xlogreader.h

segment_open and segment_close were mentioned with incorrect names.

Discussion: https://postgr.es/m/20200525234944.GA1573@paquier.xyz

5 years agoFix some mentions to memory units in postgresql.conf.sample
Michael Paquier [Thu, 28 May 2020 06:39:05 +0000 (15:39 +0900)]
Fix some mentions to memory units in postgresql.conf.sample

The default unit for max_slot_wal_keep_size is megabytes.  While on it,
also change temp_file_limit to use a more consistent wording.

Reported-by: Jeff Janes, Fujii Masao
Author: Kyotaro Horiguchi
Discussion: https://postgr.es/m/CAMkU=1wWZhhjpwRFKJ9waQGxxROeC0P6UqPvb90fAaGz7dhoHA@mail.gmail.com

5 years agoRemove some tabs in SQL code in C string literals
Peter Eisentraut [Wed, 27 May 2020 14:07:55 +0000 (16:07 +0200)]
Remove some tabs in SQL code in C string literals

This is not handled uniformly throughout the code, but at least nearby
code can be consistent.

5 years agoAvoid fragmentation of logical tapes when writing concurrently.
Jeff Davis [Tue, 26 May 2020 23:06:30 +0000 (16:06 -0700)]
Avoid fragmentation of logical tapes when writing concurrently.

Disk-based HashAgg relies on writing to multiple tapes
concurrently. Avoid fragmentation of the tapes' blocks by
preallocating many blocks for a tape at once. No file operations are
performed during preallocation; only the block numbers are reserved.

Reviewed-by: Tomas Vondra
Discussion: https://postgr.es/m/20200519151202.u2p2gpiawoaznsv2%40development

5 years agoMessage wording tweaks
Peter Eisentraut [Tue, 26 May 2020 13:58:39 +0000 (15:58 +0200)]
Message wording tweaks

Make the wording of new libpq messages more similar to existing
messages in the backend.

5 years agoAdd lcov exclusion markers to jsonpath scanner
Peter Eisentraut [Tue, 26 May 2020 12:09:36 +0000 (14:09 +0200)]
Add lcov exclusion markers to jsonpath scanner

This was done for all scanners in
421167362242ce1fb46d6d720798787e7cd65aad but not added to the new one.

5 years agodoc: PG 13 relnotes: update bool_plperl item
Bruce Momjian [Tue, 26 May 2020 01:53:53 +0000 (21:53 -0400)]
doc:  PG 13 relnotes:  update bool_plperl item

Reported-by: Daniel Gustafsson
Discussion: https://postgr.es/m/54F7560D-498A-4E51-BAA4-17D4AAB2AA57@yesql.se

Backpatch-through: master

5 years agogss: add missing references to hostgssenc and hostnogssenc
Bruce Momjian [Tue, 26 May 2020 00:19:28 +0000 (20:19 -0400)]
gss:  add missing references to hostgssenc and hostnogssenc

These were missed when these were added to pg_hba.conf in PG 12;
updates docs and pg_hba.conf.sample.

Reported-by: Arthur Nascimento
Bug: 16380

Discussion: https://postgr.es/m/20200421182736.GG19613@momjian.us

Backpatch-through: 12

5 years agoReconcile nodes/*funcs.c.
Noah Misch [Mon, 25 May 2020 23:23:48 +0000 (16:23 -0700)]
Reconcile nodes/*funcs.c.

The stmt_len changes do not affect behavior.  LimitPath has no other
support functions, so that part changes only debugging output.

5 years agoAdd a temp-install prerequisite to top-level "check-tests".
Noah Misch [Mon, 25 May 2020 23:21:04 +0000 (16:21 -0700)]
Add a temp-install prerequisite to top-level "check-tests".

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

5 years agoDoc: Fix order of pg_shmem_allocations in system view list
Michael Paquier [Mon, 25 May 2020 06:18:11 +0000 (15:18 +0900)]
Doc: Fix order of pg_shmem_allocations in system view list

pg_shmem_allocations was in the wrong position with pg_stats.

Author: Ian Barwick
Discussion: https://postgr.es/m/de7279d4-7ea0-037f-d7d2-1161682339db@2ndquadrant.com

5 years agoAdd missing invocations to object access hooks
Michael Paquier [Sat, 23 May 2020 05:03:04 +0000 (14:03 +0900)]
Add missing invocations to object access hooks

The following commands have been missing calls to object access hooks
InvokeObjectPost{Create|Alter}Hook normally applied to all commands:
- ALTER RULE RENAME TO
- ALTER USER MAPPING
- CREATE ACCESS METHOD
- CREATE STATISTICS

Thanks also to Robert Haas for the discussion.

Author: Mark Dilger
Reviewed-by: Álvaro Herrera, Michael Paquier
Discussion: https://postgr.es/m/435CD295-F409-44E0-91EC-DF32C7AFCD76@enterprisedb.com

5 years agoFix two typos in a comment
Alvaro Herrera [Fri, 22 May 2020 21:39:16 +0000 (17:39 -0400)]
Fix two typos in a comment

They were introduced in 898e5e3290a7; backpatch to 12.

5 years agodoc: Add note about I/O timing information in EXPLAIN and pg_stat_database.
Fujii Masao [Fri, 22 May 2020 14:33:58 +0000 (23:33 +0900)]
doc: Add note about I/O timing information in EXPLAIN and pg_stat_database.

Explain that the followings are tracked only when track_io_timing GUC
is enabled.

- blk_read_time and blk_write_time in pg_stat_database
- time spent reading and writing data file blocks in EXPLAIN output
   with BUFFERS option

Whther track_io_timing is enabled affects also blk_read_time and
blk_write_time in pg_stat_statements, but which was already documented.

Author: Atsushi Torikoshi
Reviewed-by: Fujii Masao
Discussion: https://postgr.es/m/CACZ0uYHo_NwbxpLH76OGF-O=13tkR0ZM0zeyGEhZ+JEXZVRyCA@mail.gmail.com

5 years agoRemove unnecessary cast
Peter Eisentraut [Fri, 22 May 2020 08:36:49 +0000 (10:36 +0200)]
Remove unnecessary cast

Probably copied from nearby calls where it is necessary.  But this one
also casts away constness, so it was doubly annoying.

5 years agoAdjust indentation in src/backend/optimizer/README.
Etsuro Fujita [Fri, 22 May 2020 06:45:00 +0000 (15:45 +0900)]
Adjust indentation in src/backend/optimizer/README.

The previous indentation of optimizer functions was unclear; adjust the
indentation dashes so that a deeper level of indentation indicates that
the outer optimizer function calls the inner one.

Author: Richard Guo, with additional change by me
Reviewed-by: Kyotaro Horiguchi
Discussion: https://postgr.es/m/CAMbWs4-U-ogzpchGsP2BBMufCss1hktm%2B%2BeTJK_dUC196pw0cQ%40mail.gmail.com

5 years agodoc: PG 13 relnotes: Improve FETCH link
Bruce Momjian [Fri, 22 May 2020 02:07:17 +0000 (22:07 -0400)]
doc:  PG 13 relnotes:  Improve FETCH link

Reported-by: Erwin Brandstetter
Discussion: https://postgr.es/m/CAGHENJ4X626ZfYhondXSP4sQgC5zDtsp_LNg1QaD+U7vfgYXQQ@mail.gmail.com

Backpatch-through: head

5 years agodoc: PG 13 relnotes: fix FETCH FIRST ... WITH TIES xreflabel
Bruce Momjian [Fri, 22 May 2020 00:34:37 +0000 (20:34 -0400)]
doc:  PG 13 relnotes:  fix FETCH FIRST ... WITH TIES xreflabel

Reported-by: Erwin Brandstetter
Discussion: https://postgr.es/m/CAGHENJ4X626ZfYhondXSP4sQgC5zDtsp_LNg1QaD+U7vfgYXQQ@mail.gmail.com

Backpatch-through: head

5 years agodoc: suggest 1.1 as a random_page_cost value for SSDs
Bruce Momjian [Fri, 22 May 2020 00:28:38 +0000 (20:28 -0400)]
doc:  suggest 1.1 as a random_page_cost value for SSDs

Reported-by: yigong hu
Discussion: https://postgr.es/m/CAOxFffcourucFqSk+tZA13ErS3XRYkDy6EeaPff4AvHGiEEuug@mail.gmail.com

Backpatch-through: 9.5

5 years agodoc: Simplify mention of unique indexes for NULL control
Bruce Momjian [Thu, 21 May 2020 23:49:30 +0000 (19:49 -0400)]
doc:  Simplify mention of unique indexes for NULL control

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

Backpatch-through: 9.5

5 years agoDoc: Describe CREATE INDEX deduplication strategy.
Peter Geoghegan [Thu, 21 May 2020 20:36:45 +0000 (13:36 -0700)]
Doc: Describe CREATE INDEX deduplication strategy.

The B-Tree index deduplication strategy used during CREATE INDEX and
REINDEX differs from the lazy strategy used by retail inserts.  Make
that clear by adding a new paragraph to the B-Tree implementation
section of the documentation.

In passing, do some copy-editing of nearby deduplication documentation.

5 years agoClear some style deviations.
Noah Misch [Thu, 21 May 2020 15:31:16 +0000 (08:31 -0700)]
Clear some style deviations.

5 years agoUse explicit_bzero() when clearing sslpassword in libpq
Michael Paquier [Thu, 21 May 2020 06:49:20 +0000 (15:49 +0900)]
Use explicit_bzero() when clearing sslpassword in libpq

Since 74a308c, any security-sensitive information gets cleared from
memory this way.  This was forgotten in 4dc6355.

Author: Daniel Gustafsson
Reviewed-by: Peter Eisentraut, Michael Paquier
Discussion: https://postgr.es/m/935443BA-D42E-4CE0-B181-1AD79E6DD45A@yesql.se

5 years agoFix MSVC installations with multiple "configure" files detected
Michael Paquier [Thu, 21 May 2020 05:41:15 +0000 (14:41 +0900)]
Fix MSVC installations with multiple "configure" files detected

When installing binaries and libraries using the MSVC installation
routines, the operation gets done after moving to the root folder, whose
location is detected by checking if "configure" exists two times in a
row.  So, calling the installation script from src/tools/msvc/ with an
extra "configure" file four levels up the root path of the code tree
causes the execution to go further up, leading to a failure in finding
the builds.  This commit fixes the issue by moving to the root folder of
the code tree only once, when necessary.

Author: Arnold Müller
Reviewed-by: Daniel Gustafsson
Discussion: https://postgr.es/m/16343-f638f67e7e52b86c@postgresql.org
Backpatch-through: 9.5

5 years agodoc: Adding a partition does not require Access Exclusive lock
Alvaro Herrera [Wed, 20 May 2020 18:35:39 +0000 (14:35 -0400)]
doc: Adding a partition does not require Access Exclusive lock

This doc update was missed in 898e5e3290a7.  Backpatch to 12.

Pointed out by Pavel Luzanov
Discussion: https://postgr.es/m/642e9fbc-b832-698b-9a8f-d626afd7014d@postgrespro.ru

5 years agoDoc: Fix description of pg_class.relreplident
Michael Paquier [Wed, 20 May 2020 05:20:50 +0000 (14:20 +0900)]
Doc: Fix description of pg_class.relreplident

The description missed a comma and lacked an explanation of what happens
with REPLICA IDENTITY USING INDEX when the dependent index is dropped.

Author: Marina Polyakova
Reviewed-by: Daniel Gustafsson, Michael Paquier
Discussion: https://postgr.es/m/ad1a0badc32658b1bbb07aa312346a1d@postgrespro.ru
Backpatch-through: 9.5

5 years agoDoc: Replace reference to pg_stat_wal_receiver.received_lsn by flushed_lsn
Michael Paquier [Wed, 20 May 2020 00:12:52 +0000 (09:12 +0900)]
Doc: Replace reference to pg_stat_wal_receiver.received_lsn by flushed_lsn

Oversight in 2c8dd05d, where the view's column has been renamed.

Reported-by: Fujii Masao
Discussion: https://postgr.es/m/c049ffcf-d2fe-90f7-c8ba-0741035aa6a7@oss.nttdata.com

5 years agopart_strategy does not need its very own keyword classification.
Tom Lane [Wed, 20 May 2020 00:09:59 +0000 (20:09 -0400)]
part_strategy does not need its very own keyword classification.

This should be plain old ColId.  Making it so makes the grammar less
complicated, and makes the compiled tables a kilobyte or so smaller
(likely because they don't have to deal with a keyword classification
that's not used anyplace else).

5 years agoReconsider nbtree page deletion assertion.
Peter Geoghegan [Tue, 19 May 2020 22:04:34 +0000 (15:04 -0700)]
Reconsider nbtree page deletion assertion.

Commit 624686abcf8 added an assertion that verified that _bt_search
successfully relocated the leaf page undergoing deletion.  Page deletion
cannot deal with the case where the descent stack is to the right of the
page, so this seemed critical (deletion can only handle the case where
the descent stack is to the left of the leaf/target page).  However, the
assertion went a bit too far.

Since only a buffer pin is held on the leaf page throughout the call to
_bt_search, nothing guarantees that it can't have split during this
small window.  And if does actually split, _bt_search may end up
"relocating" a page to the right of the original target leaf page.  This
scenario seems extremely unlikely, but it must still be considered.
Remove the assertion, and document how we cope in this scenario.

5 years agoWITH TIES: number of rows is optional and defaults to one
Alvaro Herrera [Mon, 18 May 2020 23:28:46 +0000 (19:28 -0400)]
WITH TIES: number of rows is optional and defaults to one

FETCH FIRST .. ONLY implements this correctly, but we missed to include
it for FETCH FIRST .. WITH TIES in commit 357889eb17bb.

Author: Vik Fearing
Discussion: https://postgr.es/m/6aa690ef-551d-e24f-2690-c38c2442947c@postgresfriends.org

5 years agoStamp 13beta1.
Tom Lane [Mon, 18 May 2020 20:09:19 +0000 (16:09 -0400)]
Stamp 13beta1.

5 years agoRemove unused variables.
Tom Lane [Mon, 18 May 2020 17:21:36 +0000 (13:21 -0400)]
Remove unused variables.

g_comment_start and g_comment_end have been unused since commit
30ab5bd43d8f2082659191de8ae19be98c960ad7.

Daniel Gustafsson

Discussion: https://postgr.es/m/2CA1BA9F-CDF9-41BE-96A1-2EFD2A3EA6CA@yesql.se

5 years agodoc: PG 13 relnotes: fix typos
Bruce Momjian [Mon, 18 May 2020 14:20:09 +0000 (10:20 -0400)]
doc:  PG 13 relnotes:  fix typos

Reported-by: Daniel Gustafsson
Discussion: https://postgr.es/m/0A9D816E-F49C-470B-A23F-8B4AF999382B@yesql.se

5 years agoTranslation updates
Peter Eisentraut [Mon, 18 May 2020 10:49:30 +0000 (12:49 +0200)]
Translation updates

Source-Git-URL: https://git.postgresql.org/git/pgtranslation/messages.git
Source-Git-Hash: 031ca65d7825c3e539a3e62ea9d6630af12e6b6b

5 years agoFix typos in README
Magnus Hagander [Mon, 18 May 2020 09:55:11 +0000 (11:55 +0200)]
Fix typos in README

Author: Daniel Gustafsson

5 years agoFix comment in slot.c.
Amit Kapila [Mon, 18 May 2020 02:23:26 +0000 (07:53 +0530)]
Fix comment in slot.c.

Reported-by: Sawada Masahiko
Author: Sawada Masahiko
Reviewed-by: Amit Kapila
Backpatch-through: 9.5
Discussion: https://postgr.es/m/CA+fd4k4Ws7M7YQ8PqSym5WB1y75dZeBTd1sZJUQdfe0KJQ-iSA@mail.gmail.com

5 years agoCosmetic improvement for psql opfamily-related information
Alexander Korotkov [Sun, 17 May 2020 10:02:16 +0000 (13:02 +0300)]
Cosmetic improvement for psql opfamily-related information

 * Rename column "Opfamily Name" to "Operator family" for uniformity.
 * Rename column alias from "t1" to "t".

5 years agoFix translate_columns[] arrays in opfamily-related psql functions
Alexander Korotkov [Sun, 17 May 2020 09:53:34 +0000 (12:53 +0300)]
Fix translate_columns[] arrays in opfamily-related psql functions

Make number of translate_columns elements match the number of output columns.
The only "true" value, which was previously specified, seems to be intended
for opfamily operator "purpose" column.  But that column has already translated
values substituted.  So, all elements in translate_columns[] should be "false".

5 years agoImprove ordering for \dAo and \dAp psql commands
Alexander Korotkov [Sun, 17 May 2020 09:41:19 +0000 (12:41 +0300)]
Improve ordering for \dAo and \dAp psql commands

This commit changes ORDER BY clause for \dAo and \dAp psql commands in
the following way.
 * Operators for the same types are grouped together.
 * Same-class operators and procedures are listed before cross-class operators
   and procedures.

Modification of ORDER BY clause for \dAp required removing DISTINCT clause,
which doesn't seem to affect anything.

Discussion: https://postgr.es/m/20200511210856.GA18368%40alvherre.pgsql
Author: Alvaro Herrera revised by me
Reviewed-by: Alexander Korotkov, Nikita Glukhov
5 years agoFix more typos and grammar problems in the glossary
Alvaro Herrera [Sun, 17 May 2020 02:19:02 +0000 (22:19 -0400)]
Fix more typos and grammar problems in the glossary

Author: Erik Rijkers <er@xs4all.nl>
Discussion: https://postgr.es/m/508f2fb1764c3bd518ee96a4f2247d6f@xs4all.nl

5 years agoMop-up for wait event naming issues.
Tom Lane [Sun, 17 May 2020 01:00:05 +0000 (21:00 -0400)]
Mop-up for wait event naming issues.

Synchronize the event names for parallel hash join waits with other
event names, by getting rid of the slashes and dropping "-ing"
suffixes.  Rename ClogGroupUpdate to XactGroupUpdate, to match the
new SLRU name.  Move the ProcSignalBarrier event to the IPC category;
it doesn't belong under IO.

Also a bit more wordsmithing in the wait event documentation tables.

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

5 years agoMake pg_stat_wal_receiver consistent with the WAL receiver's shmem info
Michael Paquier [Sun, 17 May 2020 00:22:07 +0000 (09:22 +0900)]
Make pg_stat_wal_receiver consistent with the WAL receiver's shmem info

d140f2f3 has renamed receivedUpto to flushedUpto, and has added
writtenUpto to the WAL receiver's shared memory information, but
pg_stat_wal_receiver was not consistent with that.  This commit renames
received_lsn to flushed_lsn, and adds a new column called written_lsn.

Bump catalog version.

Author: Michael Paquier
Reviewed-by: Álvaro Herrera
Discussion: https://postgr.es/m/20200515090817.GA212736@paquier.xyz

5 years agoFix bugs in OpenSSL hook renaming.
Tom Lane [Sat, 16 May 2020 23:44:49 +0000 (19:44 -0400)]
Fix bugs in OpenSSL hook renaming.

libpq's exports.txt was overlooked in commit 36d108761, which the
buildfarm is quite unhappy about.

Also, I'd gathered that the plan included renaming PQgetSSLKeyPassHook
to PQgetSSLKeyPassHook_OpenSSL, but that didn't happen in the patch
as committed.  I'm taking it on my own authority to do so now, since
the window before beta1 is closing fast.

5 years agoRename PQsetSSLKeyPassHook and friends
Andrew Dunstan [Sat, 16 May 2020 20:20:43 +0000 (16:20 -0400)]
Rename PQsetSSLKeyPassHook and friends

4dc6355210 provided a way for libraries and clients to modify how libpq
handles client certificate passphrases, by installing a hook. However,
these routines are quite specific to how OpenSSL works, so it's
misleading and not future-proof to have these names not refer to OpenSSL.
Change all the names to add "_OpenSSL" after "Hook", and fix the docs
accordingly.

Author: Daniel Gustafsson

Discussion: https://postgr.es/m/981DE552-E399-45C2-9F60-3F0E3770CC61@yesql.se

5 years agoFix typo in glossary
Alvaro Herrera [Sat, 16 May 2020 19:10:36 +0000 (15:10 -0400)]
Fix typo in glossary

Reported privately by Justin Pryzby

5 years agoRun pgindent with new pg_bsd_indent version 2.1.1.
Tom Lane [Sat, 16 May 2020 15:54:51 +0000 (11:54 -0400)]
Run pgindent with new pg_bsd_indent version 2.1.1.

Thomas Munro fixed a longstanding annoyance in pg_bsd_indent, that
it would misformat lines containing IsA() macros on the assumption
that the IsA() call should be treated like a cast.  This improves
some other cases involving field/variable names that match typedefs,
too.  The only places that get worse are a couple of uses of the
OpenSSL macro STACK_OF(); we'll gladly take that trade-off.

Discussion: https://postgr.es/m/20200114221814.GA19630@alvherre.pgsql

5 years agoFinal pgindent run with pg_bsd_indent version 2.1.
Tom Lane [Sat, 16 May 2020 15:49:14 +0000 (11:49 -0400)]
Final pgindent run with pg_bsd_indent version 2.1.

This is just to provide a clean basis for comparison of the results
of the new version.  I did fix a typo that crept into 242dfcbaf.

Discussion: https://postgr.es/m/20200114221814.GA19630@alvherre.pgsql

5 years agoFix assertion with relation using REPLICA IDENTITY FULL in subscriber
Michael Paquier [Sat, 16 May 2020 09:15:18 +0000 (18:15 +0900)]
Fix assertion with relation using REPLICA IDENTITY FULL in subscriber

In a logical replication subscriber, a table using REPLICA IDENTITY FULL
which has a primary key would try to use the primary key's index
available to scan for a tuple, but an assertion only assumed as correct
the case of an index associated to REPLICA IDENTITY USING INDEX.  This
commit corrects the assertion so as the use of a primary key index is a
valid case.

Reported-by: Dilip Kumar
Analyzed-by: Dilip Kumar
Author: Euler Taveira
Reviewed-by: Michael Paquier, Masahiko Sawada
Discussion: https://postgr.es/m/CAFiTN-u64S5bUiPL1q5kwpHNd0hRnf1OE-bzxNiOs5zo84i51w@mail.gmail.com
Backpatch-through: 10

5 years agoChange locktype "speculative token" to "spectoken".
Tom Lane [Sat, 16 May 2020 01:47:21 +0000 (21:47 -0400)]
Change locktype "speculative token" to "spectoken".

It's just weird that this name wasn't chosen to look like an
identifier.  The suspicion that it wasn't thought about too
hard is reinforced by the fact that it wasn't documented in
the pg_locks view (until I did so, a day or two back).

Update, and add a comment reminding future adjusters of this
array to fix the docs too.

Do some desultory wordsmithing on various entries in the wait
events tables.

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

5 years agoFix walsender error cleanup code
Alvaro Herrera [Fri, 15 May 2020 23:59:29 +0000 (19:59 -0400)]
Fix walsender error cleanup code

In commit 850196b610d2 I (Álvaro) failed to handle the case of walsender
shutting down on an error before setting up its 'xlogreader' pointer;
the error handling code dereferences the pointer, causing a crash.
Fix by testing the pointer before trying to dereference it.

Kyotaro authored the code fix; I adopted Nathan's test case to be used
by the TAP tests and added the necessary PostgresNode change.

Reported-by: Nathan Bossart <bossartn@amazon.com>
Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/C04FC24E-903D-4423-B312-6910E4D846E5@amazon.com

5 years agoDrop the redundant "Lock" suffix from LWLock wait event names.
Tom Lane [Fri, 15 May 2020 23:55:56 +0000 (19:55 -0400)]
Drop the redundant "Lock" suffix from LWLock wait event names.

This was mostly confusing, especially since some wait events in
this class had the suffix and some did not.

While at it, stop exposing MainLWLockNames[] as a globally visible
name; any code using that directly is almost certainly wrong, as
its name has been misleading for some time.
(GetLWLockIdentifier() is what to use instead.)

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

5 years agoFix bogus initialization of replication origin shared memory state.
Tom Lane [Fri, 15 May 2020 23:05:39 +0000 (19:05 -0400)]
Fix bogus initialization of replication origin shared memory state.

The previous coding zeroed out offsetof(ReplicationStateCtl, states)
more bytes than it was entitled to, as a consequence of starting the
zeroing from the wrong pointer (or, if you prefer, using the wrong
calculation of how much to zero).

It's unsurprising that this has not caused any reported problems,
since it can be expected that the newly-allocated block is at the end
of what we've used in shared memory, and we always make the shmem
block substantially bigger than minimally necessary.  Nonetheless,
this is wrong and it could bite us someday; plus it's a dangerous
model for somebody to copy.

This dates back to the introduction of this code (commit 5aa235042),
so back-patch to all supported branches.

5 years agoRename assorted LWLock tranches.
Tom Lane [Fri, 15 May 2020 22:11:03 +0000 (18:11 -0400)]
Rename assorted LWLock tranches.

Choose names that fit into the conventions for wait event names
(particularly, that multi-word names are in the style MultiWordName)
and hopefully convey more information to non-hacker users than the
previous names did.

Also rename SerializablePredicateLockListLock to
SerializablePredicateListLock; the old name was long enough to cause
table formatting problems, plus the double occurrence of "Lock" seems
confusing/error-prone.

Also change a couple of particularly opaque LWLock field names.

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

5 years agoAdd comments linking pg_strftime to timestamptz_to_str
Alvaro Herrera [Fri, 15 May 2020 22:05:34 +0000 (18:05 -0400)]
Add comments linking pg_strftime to timestamptz_to_str

5 years agoAvoid killing btree items that are already dead
Alvaro Herrera [Fri, 15 May 2020 20:50:34 +0000 (16:50 -0400)]
Avoid killing btree items that are already dead

_bt_killitems marks btree items dead when a scan leaves the page where
they live, but it does so with only share lock (to improve concurrency).
This was historicall okay, since killing a dead item has no
consequences.  However, with the advent of data checksums and
wal_log_hints, this action incurs a WAL full-page-image record of the
page.  Multiple concurrent processes would write the same page several
times, leading to WAL bloat.  The probability of this happening can be
reduced by only killing items if they're not already dead, so change the
code to do that.

The problem could eliminated completely by having _bt_killitems upgrade
to exclusive lock upon seeing a killable item, but that would reduce
concurrency so it's considered a cure worse than the disease.

Backpatch all the way back to 9.5, since wal_log_hints was introduced in
9.4.

Author: Masahiko Sawada <masahiko.sawada@2ndquadrant.com>
Discussion: https://postgr.es/m/CA+fd4k6PeRj2CkzapWNrERkja5G0-6D-YQiKfbukJV+qZGFZ_Q@mail.gmail.com

5 years agoRename SLRU structures and associated LWLocks.
Tom Lane [Fri, 15 May 2020 18:28:19 +0000 (14:28 -0400)]
Rename SLRU structures and associated LWLocks.

Originally, the names assigned to SLRUs had no purpose other than
being shmem lookup keys, so not a lot of thought went into them.
As of v13, though, we're exposing them in the pg_stat_slru view and
the pg_stat_reset_slru function, so it seems advisable to take a bit
more care.  Rename them to names based on the associated on-disk
storage directories (which fortunately we *did* think about, to some
extent; since those are also visible to DBAs, consistency seems like
a good thing).  Also rename the associated LWLocks, since those names
are likewise user-exposed now as wait event names.

For the most part I only touched symbols used in the respective modules'
SimpleLruInit() calls, not the names of other related objects.  This
renaming could have been taken further, and maybe someday we will do so.
But for now it seems undesirable to change the names of any globally
visible functions or structs, so some inconsistency is unavoidable.

(But I *did* terminate "oldserxid" with prejudice, as I found that
name both unreadable and not descriptive of the SLRU's contents.)

Table 27.12 needs re-alphabetization now, but I'll leave that till
after the other LWLock renamings I have in mind.

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

5 years agoReview of the glossary
Alvaro Herrera [Fri, 15 May 2020 17:24:22 +0000 (13:24 -0400)]
Review of the glossary

Add some more terms, clarify some definitions, remove redundant terms,
move a couple of terms to keep alphabetical order.

Co-authored-by: Jürgen Purtz <juergen@purtz.de>
Co-authored-by: Erik Rijkers <er@xs4all.nl>
Co-authored-by: Laurenz Albe <laurenz.albe@cybertec.at>
Discussion: https://postgr.es/m/7b9b469e804777ac9df4d37716db935e@xs4all.nl

5 years agodoc: PG 13 rels: use xref labels referencing ref/*.sgml files
Bruce Momjian [Fri, 15 May 2020 16:47:07 +0000 (12:47 -0400)]
doc:  PG 13 rels:  use xref labels referencing ref/*.sgml files

This avoids using <link> and supplied text.

5 years agodocs: add xreflabel entries for autovacuum, SP-GiST, and TOAST
Bruce Momjian [Fri, 15 May 2020 16:38:40 +0000 (12:38 -0400)]
docs:  add xreflabel entries for autovacuum, SP-GiST, and TOAST

This is for use by the PG 13 release notes, but might be used for minor
release notes in the future.

Backpatch-through: 9.5

5 years agodoc: add missing xreflabels to the main docs (not refs)
Bruce Momjian [Fri, 15 May 2020 16:05:43 +0000 (12:05 -0400)]
doc:  add missing xreflabels to the main docs (not refs)

Add missing xreflabels for index types, geqo, libpq, spi, server-side
languages, ecpg, and vaacuumlo.

Backpatch-through: 9.5

5 years agodoc: PG 13 relnotes: adjust UUID item, again
Bruce Momjian [Fri, 15 May 2020 15:21:43 +0000 (11:21 -0400)]
doc: PG 13 relnotes:  adjust UUID item, again

5 years agodoc: PG 13 relnotes: fix uuid item
Bruce Momjian [Fri, 15 May 2020 14:57:14 +0000 (10:57 -0400)]
doc:  PG 13 relnotes:  fix uuid item

5 years agodoc: PG 13 relnotes: final SGML indenting adjustments
Bruce Momjian [Fri, 15 May 2020 14:40:09 +0000 (10:40 -0400)]
doc:  PG 13 relnotes:  final SGML indenting adjustments

5 years agodoc: remove extra blank line at the top of SGML files
Bruce Momjian [Fri, 15 May 2020 13:55:43 +0000 (09:55 -0400)]
doc:  remove extra blank line at the top of SGML files

Backpatch-through: 9.5

5 years agodoc: make ref/*.sgml file header comment layout consistent
Bruce Momjian [Fri, 15 May 2020 12:52:24 +0000 (08:52 -0400)]
doc:  make ref/*.sgml file header comment layout consistent

5 years agodoc: PG 13 relnotes: fix xref link and remove extra word
Bruce Momjian [Fri, 15 May 2020 12:29:57 +0000 (08:29 -0400)]
doc:  PG 13 relnotes:  fix xref link and remove extra word

5 years agoMake COPY TO keep locks until the transaction end.
Amit Kapila [Fri, 15 May 2020 02:40:00 +0000 (08:10 +0530)]
Make COPY TO keep locks until the transaction end.

COPY TO released the ACCESS SHARE lock immediately when it was done rather
than holding on to it until the end of the transaction.

This breaks the case where a REPEATABLE READ transaction could see an
empty table if it repeats a COPY statement and somebody truncated the
table in the meantime.

Before 4dded12faad the lock was also released after COPY FROM, but the
commit failed to notice the irregularity in COPY TO.

This is old behavior but doesn't seem important enough to backpatch.

Author: Laurenz Albe, based on suggestion by Robert Haas and Tom Lane
Reviewed-by: Amit Kapila
Discussion: https://postgr.es/m/7bcfc39d4176faf85ab317d0c26786953646a411.camel@cybertec.at

5 years agodocs: PG 13 relnotes: add links and SGML formatting
Bruce Momjian [Fri, 15 May 2020 02:36:21 +0000 (22:36 -0400)]
docs:  PG 13 relnotes:  add links and SGML formatting