Commit Graph

56309 Commits

Author SHA1 Message Date
Michael Paquier d522b05c8c hstore: Tighten key/value parsing check for whitespaces
isspace() can be locale-sensitive depending on the platform, causing
hstore to consider as whitespaces characters it should not see as such.
For example, U+0105, being decoded as 0xC4 0x85 in UTF-8, would be
discarded from the input given.

This problem is similar to 9ae2661, though it was missed that hstore
can also manipulate non-ASCII inputs, so replace the existing isspace()
calls with scanner_isspace().

This problem exists for a long time, so backpatch all the way down.

Author: Evan Jones
Discussion: https://postgr.es/m/CA+HWA9awUW0+RV_gO9r1ABZwGoZxPztcJxPy8vMFSTbTfi4jig@mail.gmail.com
Backpatch-through: 11
2023-06-12 09:14:03 +09:00
Peter Geoghegan d088ba5a5a nbtree: Allocate new pages in separate function.
Split nbtree's _bt_getbuf function is two: code that read locks or write
locks existing pages remains in _bt_getbuf, while code that deals with
allocating new pages is moved to a new, dedicated function called
_bt_allocbuf.  This simplifies most _bt_getbuf callers, since it is no
longer necessary for them to pass a heaprel argument.  Many of the
changes to nbtree from commit 61b313e4 can be reverted.  This minimizes
the divergence between HEAD/PostgreSQL 16 and earlier release branches.

_bt_allocbuf replaces the previous nbtree idiom of passing P_NEW to
_bt_getbuf.  There are only 3 affected call sites, all of which continue
to pass a heaprel for recovery conflict purposes.  Note that nbtree's
use of P_NEW was superficial; nbtree never actually relied on the P_NEW
code paths in bufmgr.c, so this change is strictly mechanical.

GiST already took the same approach; it has a dedicated function for
allocating new pages called gistNewBuffer().  That factor allowed commit
61b313e4 to make much more targeted changes to GiST.

Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/CAH2-Wz=8Z9qY58bjm_7TAHgtW6RzZ5Ke62q5emdCEy9BAzwhmg@mail.gmail.com
2023-06-10 14:08:25 -07:00
Peter Geoghegan fe879ae3a8 Add another old commit to git-blame-ignore-revs. 2023-06-10 13:55:15 -07:00
Jeff Davis 2fcc7ee7af Revert "Fix search_path to a safe value during maintenance operations."
This reverts commit 05e1737351.
2023-06-10 08:11:41 -07:00
Andres Freund a1cd982098 meson: Add dependencies to perl modules to various script invocations
Eventually it is likely worth trying to deal with this in a more expansive
way, by generating dependency files generated within the scripts. But it's not
entirely obvious how to do that in perl and is work more suitable for 17
anyway.

Reported-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Reviewed-by: Tristan Partin <tristan@neon.tech>
Discussion: https://postgr.es/m/87v8g7s6bf.fsf@wibble.ilmari.org
2023-06-09 20:12:16 -07:00
Bruce Momjian b9e3f8005c doc: PG 16 relnotes, add author
Reported-by: Masahiko Sawada

Discussion: https://postgr.es/m/CAD21AoDP46y+1yUMikYWhCfkhSEuoXmHq2SV8_PyQoM1uWBRbg@mail.gmail.com
2023-06-09 21:04:28 -04:00
Jeff Davis 05e1737351 Fix search_path to a safe value during maintenance operations.
While executing maintenance operations (ANALYZE, CLUSTER, REFRESH
MATERIALIZED VIEW, REINDEX, or VACUUM), set search_path to
'pg_catalog, pg_temp' to prevent inconsistent behavior.

Functions that are used for functional indexes, in index expressions,
or in materialized views and depend on a different search path must be
declared with CREATE FUNCTION ... SET search_path='...'.

This change addresses a security risk introduced in commit 60684dd834,
where a role with MAINTAIN privileges on a table may be able to
escalate privileges to the table owner. That commit is not yet part of
any release, so no need to backpatch.

Discussion: https://postgr.es/m/e44327179e5c9015c8dda67351c04da552066017.camel%40j-davis.com
Reviewed-by: Greg Stark
Reviewed-by: Nathan Bossart
2023-06-09 11:20:47 -07:00
Nathan Bossart 9aee26a491 Fix missing word in nbtree/README.
Reported-by: Daniel Westermann
Author: Gurjeet Singh
Reviewed-by: Richard Guo
Discussion: https://postgr.es/m/ZR0P278MB0427F0E0CE4ED140F52D1923D250A%40ZR0P278MB0427.CHEP278.PROD.OUTLOOK.COM
2023-06-08 21:20:24 -07:00
Michael Paquier 392ea0c78f Refactor routine to find single log content pattern in TAP tests
The same routine to check if a specific pattern can be found in the
server logs was copied over four different test scripts.  This refactors
the whole to use a single routine located in PostgreSQL::Test::Cluster,
named log_contains, to grab the contents of the server logs and check
for a specific pattern.

On HEAD, the code previously used assumed that slurp_file() could not
handle an undefined offset, setting it to zero, but slurp_file() does
do an extra fseek() before retrieving the log contents only if an offset
is defined.  In two places, the test was retrieving the full log
contents with slurp_file() after calling substr() to apply an offset,
ignoring that slurp_file() would be able to handle that.

Backpatch all the way down to ease the introduction of new tests that
could rely on the new routine.

Author: Vignesh C
Reviewed-by: Andrew Dunstan, Dagfinn Ilmari Mannsåker, Michael Paquier
Discussion: https://postgr.es/m/CALDaNm0YSiLpjCmajwLfidQrFOrLNKPQir7s__PeVvh9U3uoTQ@mail.gmail.com
Backpatch-through: 11
2023-06-09 11:56:27 +09:00
Masahiko Sawada a83edeaf68 Honor run_as_owner option in tablesync worker.
Commit 482675987 introduced "run_as_owner" subscription option so that
subscription runs with either the permissions of the subscription
owner or the permission of the table owner. However, tablesync workers
did not use this option for the initial data copy.

With this change, tablesync workers run with appropriate permissions
based on "run_as_owner" option.

Ajin Cherian, with changes and regression tests added by me.

Reported-By: Amit Kapila
Author: Ajin Cherian, Masahiko Sawada
Reviewed-by: Ajin Cherian, Amit Kapila
Discussion: https://postgr.es/m/CAA4eK1L=qzRHPEn+qeMoKQGFBzqGoLBzt_ov0A89iFFiut+ppA@mail.gmail.com
2023-06-09 10:43:03 +09:00
Michael Paquier 26eaf82e71 Refactor log check logic for connect_ok/fails in PostgreSQL::Test::Cluster
This commit refactors a bit the code in charge of checking for log
patterns when connections fail or succeed, by moving the log pattern
checks into their own routine, for clarity.  This has come up as
something to improve while discussing the refactoring of find_in_log().

Backpatch down to 14 where these routines are used, to ease the
introduction of new tests that could rely on them.

Author: Vignesh C, Michael Paquier
Discussion: https://postgr.es/m/CALDaNm0YSiLpjCmajwLfidQrFOrLNKPQir7s__PeVvh9U3uoTQ@mail.gmail.com
Backpatch-through: 14
2023-06-09 09:37:21 +09:00
Tom Lane 9a2dbc614e Fix oversight in outer join removal.
A placeholder that references the outer join's relid in ph_eval_at
is logically "above" the join, and therefore we can't remove its
PlaceHolderInfo: it might still be used somewhere in the query.

This was not an issue pre-v16 because we failed to remove the join
at all in such cases.  The new outer-join-aware-Var infrastructure
permits deducing that it's okay to remove the join, but then we
have to clean up correctly afterwards.

Report and fix by Richard Guo

Discussion: https://postgr.es/m/CAMbWs4_tuVn9EwwMcggGiZJWWstdXX_ci8FeEU17vs+4nLgw3w@mail.gmail.com
2023-06-08 17:10:04 -04:00
Tom Lane fbf80421ea Re-allow INDEX_VAR as rt_index in ChangeVarNodes().
Apparently some extensions are in the habit of calling
ChangeVarNodes() with INDEX_VAR as the rt_index to replace.
That worked before 2489d76c4, at least as long as there were
not PlaceHolderVars in the expression; but now it fails
because bms_is_member spits up.  Add a test to avoid that.

Per report from Anton Melnikov, though this is not his
proposed patch.

Discussion: https://postgr.es/m/5b370a46-f6d2-373d-9dbc-0d55250e82c1@inbox.ru
2023-06-08 13:11:49 -04:00
Tom Lane d98ed080bb Fix small overestimation of base64 encoding output length.
pg_base64_enc_len() and its clones overestimated the output
length by up to 2 bytes, as a result of sloppy thinking about
where to divide.  No callers require a precise estimate, so
this has no consequences worse than palloc'ing a byte or two
more than necessary.  We might as well get it right though.

This bug is very ancient, dating to commit 79d78bb26 which
added encode.c.  (The other instances were presumably copied
from there.)  Still, it doesn't quite seem worth back-patching.

Oleg Tselebrovskiy

Discussion: https://postgr.es/m/f94da55286a63022150bc266afdab754@postgrespro.ru
2023-06-08 11:24:31 -04:00
Fujii Masao 378d73ef20 doc: Fix example command for ALTER FOREIGN TABLE ... OPTIONS.
In the documentation, previously the example command for
ALTER FOREIGN TABLE ... OPTIONS incorrectly included both
the option name and value with the DROP operation.
The correct syntax for the DROP operation requires only
the name of the option to be specified. This commit fixes
the example by removing the option value from the DROP operation.

Back-patch to all supported versions.

Author: Mehmet Emin KARAKAS <emin100@gmail.com>
Reviewed-by: Fujii Masao
Discussion: https://postgr.es/m/CANQrdXAHzbcEYhjGoe5A42OmfvdQhHFJzyKj9gJvHuDKyOF5Ng@mail.gmail.com
2023-06-08 20:12:51 +09:00
David Rowley 53ea2b7ad0 Don't use _BitScanForward64/_BitScanReverse64 on 32-bit MSVC builds
677319746 added support for making use of MSVC's bit scanning functions.
However, that commit failed to consider 32-bit MSVC builds where the
64-bit versions of these functions are unavailable.  This resulted in
compilation failures on 32-bit MSVC.

Here we adjust the code so we fall back on the manual way of finding the
bit positions for 64-bit integers when building on 32-bit MSVC.

Bug: #17967
Reported-by: Youmiu Mo
Discussion: https://postgr.es/m/17967-cd21e34a314141b2@postgresql.org
2023-06-08 10:10:34 +12:00
Tomas Vondra f24523672d Use per-tuple context in ExecGetAllUpdatedCols
Commit fc22b6623b (generated columns) replaced ExecGetUpdatedCols() with
ExecGetAllUpdatedCols() in a couple places handling UPDATE (triggers and
lock mode). However, ExecGetUpdatedCols() did exec_rt_fetch() while
ExecGetAllUpdatedCols() also allocates memory through bms_union()
without paying attention to the memory context and happened to use the
long-lived ExecutorState, leaking the memory until the end of the query.

The amount of leaked memory is proportional to the number of (updated)
attributes, types of UPDATE triggers, and the number of processed rows
(which for UPDATE ... FROM ... may be much higher than updated rows).

Fixed by switching to the per-tuple context in GetAllUpdatedColumns().
This is fine for all in-core callers, but external callers may need to
copy the result. But we're not aware of any such callers.

Note the issue was introduced by fc22b6623b, but the macros were later
renamed by f50e888990.

Backpatch to 12, where the issue was introduced.

Reported-by: Tomas Vondra
Reviewed-by: Andres Freund, Tom Lane, Jakub Wartak
Backpatch-through: 12
Discussion: https://postgr.es/m/222a3442-7f7d-246c-ed9b-a76209d19239@enterprisedb.com
2023-06-07 18:54:34 +02:00
Peter Eisentraut fb5a7d84d2 doc: Fix confusing positioning of notes in connection settings
Reported-by: Jonathan S. Katz <jkatz@postgresql.org>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://www.postgresql.org/message-id/flat/6f825d42-a1ce-492a-2ea7-c83e6e65fa8b%40postgresql.org
2023-06-07 17:55:46 +02:00
Peter Eisentraut b0f6c43716 Remove read-only server settings lc_collate and lc_ctype
The GUC settings lc_collate and lc_ctype are from a time when those
locale settings were cluster-global.  When those locale settings were
made per-database (PG 8.4), the settings were kept as read-only.  As
of PG 15, you can use ICU as the per-database locale provider, so
examining these settings is already less meaningful and possibly
confusing, since you need to look into pg_database to find out what is
really happening, and they would likely become fully obsolete in the
future anyway.

Reviewed-by: Jeff Davis <pgsql@j-davis.com>
Discussion: https://www.postgresql.org/message-id/696054d1-bc88-b6ab-129a-18b8bce6a6f0@enterprisedb.com
2023-06-07 16:57:06 +02:00
Amit Kapila d64e6468f4 Reload configuration more frequently in apply worker.
The apply worker was not reloading the configuration while processing
messages if there is a continuous flow of messages from upstream. It was
also not reloading the configuration if there is a change in the
configuration after it has waited for the message and before receiving the
new replication message. This can lead to failure in tests because we
expect that after reload, the behavior of apply worker to respect the
changed GUCs.

We found this while analyzing a rare buildfarm failure.

Author: Hou Zhijie
Reviewed-by: Amit Kapila
Discussion: https://postgr.es/m/OS0PR01MB5716AF9079CC0755CD015322947E9@OS0PR01MB5716.jpnprd01.prod.outlook.com
2023-06-07 09:19:17 +05:30
Heikki Linnakangas 95f0340c3b Initialize 'recordXtime' to silence compiler warning.
In reality, recordXtime will always be set by the getRecordTimestamp
call, but the compiler doesn't necessarily see that.

Back-patch to all supported versions.

Author: Tristan Partin
Discussion: https://www.postgresql.org/message-id/CT5MN8E11U0M.1NYNCHXYUHY41@gonk
2023-06-06 20:30:53 +03:00
Bruce Momjian 3f1aaaa180 doc: PG 16 relnotes, fix PREPARE/EXECUTE wording
Reported-by: Erik Rijkers

Discussion: https://postgr.es/m/73f361d0-237e-3413-224b-86ab6b71a3dd@xs4all.nl
2023-06-05 14:00:37 -04:00
Peter Eisentraut 08235203dd Remove obsolete comment
OIDs are no longer system columns, since 578b229718.
2023-06-05 15:33:08 +02:00
David Rowley 8cddea9a53 Doc: unify use of timestamp with time zone vs timestamptz
For pg_stat_all_tables, last_vacuum, last_autovacuum and co all used the
full "timestamp with time zone" type name.  For consistency, make the
newly added "last_seq_scan" also use the full type name instead of
"timestamptz".

Author: Noriyoshi Shinoda
Discussion: https://postgr.es/m/DM4PR84MB17348EA11FA90A9BE896AF89EE489%40DM4PR84MB1734.NAMPRD84.PROD.OUTLOOK.COM
2023-06-05 17:34:27 +12:00
Tom Lane 0211544969 Doc: explain about dependency tracking for new-style SQL functions.
5.14 Dependency Tracking was not updated when we added new-style
SQL functions.  Improve that.

Noted by Sami Imseih.  Back-patch to v14 where
new-style SQL functions came in.

Discussion: https://postgr.es/m/2C1933AB-C2F8-499B-9D18-4AC1882256A0@amazon.com
2023-06-04 13:27:34 -04:00
Tom Lane 0161074786 Fix pg_dump's failure to honor dependencies of SQL functions.
A new-style SQL function can contain a parse-time dependency
on a unique index, much as views and matviews can (such cases
arise from GROUP BY and ON CONFLICT clauses, for example).
To dump and restore such a function successfully, pg_dump must
postpone the function until after the unique index is created,
which will happen in the post-data part of the dump.  Therefore
we have to remove the normal constraint that functions are
dumped in pre-data.  Add code similar to the existing logic
that handles this for matviews.  I added test cases for both
as well, since code coverage tests showed that we weren't
testing the matview logic.

Per report from Sami Imseih.  Back-patch to v14 where
new-style SQL functions came in.

Discussion: https://postgr.es/m/2C1933AB-C2F8-499B-9D18-4AC1882256A0@amazon.com
2023-06-04 13:05:54 -04:00
Tom Lane b3f32a6c31 Fix misuse of pg_log_info() for details/hints.
Two places in pg_dump_sort.c were using pg_log_info() to add
more details to a message printed with pg_log_warning().
This is bad, because at default verbosity level we would
print the warning line but not the details.  One should use
pg_log_warning_detail() or pg_log_warning_hint() instead.
Commit 9a374b77f got rid of most such abuses, but unaccountably
missed these.

Noted while studying a bug report from Sami Imseih.
Back-patch to v15 where 9a374b77f came in.  (Prior versions
don't have the missing-details misbehavior, for reasons
I didn't bother to track down.)

Discussion: https://postgr.es/m/2C1933AB-C2F8-499B-9D18-4AC1882256A0@amazon.com
2023-06-04 11:22:05 -04:00
Michael Paquier d0f4824a54 doc: Add note to prevent server spoofing with SCRAM
The set of recommendations added in the documentation with this commit
helps in avoiding SCRAM exchanges with untrusted servers.

Author: Jacob Champion, Jonathan Katz
Reviewed-by: Stephen Frost, Daniel Gustafsson, Michael Paquier
Discussion: https://postgr.es/m/CAAWbhmg5Gh0JetNbQi7z0yOsdsN9YECv8GoY-QBGBBiip9+JOw@mail.gmail.com
2023-06-03 17:44:09 -04:00
Bruce Momjian 47b7051bc8 doc: PG 16 relnotes, add psql \df+ source code change
Reported-by: bzm@2bz.de

Discussion: https://postgr.es/m/17957-e1db8b1c15af444a@postgresql.org
2023-06-01 19:59:46 -04:00
Bruce Momjian 9eb1817d5c doc: add missing "the" in LATERAL sentence.
Backpatch-through: 11
2023-06-01 10:22:16 -04:00
Bruce Momjian e6a254c0d4 doc: PG 16 relnotes, move memory item and reword OUTER item
Reported-by: David Rowley

Discussion: https://postgr.es/m/CAApHDvqmqxcX2n9NwvsfnsN0be6DjmyLSjz3Jk2DaZO5OLW+pw@mail.gmail.com
2023-05-31 07:01:21 -04:00
Bruce Momjian 409d24485c doc: PG 16 relnotes, add memory overhead reduction item
Reported-by: David Rowley

Discussion: https://postgr.es/m/CAApHDvqnUoyrJxS4uqnKo87b3_cUjaDDte4NQag49YHu1oEOgA@mail.gmail.com
2023-05-30 19:32:15 -04:00
Bruce Momjian f7c16a120c doc: PG 16 relnotes, adjust subscription origin mention
Reported-by: Masahiko Sawada

Discussion: https://postgr.es/m/CAD21AoC+VihMWs3-xVB3Z=8LzLbsQc52TO29o25rzfqcnJDCUQ@mail.gmail.com
2023-05-30 19:08:14 -04:00
Bruce Momjian 0bcb3ca3b9 doc: PG 16 relnotes, adjust auto_explain logging item
Reported-by: Dagfinn Ilmari Mannsåker

Discussion: https://postgr.es/m/878rdctb7o.fsf@wibble.ilmari.org
2023-05-30 06:04:09 -04:00
Daniel Gustafsson e77c6c55e8 doc: Add missing backend_type to pg_stat_activity
Commit 0c679464a8 added the missing backendDesc for B_STANDALONE_BACKEND
but missed updating the list of backend types in the documentation.  Fix
by adding it to the list.

Author: Noriyoshi Shinoda <noriyoshi.shinoda@hpe.com>
Discussion: https://postgr.es/m/DM4PR84MB1734ECEA02BCB59564E8FC03EE4A9@DM4PR84MB1734.NAMPRD84.PROD.OUTLOOK.COM
2023-05-30 10:31:11 +02:00
Bruce Momjian 5a64640966 doc: PG 16 relnotes: adjust outer/full hash join parallelization
Reported-by: David Rowley

Discussion: https://postgr.es/m/CAApHDvph4djrP+zjOK67VcgbB_p9Zn8QoO7Qctt4oQgUC_ejEw@mail.gmail.com
2023-05-29 14:36:27 -04:00
Bruce Momjian 9e28b83ae6 doc: PG 16 relnotes, fix duplicate author and commit
Reported-by: Masahiko Sawada

Discussion: https://postgr.es/m/CAD21AoALE_joh=H-j5sdaAfDs=BXtCy6BQKYZBTi=neU8k0VFw@mail.gmail.com
2023-05-29 13:49:05 -04:00
Bruce Momjian 503b0556d9 doc: PG 16 relnotes, fix "locale" typo and windows locale text
Reported-by: Laurenz Albe, Álvaro Herrera

Discussion: https://postgr.es/m/70a09a9fa557b632f4b1505395aaa6c4cb77b55a.camel@cybertec.at
2023-05-27 23:04:48 -04:00
Jeff Davis ec1264f01e ICU: use uloc_getDefault() for initdb.
Simpler, and better preserves the locale name as read from the
environment.

Author: Daniel Verite
Discussion: https://postgr.es/m/a6204a46-c077-451b-8f9d-8965d95bb57c@manitou-mail.org
2023-05-26 11:26:11 -07:00
Tom Lane 7a844c77ec Fix joinclause removal logic to cope with cloned clauses.
When we're deleting a no-op LEFT JOIN from the query, we must remove
the join's joinclauses from surviving relations' joininfo lists.
The invention of "cloned" clauses in 2489d76c4 broke the logic for
that; it'd fail to remove clones that include OJ relids outside the
doomed join's min relid sets, which could happen if that join was
previously discovered to commute with some other join.

This accidentally failed to cause problems in the majority of cases,
because we'd never decide that such a cloned clause was evaluatable at
any surviving join.  However, Richard Guo discovered a case where that
did happen, leading to "no relation entry for relid" errors later.
Also, adding assertions that a non-removed clause contains no Vars from
the doomed join exposes that there are quite a few existing regression
test cases where the problem happens but is accidentally not exposed.

The fix for this is just to include the target join's commute_above_r
and commute_below_l sets in the relid set we test against when
deciding whether a join clause is "pushed down" and thus not
removable.

While at it, do a little refactoring: the join's relid set can be
computed inside remove_rel_from_query rather than in the caller.

Patch by me; thanks to Richard Guo for review.

Discussion: https://postgr.es/m/CAMbWs4_PHrRqTKDNnTRsxxQy6BtYCVKsgXm1_gdN2yQ=kmcO5g@mail.gmail.com
2023-05-26 12:13:19 -04:00
Jeff Davis f4a9422c0c Doc fixes for commit 1e16af8ab5.
Discussion: https://postgr.es/m/275c47ea-e7f3-e654-c99a-63bc116997d7@enterprisedb.com
2023-05-25 17:05:50 -07:00
Peter Geoghegan 5abff197cc nbtree VACUUM: cope with right sibling link corruption.
Avoid "right sibling's left-link doesn't match" errors when vacuuming a
corrupt nbtree index.  Just LOG the issue and press on.  That way VACUUM
will have a decent chance of finishing off all required processing for
the index (and for the table as a whole).

This error was seen in the field from time to time (it's more than a
theoretical risk), so giving VACUUM the ability to press on like this
has real value.  Nothing short of a REINDEX is expected to fix the
underlying index corruption, so giving up (by throwing an error) risks
making a bad situation far worse.  Anything that blocks forward progress
by VACUUM like this might go unnoticed for a long time.  This could
eventually lead to a wraparound/xidStopLimit outage.

Note that _bt_unlink_halfdead_page() has always been able to bail on
page deletion when the target page's left sibling page was in an
inconsistent state.  It now does the same thing (returns false to back
out of the second phase of deletion) when it notices sibling link
corruption in the target page's right sibling page.

This is similar to the work from commit 5b861baa (later backpatched as
commit 43e409ce), which taught nbtree to press on with vacuuming an
index when page deletion fails to "re-find" a downlink in the target
page's parent page.  The "re-find" check seems to make VACUUM bail on
page deletion more often in practice, but there is no reason to take any
chances here.

Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/CAH2-Wzko2q2kP1+UvgJyP9g0mF4hopK0NtQZcxwvMv9_ytGhkQ@mail.gmail.com
Backpatch: 11- (all supported versions).
2023-05-25 15:33:00 -07:00
Tom Lane 991a3df227 Fix filtering of "cloned" outer-join quals some more.
We've had multiple issues with the clause_is_computable_at logic that
I introduced in 2489d76c4: it's been known to accept more than one
clone of the same qual at the same plan node, and also to accept no
clones at all.  It's looking impractical to get it 100% right on the
basis of the currently-stored information, so fix it by introducing a
new RestrictInfo field "incompatible_relids" that explicitly shows
which outer joins a given clone mustn't be pushed above.

In principle we could populate this field in every RestrictInfo, but
that would cost space and there doesn't presently seem to be a need
for it in general.  Also, while deconstruct_distribute_oj_quals can
easily fill the field with the remaining members of the commutative
join set that it's considering, computing it in the general case
seems again pretty complicated.  So for now, just fill it for
clone quals.

Along the way, fix a bug that may or may not be only latent:
equivclass.c was generating replacement clauses with is_pushed_down
and has_clone/is_clone markings that didn't match their
required_relids.  This led me to conclude that leaving the clone flags
out of make_restrictinfo's purview wasn't such a great idea after all,
so add them.

Per report from Richard Guo.

Discussion: https://postgr.es/m/CAMbWs48EYi_9-pSd0ORes1kTmTeAjT4Q3gu49hJtYCbSn2JyeA@mail.gmail.com
2023-05-25 10:28:33 -04:00
Daniel Gustafsson 913b3da6ae doc: fix typo in language tag documentation
Commit 1e16af8ab5 accidentally mistyped 'language' in one place.
2023-05-25 12:49:26 +02:00
Daniel Gustafsson 661bf96cd2 doc: Fix example query for pg_walinspect
The LIMIT clause had ended up in the wrong place in the query.
Backpatch to v15 where pg_walinspect was introduced.

Reported-by: Jian He <jian.universality@gmail.com>
Discussion: https://postgr.es/m/CACJufxHqXDr4NnmwmR6pEiVPAg54J0dgwMuYQzrH5BX6+NtF1g@mail.gmail.com
Backpatch-through: 15
2023-05-25 12:43:16 +02:00
Alvaro Herrera 8f5e42d334
Fix pgbench in prepared mode with an empty pipeline
It crashes because it references memory that's not allocated in that
particular case.  Fix by allocating it.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/bcf802a6-afc1-95b9-7bf4-c5dd868ec144@gmail.com
2023-05-25 12:36:18 +02:00
Michael Paquier ecb968e7e3 Fix typo in TAP tests of vacuumdb
Noticed while scanning the area, introduced in 582edc3.
2023-05-25 16:26:08 +09:00
Bruce Momjian 46ba86cd32 doc: PG 16 relnotes, add author from previous merge
Reported-by: John Naylor

Discussion: https://postgr.es/m/CAFBsxsEMoNdg6CCMuQ-6YJ8G=AgGNMVuiTb5Di5bsoPfBb=9CA@mail.gmail.com
2023-05-24 22:03:40 -04:00
Bruce Momjian 5c2c59ba0b doc: PG 16 relnotes, wording adjustments
Reported-by: Erik Rijkers

Discussion: https://postgr.es/m/c4a88acf-ab1a-a912-d4a9-5e19b323c5ed@xs4all.nl
2023-05-24 12:18:43 -04:00
Bruce Momjian ad5406246b doc: PG 16 relnotes, merge and move vector items
Reported-by: John Naylor

Discussion: https://postgr.es/m/CAFBsxsEPg8L2MmGqavc8JByC=WF_Mnkhn-KKnFPkcqh0hydung@mail.gmail.com
2023-05-24 09:54:34 -04:00