Tom Lane [Thu, 18 May 2023 14:39:16 +0000 (10:39 -0400)]
Tweak API of new function clause_is_computable_at().
Pass it the RestrictInfo under consideration, not just the
clause_relids. This should save some trivial amount of
code at the call sites, and it gives us more flexibility
about what clause_is_computable_at() does. There's no
actual functional change here, though.
Discussion: https://postgr.es/m/
3564467.
1684352557@sss.pgh.pa.us
Jeff Davis [Wed, 17 May 2023 20:43:41 +0000 (13:43 -0700)]
ICU: check for U_STRING_NOT_TERMINATED_WARNING.
Fixes memory error in cases where the length of the language name
returned by uloc_getLanguage() is exactly ULOC_LANG_CAPACITY, in which
case the status is set to U_STRING_NOT_TERMINATED_WARNING.
Also check in call sites for other ICU functions that are expected to
return a C string to be safe (no bug is known at these other call
sites).
Reported-by: Alexander Lakhin
Discussion: https://postgr.es/m/
2098874d-c111-41e4-9063-
30bcf135226b@gmail.com
Jeff Davis [Wed, 17 May 2023 20:18:40 +0000 (13:18 -0700)]
Reduce icu_validation_level default to WARNING.
Discussion: https://postgr.es/m/
daa9f060aa2349ebc84444515efece49e7b32c5d[email protected]
Peter Eisentraut [Wed, 17 May 2023 19:33:13 +0000 (21:33 +0200)]
Fix error message wordings
The original patch for percentrepl.c
c96de2ce17 adopted the error
messages from basebackup_to_shell, but that uses terminology that
doesn't really fit with the new API naming.
Andres Freund [Wed, 17 May 2023 18:18:35 +0000 (11:18 -0700)]
Add writeback to pg_stat_io
28e626bde00 added the concept of IOOps but neglected to include writeback
operations.
ac8d53dae5 added time spent doing these I/O operations. Without
counting writeback, checkpointer write time in the log often differed
substantially from that in pg_stat_io. To fix this, add IOOp IOOP_WRITEBACK
and track writeback in pg_stat_io.
Bumps catversion.
Author: Melanie Plageman <
[email protected]>
Reviewed-by: Kyotaro Horiguchi <[email protected]>
Reported-by: Andres Freund <[email protected]>
Discussion: https://postgr.es/m/
20230419172326.dhgyo4wrrhulovt6%40awork3.anarazel.de
Andres Freund [Wed, 17 May 2023 18:17:12 +0000 (11:17 -0700)]
Update parameter name context to wb_context
For clarity of review, renaming the function parameter "context" in
ScheduleBufferTagForWriteback() and IssuePendingWritebacks() to
"wb_context" is a separate commit. The next commit adds an "io_context"
parameter and "wb_context" makes it more clear which is which.
Author: Melanie Plageman <
[email protected]>
Discussion: https://postgr.es/m/CAAKRu_acc6iL4M3hvOTeztf_ZPpsB3Pqio5aVHgZ5q=Pi3BZKg@mail.gmail.com
Andres Freund [Wed, 17 May 2023 18:17:02 +0000 (11:17 -0700)]
Use BUFFER_USAGE_LIMIT to reduce needed test table size
Using the minimum BUFFER_USAGE_LIMIT value, we can make one of the pg_stat_io
test tables smaller while still causing reuses.
Author: Melanie Plageman <
[email protected]>
Discussion: https://postgr.es/m/CAAKRu_acc6iL4M3hvOTeztf_ZPpsB3Pqio5aVHgZ5q=Pi3BZKg@mail.gmail.com
Alexander Korotkov [Wed, 17 May 2023 17:06:50 +0000 (20:06 +0300)]
Revert "Add USER SET parameter values for pg_db_role_setting"
This reverts commit
096dd80f3ccc and its fixups
beecbe8e5001,
afdd9f7f0e00,
529da086ba,
db93e739ac61.
Catversion is bumped.
Discussion: https://postgr.es/m/
d46f9265-ff3c-6743-2278-
6772598233c2%40pgmasters.net
Alvaro Herrera [Wed, 17 May 2023 17:13:08 +0000 (19:13 +0200)]
pg_dump: Error message improvements
Remove spurious semicolon from one error message, and print the
offending value of a parameter reported as invalid in another.
Alvaro Herrera [Wed, 17 May 2023 16:55:51 +0000 (18:55 +0200)]
pg_dump: Have _EndLO report errno after CFH->write_func() failure
Other callers of that function do things this way, but this one didn't
get the memo.
Tom Lane [Wed, 17 May 2023 15:46:15 +0000 (11:46 -0400)]
Track tlist_vinfo.varnullingrels even in non-Assert builds.
Oversight in commit
867be9c07 (which should get reverted
along with that, if we ever do revert it). Per buildfarm.
Tom Lane [Wed, 17 May 2023 15:13:52 +0000 (11:13 -0400)]
Fix some issues with improper placement of outer join clauses.
After applying outer-join identity 3 in the forward direction,
it was possible for the planner to mistakenly apply a qual clause
from above the two outer joins at the now-lower join level.
This can give the wrong answer, since a value that would get nulled
by the now-upper join might not yet be null.
To fix, when we perform such a transformation, consider that the
now-lower join hasn't really completed the outer join it's nominally
responsible for and thus its relid set should not include that OJ's
relid (nor should its output Vars have that nullingrel bit set).
Instead we add those bits when the now-upper join is performed.
The existing rules for qual placement then suffice to prevent
higher qual clauses from dropping below the now-upper join.
There are a few complications from needing to consider transitive
closures in case multiple pushdowns have happened, but all in all
it's not a very complex patch.
This is all new logic (from
2489d76c4) so no need to back-patch.
The added test cases all have the same results as in v15.
Tom Lane and Richard Guo
Discussion: https://postgr.es/m/
0b819232-4b50-f245-1c7d-
c8c61bf41827@postgrespro.ru
Tom Lane [Wed, 17 May 2023 14:50:35 +0000 (10:50 -0400)]
Convert nullingrels match checks from Asserts to test-and-elog.
It seems like the code that these checks are backstopping may have
a few bugs left in it. Use a test-and-elog so that the tests are
performed even in non-assert builds, and so that we get something
more informative than "server closed the connection" on failure.
Committed separately with the idea that eventually we'll revert
this. It might be awhile though.
Discussion: https://postgr.es/m/
3014965.
1684293045@sss.pgh.pa.us
Tomas Vondra [Wed, 17 May 2023 14:49:31 +0000 (16:49 +0200)]
Advance input pointer when LZ4 compressing data
LZ4File_write() did not advance the input pointer on subsequent invocations of
LZ4F_compressUpdate(). As a result the generated compressed output would be a
compressed version of the same input chunk.
Tests failed to catch this error because the data would comfortably fit
within the default buffer size, as a single chunk. Tests have been added
to provide adequate coverage of multi-chunk compression.
WriteDataToArchiveLZ4() which is also using LZ4F_compressUpdate() did
not suffer from this omission.
Author: Georgios Kokolatos <
[email protected]>
Reported-by: Michael Paquier <[email protected]>
Discussion: https://postgr.es/m/ZFhCyn4Gm2eu60rB%40paquier.xyz
Tomas Vondra [Wed, 17 May 2023 14:35:17 +0000 (16:35 +0200)]
Null-terminate the output buffer of LZ4Stream_gets
LZ4Stream_gets did not null-terminate its output buffer. The callers expected
the buffer to be null-terminated and passed it around to functions such as
sscanf with unintended consequences.
Author: Georgios Kokolatos <
[email protected]>
Reported-by: Alexander Lakhin <[email protected]>
Discussion: https://postgr.es/m/
94ae9bca-5ebb-1e68-bb7b-
4f32e89fefbe@gmail.com
Michael Paquier [Wed, 17 May 2023 01:19:17 +0000 (10:19 +0900)]
Add back SQLValueFunction for SQL keywords
This is equivalent to a revert of
f193883 and
fb32748, with the addition
that the declaration of the SQLValueFunction node needs to gain a couple
of node_attr for query jumbling. The performance impact of removing the
function call inlining is proving to be too huge for some workloads
where these are used. A worst-case test case of involving only simple
SELECT queries with a SQL keyword is proving to lead to a reduction of
10% in TPS via pgbench and prepared queries on a high-end machine.
None of the tests I ran back for this set of changes saw such a huge
gap, but Alexander Lakhin and Andres Freund have found that this can be
noticeable. Keeping the older performance would mean to do more
inlining in the executor when using COERCE_SQL_SYNTAX for a function
expression, similarly to what SQLValueFunction does. This requires more
redesign work and there is little time until 16beta1 is released, so for
now reverting the change is the best way forward, bringing back the
previous performance.
Bump catalog version.
Reported-by: Alexander Lakhin
Discussion: https://postgr.es/m/
b32bed1b-0746-9b20-1472-
4bdc9ca66d52@gmail.com
Tom Lane [Tue, 16 May 2023 14:53:42 +0000 (10:53 -0400)]
Ensure Soundex difference() function handles empty input sanely.
fuzzystrmatch's difference() function assumes that _soundex()
always initializes its output buffer fully. This was not so for
the case of a string containing no alphabetic characters, resulting
in unstable output and Valgrind complaints.
Fix by using memset() to fill the whole buffer in the early-exit
case. Also make some cosmetic improvements (I didn't care for the
random switches between "instr[0]" and "*instr" notation).
Report and diagnosis by Alexander Lakhin (bug #17935).
Back-patch to all supported branches.
Discussion: https://postgr.es/m/17935-
b99316aa79c18513@postgresql.org
Alvaro Herrera [Tue, 16 May 2023 09:50:08 +0000 (11:50 +0200)]
libpq: Error message improvement
Move a variable name out of the translatable message, to make it
identical to others.
Alvaro Herrera [Tue, 16 May 2023 09:47:25 +0000 (11:47 +0200)]
Mark internal messages as no longer translatable
The problem that these messages protect against can only occur because
a corrupted hash spill file was written, i.e., a Postgres bug. There's
no reason to have them as translatable.
Backpatch to 15, where these messages were changed by commit
c4649cce39a4.
Reviewed-by: Daniel Gustafsson <[email protected]>
Discussion: https://postgr.es/m/
20230510175407[email protected]
Daniel Gustafsson [Tue, 16 May 2023 08:49:48 +0000 (10:49 +0200)]
Fix reported runtime for single tests in pg_regress
Commit
558fff0adf got the order of the parameters to test_status_failed
mixed up which resulted in the runtime being reported as 0 ms. Fix by
changing the order to the correct one. No backpatching is needed since
this has not been shipped in a release yet.
Discussion: https://postgr.es/m/
0134C9EC-5F6B-4EAC-B2D5-
BB4249BEBD4D@yesql.se
Michael Paquier [Tue, 16 May 2023 07:51:44 +0000 (16:51 +0900)]
doc: Fix ordering of entries in wait event table for I/O type
Issue spotted while reviewing a different patch touching this area.
Discussion: https://postgr.es/m/
[email protected]
Peter Eisentraut [Tue, 16 May 2023 06:59:34 +0000 (08:59 +0200)]
libpq: Error message improvement
Peter Eisentraut [Tue, 16 May 2023 04:13:59 +0000 (06:13 +0200)]
psql: Adjust capitalization of table heading
for consistency with surrounding headings
Michael Paquier [Mon, 15 May 2023 07:02:07 +0000 (16:02 +0900)]
doc: Fix incorrect version list for Windows SDK
References to SDK 8.1a should have been cleaned up in
495ed0e, as only
version 10 and above are supported with Windows 10 and newer versions.
Reported-by: Thomas Munro
Discussion: https://postgr.es/m/CA+hUKG++qE9uVjQaTTD7oaC8a2T3h8K50=Eqyx9uUZvOHa__ww@mail.gmail.com
Peter Eisentraut [Mon, 15 May 2023 05:07:09 +0000 (07:07 +0200)]
Fix incorrect TAP test ordering
Using a test function before a possible skip_all is incorrect. If the
skip_all is called, the test output will become incorrect and the test
file will fail.
a4f23f9b3c introduced a new test before skip_all. After discussion,
this doesn't really need to be a test. Instead, we just bail out if
the condition is not satisfied.
Discussion: https://www.postgresql.org/message-id/
af5567a1-aea6-fbdb-7e4b-
d1e23a43c43b@enterprisedb.com
Peter Eisentraut [Mon, 15 May 2023 04:27:40 +0000 (06:27 +0200)]
Fix whitespace inconsistencies
Thomas Munro [Sun, 14 May 2023 22:45:19 +0000 (10:45 +1200)]
Fix wal_writer_flush_after initializer value.
Commit
a73952b7956 (new in 16) required default values in guc_table.c
and C variable initializers to match. This one only matched when
XLOG_BLCKSZ == 8kB. Fix by using the same expression in both places
with a new DEFAULT_XXX macro, as done for other GUCs.
Reviewed-by: Andres Freund <[email protected]>
Discussion: https://postgr.es/m/CA+hUKGLNmLV=VrT==5MqnbARgx2ifRSFtdd8ofdfrdSLL3yv5A@mail.gmail.com
Thomas Munro [Sun, 14 May 2023 22:31:14 +0000 (10:31 +1200)]
Rename io_direct to debug_io_direct.
Give the new GUC introduced by
d4e71df6 a name that is clearly not
intended for mainstream use quite yet.
Future proposals would drop the prefix only after adding infrastructure
to make it efficient. Having the switch in the tree sooner is good
because it might lead to new discoveries about the hazards awaiting us
on a wide range of systems, but that name was too enticing and could
lead to cross-version confusion in future, per complaints from Noah and
Justin.
Suggested-by: Noah Misch <[email protected]>
Reviewed-by: Noah Misch <[email protected]>
Reviewed-by: Justin Pryzby <[email protected]> (the idea, not the patch)
Reviewed-by: Tom Lane <[email protected]> (ditto)
Discussion: https://postgr.es/m/
20230430041106.GA2268796%40rfd.leadboat.com
Nathan Bossart [Fri, 12 May 2023 20:50:46 +0000 (13:50 -0700)]
Improve error message for pg_create_subscription.
c3afe8cf5a updated this error message, but it didn't use the new
style established in
de4d456b40.
Reviewed-by: Tom Lane
Discussion: https://postgr.es/m/
20230512203721.GA2644063%40nathanxps13.home
Tom Lane [Fri, 12 May 2023 20:11:14 +0000 (16:11 -0400)]
Tighten usage of PSQL_WATCH_PAGER.
Don't use PSQL_WATCH_PAGER when stdin/stdout are not a terminal.
This corresponds to the restrictions on when other commands will
use [PSQL_]PAGER. There isn't a lot of sense in trying to use a
pager in non-interactive cases, and doing so allows an environment
setting to break our tests.
Also, ignore PSQL_WATCH_PAGER if it is set but empty or all-blank,
for the same reasons we ignore such settings of [PSQL_]PAGER (see
commit
18f8f784c).
No documentation change is really needed, since there is nothing
suggesting that these constraints on [PSQL_]PAGER didn't already
apply to PSQL_WATCH_PAGER too. But I rearranged the text
a little to make it read more naturally (IMHO anyway).
Per report from Pavel Stehule. Back-patch to v15 where
PSQL_WATCH_PAGER was introduced.
Discussion: https://postgr.es/m/CAFj8pRDTwFzmEWdA-gdAcUh0ZnxUioSfTMre71WyB_wNJy-8gw@mail.gmail.com
Peter Eisentraut [Fri, 12 May 2023 07:45:50 +0000 (09:45 +0200)]
initdb: Set collversion for standard collation UNICODE
Since the behavior of the UNICODE collation can change with new
ICU/Unicode versions, we need to apply the versioning mechanism to it.
We do this with an UPDATE command in initdb; this is similar to how we
put the collation version into pg_database already.
Reported-by: Daniel Verite <[email protected]>
Discussion: https://www.postgresql.org/message-id/
49417853-7bdd-4b23-a4e9-
04c7aff33821@manitou-mail.org
Tom Lane [Thu, 11 May 2023 17:44:25 +0000 (13:44 -0400)]
Undo faulty attempt at not relying on RINFO_IS_PUSHED_DOWN.
I've had a bee in my bonnet for some time about getting rid of
RestrictInfo.is_pushed_down, because it's squishily defined and
requires not-inexpensive extra tests to use (cf RINFO_IS_PUSHED_DOWN).
In commit
2489d76c4, I tried to make remove_rel_from_query() not
depend on that macro; but the replacement test is buggy,
as exposed by a report from Rushabh Lathia and Robert Haas.
That change was pretty incidental to the main goal of
2489d76c4,
so let's just revert it for now. (Getting rid of is_pushed_down
is still far away, anyway.)
Discussion: https://postgr.es/m/CA+TgmoYco=hmg+iX1CW9Y1_CzNoSL81J03wUG-d2_3=rue+L2A@mail.gmail.com
Peter Geoghegan [Wed, 10 May 2023 17:49:50 +0000 (10:49 -0700)]
Doc: Fix link to fillfactor reloption.
Fix a link from the "Heap-Only Tuples" documentation section.
Previously, its "fillfactor" link pointed to the "CREATE TABLE"
command's documentation. Now the link directly points to the fillfactor
storage parameter documentation (which is about half way into the
"CREATE TABLE" sect1).
Oversight in commit
115464bb.
Backpatch: 12-, the first version with a usable reloption link.
Alvaro Herrera [Wed, 10 May 2023 16:26:10 +0000 (18:26 +0200)]
Fix publication syntax error message
There was some odd wording in corner-case gram.y error messages "some
error ... at or near", which appears to have been modeled after "syntax
error" messages. However, they don't work that way, and they're just
wrong. They're also uncovered by tests. Remove the trailing words,
and also add tests.
They were introduced with
5a2832465fd8; backpatch to 15.
Author: Álvaro Herrera <
[email protected]>
Peter Eisentraut [Wed, 10 May 2023 11:51:51 +0000 (13:51 +0200)]
Add missing gettext triggers
due to the changes in commit
dac048f71e
Michael Paquier [Wed, 10 May 2023 02:24:30 +0000 (11:24 +0900)]
Fix assertion failure when updating stats_fetch_consistency in a transaction
An update of the GUC stats_fetch_consistency in a transaction would be
able to trigger an assertion when doing cache->snapshot. In this case,
when retrieving a pgstat entry after the switch, a new snapshot would be
rebuilt, confusing pgstat_build_snapshot() because a snapshot is already
cached with an unexpected mode ("cache").
In order to fix this problem, this commit adds a flag to force a
snapshot clear each time this GUC is changed. Some tests are added to
check, while on it.
Some optimizations in avoiding the snapshot clear should be possible
depending on what is cached and the current GUC value, I guess, but this
solution is simple, and ensures that the state of the cache is updated
each time a new pgstat entry is fetched, hence being consistent with the
level wanted by the client that has set the GUC.
Note that cache->none and snapshot->none would not cause issues, as
fetching a pgstat entry would be retrieved from shared memory on the
second attempt, however a snapshot would still be cached. Similarly,
none->snapshot and none->cache would build a new snapshot on the second
fetch attempt. Finally, snapshot->cache would cache a new snapshot on
the second attempt.
Reported-by: Alexander Lakhin
Author: Kyotaro Horiguchi
Discussion: https://postgr.es/m/17804-
2a118cd046f2d0e5@postgresql.org
backpatch-through: 15
Michael Paquier [Wed, 10 May 2023 01:19:57 +0000 (10:19 +0900)]
Document values of stats_fetch_consistency in postgresql.conf.sample
Issue noted while looking at a patch related to that.
Discussion: https://postgr.es/m/ZE9LiFc7JdNHokz/@paquier.xyz
Amit Kapila [Tue, 9 May 2023 08:55:33 +0000 (14:25 +0530)]
Fix the race condition in the test case added by commit
a6e04b1d20.
The commit
a6e04b1d20 added a test to ensure that the invalidated logical
slots don't retain WAL. The test was ensuring that the checkpoint removes
the WAL files corresponding to invalidated logical slots on the standby
node but missed the point that the standby node also had a physical slot
which led to the prevention of WAL file removal. Move the creation of
physical slot on the standby and initialization of cascading standby closer
to the test case that actually required it so that other tests don't get
affected by the presence of the physical slot on standby.
Author: Bertrand Drouvot
Reviewed-by: Amit Kapila
Discussion: https://postgr.es/m/
2fefa454-5a70-2174-ddbf-
4a0e41537139@gmail.com
Amit Kapila [Tue, 9 May 2023 03:58:06 +0000 (09:28 +0530)]
Fix invalid memory access during the shutdown of the parallel apply worker.
The callback function pa_shutdown() accesses MyLogicalRepWorker which may
not be initialized if there is an error during the initialization of the
parallel apply worker. The other problem is that by the time it is invoked
even after the initialization of the worker, the MyLogicalRepWorker will
be reset by another callback logicalrep_worker_onexit. So, it won't have
the required information.
To fix this, register the shutdown callback after we are attached to the
worker slot.
After this fix, we observed another issue which is that sometimes the
leader apply worker tries to receive the message from the error queue that
might already be detached by the parallel apply worker leading to an
error. To prevent such an error, we ensure that the leader apply worker
detaches from the parallel apply worker's error queue before stopping it.
Reported-by: Sawada Masahiko
Author: Hou Zhijie
Reviewed-by: Sawada Masahiko, Amit Kapila
Discussion: https://postgr.es/m/CAD21AoDo+yUwNq6nTrvE2h9bB2vZfcag=jxWc7QxuWCmkDAqcA@mail.gmail.com
Jeff Davis [Tue, 9 May 2023 03:50:51 +0000 (20:50 -0700)]
Revert "ICU: do not convert locale 'C' to 'en-US-u-va-posix'."
This reverts commit
f7faa9976cc0504c027a20ed66ceca9018041dd4.
Discussion: https://postgr.es/m/483826.
1683582475@sss.pgh.pa.us
Peter Geoghegan [Mon, 8 May 2023 20:17:31 +0000 (13:17 -0700)]
Doc: update VACUUM FREEZE query conflict guidance.
Commit
1de58df4, which added page-level freezing, taught VACUUM to reuse
each page's "set-visibility-map" snapshotConflictHorizon for freezing
(at least in the vast majority of cases where freezing went ahead).
This made VACUUM FREEZE much less prone to generating recovery conflicts
on standbys; VACUUM FREEZE became only slightly more likely to cause
recovery conflicts than an equivalent VACUUM.
Update old documentation that specifically warned of the likelihood of
recovery conflicts from VACUUM FREEZE. Explain the same general issue
(the issue of VACUUM generating recovery conflicts even in the absence
of dead row cleanup) using the example of conflicts caused by VISIBLE
WAL records.
Jeff Davis [Mon, 8 May 2023 17:34:51 +0000 (10:34 -0700)]
ICU: do not convert locale 'C' to 'en-US-u-va-posix'.
The conversion was intended to be for convenience, but it's more
likely to be confusing than useful.
The user can still directly specify 'en-US-u-va-posix' if desired.
Discussion: https://postgr.es/m/
f83f089ee1e9acd5dbbbf3353294d24e1f196e95[email protected]
Discussion: https://postgr.es/m/
37520ec1ae9591f83132f82dbd625f3fc2d69c16[email protected]
Tom Lane [Mon, 8 May 2023 15:24:47 +0000 (11:24 -0400)]
Adjust sepgsql expected output for
681d9e462 et al.
Security: CVE-2023-2454
Tom Lane [Mon, 8 May 2023 14:12:44 +0000 (10:12 -0400)]
Handle RLS dependencies in inlined set-returning functions properly.
If an SRF in the FROM clause references a table having row-level
security policies, and we inline that SRF into the calling query,
we neglected to mark the plan as potentially dependent on which
role is executing it. This could lead to later executions in the
same session returning or hiding rows that should have been hidden
or returned instead.
Our thanks to Wolfgang Walther for reporting this problem.
Stephen Frost and Tom Lane
Security: CVE-2023-2455
Noah Misch [Mon, 8 May 2023 13:14:07 +0000 (06:14 -0700)]
Replace last PushOverrideSearchPath() call with set_config_option().
The two methods don't cooperate, so set_config_option("search_path",
...) has been ineffective under non-empty overrideStack. This defect
enabled an attacker having database-level CREATE privilege to execute
arbitrary code as the bootstrap superuser. While that particular attack
requires v13+ for the trusted extension attribute, other attacks are
feasible in all supported versions.
Standardize on the combination of NewGUCNestLevel() and
set_config_option("search_path", ...). It is newer than
PushOverrideSearchPath(), more-prevalent, and has no known
disadvantages. The "override" mechanism remains for now, for
compatibility with out-of-tree code. Users should update such code,
which likely suffers from the same sort of vulnerability closed here.
Back-patch to v11 (all supported versions).
Alexander Lakhin. Reported by Alexander Lakhin.
Security: CVE-2023-2454
Peter Eisentraut [Mon, 8 May 2023 06:24:42 +0000 (08:24 +0200)]
Add missing source file to nls.mk
Peter Eisentraut [Mon, 8 May 2023 05:43:54 +0000 (07:43 +0200)]
pg_dump: Restore lost translation marker
The refactoring in
03d02f54a6 lost a translation marker.
Michael Paquier [Mon, 8 May 2023 04:47:36 +0000 (13:47 +0900)]
doc: Fix some markups in logical replication section
Author: Peter Smith
Reviewed-by: David Zhang
Discussion: https://postgr.es/m/CAHut+Pst11ac2hcmePt1=oTmBwTT=DAssRR1nsdoy4BT+68=Mg@mail.gmail.com
Peter Eisentraut [Mon, 8 May 2023 04:15:26 +0000 (06:15 +0200)]
pg_basebackup: Restore lost translation markers
The refactoring in
ebfb814f7c lost some translation markers.
Tom Lane [Sun, 7 May 2023 15:01:15 +0000 (11:01 -0400)]
Add ruleutils support for decompiling MERGE commands.
This was overlooked when MERGE was added, but it's essential
support for MERGE in new-style SQL functions.
Alvaro Herrera
Discussion: https://postgr.es/m/
3579737.
1683293801@sss.pgh.pa.us
Michael Paquier [Fri, 5 May 2023 12:25:44 +0000 (21:25 +0900)]
Fix typo with wait event for SLRU buffer of commit timestamps
This wait event was documented as "CommitTsBuffer" since its
introduction, but the code named it "CommitTSBuffer". This commit fixes
the code to follow the term documented, which is also more consistent
with the naming of the other wait events used for commit timestamps.
Introduced by
5da1493.
Author: Alexander Lakhin
Discussion: https://postgr.es/m/
e8c38840-596a-83d6-bd8d-
cebc51111572@gmail.com
Backpatch-through: 13
Alvaro Herrera [Fri, 5 May 2023 09:10:25 +0000 (11:10 +0200)]
Fix sepgsql expected test output
Commit
f75cec4fff87 changed the order in which the relations are
permission-checked in RI_Initial_Check, which the sepgsql test is
sensitive to. Adapt.
Discussion: https://postgr.es/m/
3468125.
1683238309@sss.pgh.pa.us
Peter Eisentraut [Fri, 5 May 2023 05:50:08 +0000 (07:50 +0200)]
Fix copy-and-pasto in error message
from
2fe3bdbd69
Peter Eisentraut [Fri, 5 May 2023 04:29:49 +0000 (06:29 +0200)]
Fix prove_installcheck when used with PGXS
Commit
153e215677 added the portlock directory. This is created in
$ENV{top_builddir} if it is set. Under PGXS, top_builddir points into
the installation directory, which is not necessarily writable and in
any case inappropriate to use by a test suite. The cause of the
problem is that the prove_installcheck target in Makefile.global
exports top_builddir, which isn't useful (since no other Perl code
actually reads it) and breaks this use case. The reason this code is
there is probably that is has been dragged around with various other
changes, in particular
a0fc813266, but without a real purpose of its
own. By just removing the exporting of top_builddir in
prove_installcheck, the portlock directory then ends up under
tmp_check in the build directory, which is more suitable.
Reviewed-by: Andrew Dunstan <[email protected]>
Discussion: https://www.postgresql.org/message-id/
78d1cfa6-0065-865d-584b-
cde6d8c18aff@enterprisedb.com
Nathan Bossart [Wed, 3 May 2023 18:32:43 +0000 (11:32 -0700)]
Move return statements out of PG_TRY blocks.
If we exit a PG_TRY block early via "continue", "break", "goto", or
"return", we'll skip unwinding its exception stack. This change
moves a couple of such "return" statements in PL/Python out of
PG_TRY blocks. This was introduced in
d0aa965c0a and affects all
supported versions.
We might also be able to add compile-time checks to prevent
recurrence, but that is left as a future exercise.
Reported-by: Mikhail Gribkov, Xing Guo
Author: Xing Guo
Reviewed-by: Michael Paquier, Andres Freund, Tom Lane
Discussion: https://postgr.es/m/CAMEv5_v5Y%2B-D%3DCO1%2Bqoe16sAmgC4sbbQjz%2BUtcHmB6zcgS%2B5Ew%40mail.gmail.com
Discussion: https://postgr.es/m/CACpMh%2BCMsGMRKFzFMm3bYTzQmMU5nfEEoEDU2apJcc4hid36AQ%40mail.gmail.com
Backpatch-through: 11 (all supported versions)
Alvaro Herrera [Thu, 4 May 2023 17:55:56 +0000 (19:55 +0200)]
Fix ExecCheckPermissions call in RI_Initial_Check
RI_Initial_Check was setting up a list of RTEPermissionInfo for
ExecCheckPermissions() wrong, and the problem is subtle enough that it
doesn't have any immediate effect in core code. However, if an
extension is using the ExecutorCheckPerms_hook, then it would get the
wrong parameters and perhaps arrive at a wrong conclusion, or outright
malfunction. Fix by constructing that list and the RTE list more
honestly.
We also add an assertion check to verify that these lists match. This
new assertion would have caught this bug.
Co-authored-by: Олег Целебровский (Oleg Tselebrovskii) <[email protected]>
Co-authored-by: Álvaro Herrera <[email protected]>
Reviewed-by: Amit Langote <[email protected]>
Discussion: https://postgr.es/m/
3722b7a2cbe27a1796ee40824bd86dd1@postgrespro.ru
Tom Lane [Thu, 4 May 2023 15:48:23 +0000 (11:48 -0400)]
In array_position()/array_positions(), beware of empty input array.
These functions incautiously fetched the array's first lower bound
even when the array is zero-dimensional, thus fetching the word
after the allocated array space. While almost always harmless,
with very bad luck this could result in SIGSEGV. Fix by adding
an early exit for empty input.
Per bug #17920 from Alexander Lakhin.
Discussion: https://postgr.es/m/17920-
f7c228c627b6d02e%40postgresql.org
Tom Lane [Thu, 4 May 2023 15:00:33 +0000 (11:00 -0400)]
Tighten array dimensionality checks in Python -> SQL array conversion.
Like plperl before
f47004add, plpython wasn't being sufficiently
careful about checking that list-of-list structures represent
rectangular arrays, so that it would accept some cases in which
different parts of the "array" are nested to different depths.
This was exacerbated by Python's weak distinction between
sequences and lists, so that in some cases strings could get
treated as though they are lists (and burst into individual
characters) even though a different ordering of the upper-level
list would give a different result.
Some of this behavior was unreachable (without risking a crash)
before
81eaaf65e. It seems like a good idea to clean it all up
in the same releases, rather than shipping a non-crashing but
nonetheless visibly buggy behavior in the name of minimal change.
Hence, back-patch.
Per bug #17912 and further testing by Alexander Lakhin.
Discussion: https://postgr.es/m/17912-
82ceed78731d9cdc@postgresql.org
Alvaro Herrera [Thu, 4 May 2023 10:09:59 +0000 (12:09 +0200)]
Revert "Move PartitionPruneInfo out of plan nodes into PlannedStmt"
This reverts commit
ec386948948c and its fixup
589bb816499e.
This change was intended to support query planning avoiding acquisition
of locks on partitions that were going to be pruned; however, the
overall project took a different direction at [1] and this bit is no
longer needed. Put things back the way they were as agreed in [2], to
avoid unnecessary complexity.
Discussion: [1] https://postgr.es/m/
4191508.
1674157166@sss.pgh.pa.us
Discussion: [2] https://postgr.es/m/
20230502175409[email protected]
Peter Eisentraut [Thu, 4 May 2023 04:44:38 +0000 (06:44 +0200)]
doc: New glossary entries
Add:
- "Restartpoint"
- "Log sequence number"
"LSN" was already listed in the Acronyms appendix, but it is more
suitable as a glossary entry, so move it there and have the acronyms
entry link into the glossary.
Also turn on DocBook parameter glossentry.show.acronym to show
acronyms for glossary entries, which is being used here.
Reviewed-by: Daniel Gustafsson <[email protected]>
Reviewed-by: Alvaro Herrera <[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/
60915312-62cd-9c94-0d94-
556023ece45f%40enterprisedb.com
Amit Kapila [Thu, 4 May 2023 03:03:56 +0000 (08:33 +0530)]
Test that invalidated logical slots doesn't retain WAL.
Author: Bertrand Drouvot
Reviewed-by: Shi yu, Amit Kapila, Vignesh C
Discussion: https://postgr.es/m/
2fefa454-5a70-2174-ddbf-
4a0e41537139@gmail.com
Peter Eisentraut [Wed, 3 May 2023 09:08:24 +0000 (11:08 +0200)]
Add missing TAP test name
Amit Kapila [Wed, 3 May 2023 04:43:13 +0000 (10:13 +0530)]
Fix assertion failure in apply worker.
During exit, the logical replication apply worker tries to release session
level locks, if any. However, if the apply worker exits due to an error
before its connection is initialized, trying to release locks can lead to
assertion failure. The locks will be acquired once the worker is
initialized, so we don't need to release them till the worker
initialization is complete.
Reported-by: Alexander Lakhin
Author: Hou Zhijie based on inputs from Sawada Masahiko and Amit Kapila
Reviewed-by: Amit Kapila
Discussion: https://postgr.es/m/
2185d65f-5aae-3efa-c48f-
fb42b173ef5c@gmail.com
Tom Lane [Tue, 2 May 2023 21:55:01 +0000 (17:55 -0400)]
Doc: clarify behavior of row-limit arguments in the PLs' SPI wrappers.
plperl, plpython, and pltcl all provide query-execution functions
that are thin wrappers around SPI_execute() or its variants.
The SPI functions document their row-count limit arguments clearly,
as "maximum number of rows to return, or 0 for no limit". However
the PLs' documentation failed to explain this special behavior of
zero, so that a reader might well assume it means "fetch zero
rows". Improve that.
Daniel Gustafsson and Tom Lane, per report from Kieran McCusker
Discussion: https://postgr.es/m/CAGgUQ6H6qYScctOhktQ9HLFDDoafBKHyUgJbZ6q_dOApnzNTXg@mail.gmail.com
Daniel Gustafsson [Tue, 2 May 2023 11:15:29 +0000 (13:15 +0200)]
Fix overridden callbacks in pg_rewind.
The <source>_traverse_files functions take a callback for processing
files, but both the local and libpq source implementations called the
function directly without using the callback argument. While there is
no bug right now as the function called is the same as the callback,
fix by calling the callback to reduce the risk of subtle bugs in the
future.
Author: Junwang Zhao <
[email protected]>
Reviewed-by: Richard Guo <[email protected]>
Discussion: https://postgr.es/m/CAEG8a3Jdwgh+PZr2zh1=t8apA4Yz8tKq+uubPqoCt14nvWKHEw@mail.gmail.com
Peter Eisentraut [Tue, 2 May 2023 08:59:21 +0000 (10:59 +0200)]
Update SQL features
Some updates for SQL:2023 and some new features in PostgreSQL 16.
Peter Eisentraut [Tue, 2 May 2023 07:41:03 +0000 (09:41 +0200)]
Add missing uninstallation rule for BackgroundPsql.pm
Commit
a4c17c8617 added in the install rule but not the uninstall
rule.
Michael Paquier [Tue, 2 May 2023 03:23:08 +0000 (12:23 +0900)]
Fix typos in comments
The changes done in this commit impact comments with no direct
user-visible changes, with fixes for incorrect function, variable or
structure names.
Author: Alexander Lakhin
Discussion: https://postgr.es/m/
e8c38840-596a-83d6-bd8d-
cebc51111572@gmail.com
Michael Paquier [Tue, 2 May 2023 02:40:46 +0000 (11:40 +0900)]
doc: Fix typo in pg_amcheck for term "schema"
Author: Alexander Lakhin
Discussion: https://postgr.es/m/
e8c38840-596a-83d6-bd8d-
cebc51111572@gmail.com
Backpatch-through: 14
Tom Lane [Sat, 29 Apr 2023 17:06:44 +0000 (13:06 -0400)]
Tighten array dimensionality checks in Perl -> SQL array conversion.
plperl_array_to_datum() wasn't sufficiently careful about checking
that nested lists represent a rectangular array structure; it would
accept inputs such as "[1, []]". This is a bit related to the
PL/Python bug fixed in commit
81eaaf65e, but it doesn't seem to
provide any direct route to a memory stomp. Instead the likely
failure mode is for makeMdArrayResult to be passed fewer Datums than
the claimed array dimensionality requires, possibly leading to a wild
pointer dereference and SIGSEGV.
Per report from Alexander Lakhin. It's been broken for a long
time, so back-patch to all supported branches.
Discussion: https://postgr.es/m/
5ebae5e4-d401-fadf-8585-
ac3eaf53219c@gmail.com
Tom Lane [Fri, 28 Apr 2023 16:24:29 +0000 (12:24 -0400)]
Handle zero-length sublist correctly in Python -> SQL array conversion.
If PLySequence_ToArray came across a zero-length sublist, it'd compute
the overall array size as zero, possibly leading to a memory clobber.
(This would likely qualify as a security bug, were it not that plpython
is an untrusted language already.)
I think there are other corner-case issues in this code as well, notably
that the error messages don't match the core code and for some ranges
of array sizes you'd get "invalid memory alloc request size" rather than
the intended message about array size.
Really this code has no business doing its own array size calculation
at all, so remove the faulty code in favor of using ArrayGetNItems().
Per bug #17912 from Alexander Lakhin. Bug seems to have come in with
commit
94aceed31, so back-patch to all supported branches.
Discussion: https://postgr.es/m/17912-
82ceed78731d9cdc@postgresql.org
Michael Paquier [Fri, 28 Apr 2023 10:29:12 +0000 (19:29 +0900)]
Fix crashes with CREATE SCHEMA AUTHORIZATION and schema elements
CREATE SCHEMA AUTHORIZATION with appended schema elements can lead to
crashes when comparing the schema name of the query with the schemas
used in the qualification of some clauses in the elements' queries.
The origin of the problem is that the transformation routine for the
elements listed in a CREATE SCHEMA query uses as new, expected, schema
name the one listed in CreateSchemaStmt itself. However, depending on
the query, CreateSchemaStmt.schemaname may be NULL, being computed
instead from the role specification of the query given by the
AUTHORIZATION clause, that could be either:
- A user name string, with the new schema name being set to the same
value as the role given.
- Guessed from CURRENT_ROLE, SESSION_ROLE or CURRENT_ROLE, with a new
schema name computed from the security context where CREATE SCHEMA is
running.
Regression tests are added for CREATE SCHEMA with some appended elements
(some of them with schema qualifications), covering also some role
specification patterns.
While on it, this simplifies the context structure used during the
transformation of the elements listed in a CREATE SCHEMA query by
removing the fields for the role specification and the role type. They
were not used, and for the role specification this could be confusing as
the schema name may by extracted from that at the beginning of
CreateSchemaCommand().
This issue exists for a long time, so backpatch down to all the versions
supported.
Reported-by: Song Hongyu
Author: Michael Paquier
Reviewed-by: Richard Guo
Discussion: https://postgr.es/m/17909-
f65c12dfc5f0451d@postgresql.org
Backpatch-through: 11
Daniel Gustafsson [Fri, 28 Apr 2023 08:30:05 +0000 (10:30 +0200)]
Fix assertion failure in heap_vacuum_rel
Commit
7d71d3dd08 changed resetting the VacuumFailsafeActive flag to an
assertion since the flag is reset before starting vacuuming a relation.
This however failed to take recursive calls of vacuum_rel() and vacuum
of TOAST tables into consideration. Fix by reverting back to resettting
the flag.
Author: Masahiko Sawada <
[email protected]>
Reviewed-by: Melanie Plageman <[email protected]>
Reported-by: John Naylor <[email protected]>
Discussion: https://postgr.es/m/CAFBsxsFz=GqaG5Ens5aNgVYoV2Y+pfMUijX0ku+CCkWfALwiqg@mail.gmail.com
Masahiko Sawada [Fri, 28 Apr 2023 06:40:12 +0000 (15:40 +0900)]
Add unit to vacuum_buffer_usage_limit value in postgresql.conf.sample.
Also adjust the indentation of the comment to the surrounding parameters.
Author: Masahiko Sawada
Reviewed-by: David Rowley, Daniel Gustafsson, Melanie Plageman
Discussion: https://postgr.es/m/CAD21AoCBSqmqOKVH4Q256DeCC_UE50gu1sgixcjLFZGLEbABVA@mail.gmail.com
Amit Kapila [Fri, 28 Apr 2023 03:15:19 +0000 (08:45 +0530)]
Improve one of the test cases in 035_standby_logical_decoding.pl.
The test to ensure that decoding changes via logical slot from another
database will fail was incorrectly done on the primary node instead of on
the standby node.
In the passing, make the test to wait for replay catchup by using
wait_for_replay_catchup(). This will make it consistent with the way we
wait at other places in the test.
Author: Shi yu
Reviewed-by: Bertrand Drouvot, Amit Kapila
Discussion: https://postgr.es/m/OSZPR01MB6310B0A507A0F2A2D379F38CFD6A9@OSZPR01MB6310.jpnprd01.prod.outlook.com
Nathan Bossart [Thu, 27 Apr 2023 20:43:48 +0000 (13:43 -0700)]
Prevent underflow in KeepLogSeg().
The call to XLogGetReplicationSlotMinimumLSN() might return a
greater LSN than the one given to the function. Subsequent segment
number calculations might then underflow, which could result in
unexpected behavior when removing or recyling WAL files. This was
introduced with max_slot_wal_keep_size in
c655077639. To fix, skip
the block of code for replication slots if the LSN is greater.
Reported-by: Xu Xingwang
Author: Kyotaro Horiguchi
Reviewed-by: Junwang Zhao
Discussion: https://postgr.es/m/17903-
4288d439dee856c6%40postgresql.org
Backpatch-through: 13
Alexander Korotkov [Thu, 27 Apr 2023 19:06:14 +0000 (22:06 +0300)]
Fix wrong construct_array_builtin() call in GUCArrayDelete()
The current code unintentionally uses the wrong datum to construct an array.
The bug was introduced by
096dd80f3c, so no backpatching is needed.
Reported-by: David Steele
Discussion: https://postgr.es/m/
d46f9265-ff3c-6743-2278-
6772598233c2%40pgmasters.net
Author: Nathan Bossart
Reviewed-by: David Steele, Tom Lane
Tom Lane [Thu, 27 Apr 2023 15:55:06 +0000 (11:55 -0400)]
In hstore_plpython, avoid crashing when return value isn't a mapping.
Python 3 changed the behavior of PyMapping_Check(), breaking the
test in plpython_to_hstore() that verifies whether a function result
to be transformed is acceptable. A backwards-compatible fix is to
first verify that the object doesn't pass PySequence_Check().
Perhaps accidentally, our other uses of PyMapping_Check() already
follow uses of PySequence_Check(), so that no other bugs were
created by this change.
Per bug #17908 from Alexander Lakhin. Back-patch to all supported
branches.
Dmitry Dolgov and Tom Lane
Discussion: https://postgr.es/m/17908-
3f19a125d56a11d6@postgresql.org
Amit Kapila [Thu, 27 Apr 2023 08:52:53 +0000 (14:22 +0530)]
Add a test to verify that subscription to the standby works.
Author: Bertrand Drouvot
Reviewed-by: Vignesh C, Alvaro Herrera, Amit Kapila
Discussion: https://postgr.es/m/
2fefa454-5a70-2174-ddbf-
4a0e41537139@gmail.com
Michael Paquier [Thu, 27 Apr 2023 04:34:05 +0000 (13:34 +0900)]
Rework code defining default compression for dir/custom formats in pg_dump
As written, pg_dump would call twice parse_compress_specification() for
the custom and directory formats to build a compression specification if
no compression option is defined, as these formats should be compressed
by default when compiled with zlib, or use no compression without zlib.
This made the code logic quite confusing, and the first compression
specification built would be incorrect before being overwritten by the
second one.
Rather than creating two compression specifications, this commit changes
a bit the order of the checks for the compression options so as
compression_algorithm_str is now set to a correct value for the custom
and format directory when no compression option is defined. This makes
the code easier to understand, as parse_compress_specification() is now
called once for all the format, with or without user-specified
compression methods. One comment was also confusing for the non-zlib
case, so remove it while on it.
This code has been introduced in
5e73a60 when adding support for
compression specifications in pg_dump.
Per discussion with Justin Pryzby and Georgios Kokolatos.
Discussion: https://postgr.es/m/
20230225050214[email protected]
Daniel Gustafsson [Wed, 26 Apr 2023 12:24:13 +0000 (14:24 +0200)]
Fix stop condition for dumping GRANT commands
Commit
ce6b672e44 changed dumping GRANT commands to ensure that
grantors already have an ADMIN OPTION on the role for which it
is granting permissions. Looping over the grants per role has a
stop condition on dumping the grant statements, but accidentally
missed updating the variable for the conditional check.
Author: Andreas Scherbaum <
[email protected]>
Co-authored-by: Artur Zakirov <[email protected]>
Discussion: https://postgr.es/m/
de44299d-cd31-b41f-2c2a-
161fa5e586a5@pgug.de
Etsuro Fujita [Wed, 26 Apr 2023 11:15:00 +0000 (20:15 +0900)]
doc: Fix grammar.
Daniel Gustafsson [Wed, 26 Apr 2023 09:40:01 +0000 (11:40 +0200)]
Fix missing installation rules for BackgroundPsql.pm
Commit
664d75753 added the BackgroundPsql module with helper functions
for tests running interactive or background psql tasks. The new module
was however not added to the install rules of the build systems.
Reported-by: Peter Eisentraut <[email protected]>
Discussion: https://postgr.es/m/
c0ba3008-dbc8-e53f-29f2-
2e9abe72b2a2@enterprisedb.com
Thomas Munro [Tue, 25 Apr 2023 22:39:46 +0000 (10:39 +1200)]
Remove bogus #include added by
d4e71df6d75.
The recently added inclusion of guc.h in smgr.h is not necessary and
introduces more server-related stuff. Removing the directive helps
avoid potential issues with including sgmr.h in frontends.
Author: Kyotaro Horiguchi <
[email protected]>
Discussion: https://postgr.es/m/
20230425.115748.
2130383825066921512.horikyota.ntt%40gmail.com
Michael Paquier [Tue, 25 Apr 2023 22:10:06 +0000 (07:10 +0900)]
Re-add tracking of wait event SLRUFlushSync
SLRUFlushSync has been accidently removed during
dee663f, that has moved
the flush of the SLRU files to the checkpointer, so add it back. The
issue has been noticed by Thomas when checking for orphaned wait
events.
Author: Thomas Munro
Reviewed-by: Bharath Rupireddy
Discussion: https://postgr.es/m/CA+hUKGK6tqm59KuF1z+h5Y8fsWcu5v8+84kduSHwRzwjB2aa_A@mail.gmail.com
Daniel Gustafsson [Tue, 25 Apr 2023 11:54:10 +0000 (13:54 +0200)]
Fix vacuum_cost_delay check for balance calculation.
Commit
1021bd6a89 excluded autovacuum workers from cost-limit balance
calculations when per-relation options were set. The code checks for
limit and cost_delay being greater than zero, but since cost_delay can
be set to -1 the test needs to check for greater than or zero.
Backpatch to all supported branches since
1021bd6a89 was backpatched
all the way at the time.
Author: Masahiko Sawada <
[email protected]>
Reviewed-by: Melanie Plageman <[email protected]>
Reviewed-by: Daniel Gustafsson <[email protected]>
Discussion: https://postgr.es/m/CAD21AoBS7o6Ljt_vfqPQPf67AhzKu3fR0iqk8B=vVYczMugKMQ@mail.gmail.com
Backpatch-through: v11 (all supported branches)
Amit Kapila [Tue, 25 Apr 2023 03:03:09 +0000 (08:33 +0530)]
Reduce the log level in 035_standby_logical_decoding.pl.
Reduce the log level in 035_standby_logical_decoding.pl as the test
doesn't require the higher log level. This helps to shrink the output size
and speed up the test a bit.
Author: Bertrand Drouvot
Discussion: https://postgr.es/m/
2fefa454-5a70-2174-ddbf-
4a0e41537139@gmail.com
Discussion: https://postgr.es/m/523315.
1681245505@sss.pgh.pa.us
Michael Paquier [Tue, 25 Apr 2023 00:42:19 +0000 (09:42 +0900)]
Fix buffer refcount leak with FDW bulk inserts
The leak would show up when using batch inserts with foreign tables
included in a partition tree, as the slots used in the batch were not
reset once processed. In order to fix this problem, some
ExecClearTuple() are added to clean up the slots used once a batch is
filled and processed, mapping with the number of slots currently in use
as tracked by the counter ri_NumSlots.
This buffer refcount leak has been introduced in
b676ac4 with the
addition of the executor facility to improve bulk inserts for FDWs, so
backpatch down to 14.
Alexander has provided the patch (slightly modified by me). The test
for postgres_fdw comes from me, based on the test case that the author
has sent in the report.
Author: Alexander Pyhalov
Discussion: https://postgr.es/m/
b035780a740efd38dc30790c76927255@postgrespro.ru
Backpatch-through: 14
Andres Freund [Mon, 24 Apr 2023 19:20:52 +0000 (12:20 -0700)]
Remove vacuum_defer_cleanup_age
vacuum_defer_cleanup_age was introduced before hot_standby_feedback and
replication slots existed. It is hard to use reasonably - commonly it will
either be set too low (not preventing recovery conflicts, while still causing
some bloat), or too high (causing a lot of bloat). The alternatives do not
have that issue.
That on its own might not be sufficient reason to remove
vacuum_defer_cleanup_age, but it also complicates computation of xid
horizons. See e.g. the bug fixed in
be504a3e974. It also is untested.
This commit removes TransactionIdRetreatSafely(), as there are no users
anymore. There might be potential future users, hence noting that here.
Reviewed-by: Daniel Gustafsson <[email protected]>
Reviewed-by: Justin Pryzby <[email protected]>
Reviewed-by: Alvaro Herrera <[email protected]>
Discussion: https://postgr.es/m/
20230317230930[email protected]
Tom Lane [Mon, 24 Apr 2023 18:19:46 +0000 (14:19 -0400)]
Fix memory leakage in plpgsql DO blocks that use cast expressions.
Commit
04fe805a1 modified plpgsql so that datatype casts make use of
expressions cached by plancache.c, in place of older code where these
expression trees were managed by plpgsql itself. However, I (tgl)
forgot that we use a separate, shorter-lived cast info hashtable in
DO blocks. The new mechanism thus resulted in session-lifespan
leakage of the plancache data once a DO block containing one or more
casts terminated. To fix, split the cast hash table into two parts,
one that tracks only the plancache's CachedExpressions and one that
tracks the expression state trees generated from them. DO blocks need
their own expression state trees and hence their own version of the
second hash table, but there's no reason they can't share the
CachedExpressions with regular plpgsql functions.
Per report from Ajit Awekar. Back-patch to v12 where the issue
was introduced.
Ajit Awekar and Tom Lane
Discussion: https://postgr.es/m/CAHv6PyrNaqdvyWUspzd3txYQguFTBSnhx+m6tS06TnM+KWc_LQ@mail.gmail.com
Tom Lane [Mon, 24 Apr 2023 17:01:33 +0000 (13:01 -0400)]
Rename ExecAggTransReparent, and improve its documentation.
The name of this function suggests that it ought to reparent R/W
expanded objects to be children of the persistent aggcontext, instead
of copying them. In fact it does no such thing, and if you try to
make it do so you will see multiple regression failures. Rename it
to the less-misleading ExecAggCopyTransValue, and add commentary
about why that attractive-sounding optimization won't work. Also
adjust comments at call sites, some of which were describing logic
that has since been moved into ExecAggCopyTransValue.
Discussion: https://postgr.es/m/
3004282.
1681930251@sss.pgh.pa.us
Peter Eisentraut [Mon, 24 Apr 2023 13:39:54 +0000 (15:39 +0200)]
doc: Update SQL features names
Some feature names have been adjusted over time upstream. This pulls
in those changes.
Daniel Gustafsson [Mon, 24 Apr 2023 09:40:23 +0000 (11:40 +0200)]
ci: Remove OpenSSL 3.1 workaround for missing system CA
Commit
0b5d1fb36 fixed the SSL test to properly handle the error message
from OpenSSL when the system CA pool is missing of invalid, so with that
we can remove the workaround in Cirrus for when Homebrew clears the cert
from OPENSSLDIR.
Author: Jacob Champion <
[email protected]>
Discussion: https://postgr.es/m/CAAWbhmj3JtKuRcHcMuf1eCJmoZxMXdzLaYpEGmzu9+kgRGpu3A@mail.gmail.com
Daniel Gustafsson [Mon, 24 Apr 2023 09:16:17 +0000 (11:16 +0200)]
Remove duplicate lines of code
Commit
6df7a9698bb accidentally included two identical prototypes for
default_multirange_selectivi() and commit
086cf1458c6 added a break;
statement where one was already present, thus duplicating it. While
there is no bug caused by this, fix by removing the duplicated lines
as they provide no value.
Backpatch the fix for duplicate prototypes to v14 and the duplicate
break statement fix to all supported branches to avoid backpatching
hazards due to the removal.
Reported-by: Anton Voloshin <[email protected]>
Discussion: https://postgr.es/m/
0e69cb60-0176-f6d0-7e15-
6478b7d85724@postgrespro.ru
Masahiko Sawada [Mon, 24 Apr 2023 06:37:14 +0000 (15:37 +0900)]
Use elog to report unexpected action in handle_streamed_transaction().
An oversight in commit
216a784829c.
Author: Masahiko Sawada
Reviewed-by: Kyotaro Horiguchi, Amit Kapila
Discussion: https://postgr.es/m/CAD21AoDDbM8_HJt-nMCvcjTK8K9hPzXWqJj7pyaUvR4mm_NrSg@mail.gmail.com
Amit Kapila [Mon, 24 Apr 2023 03:07:58 +0000 (08:37 +0530)]
Display 'password_required' option for \dRs+ command.
The commit
c3afe8cf5a added a new subscription option 'password_required'
which should be shown with \dRs+ command.
Author: Vignesh C
Reviewed-by: Amit Kapila, Robert Haas
Discussion: https://postgr.es/m/CAA4eK1LRz5sCZxwCW6OtpjLtWPvRwBihQOM4jzQm6ppfpexqGA@mail.gmail.com
Discussion: https://postgr.es/m/
9DFC88D3-1300-4DE8-ACBC-
4CEF84399A53@enterprisedb.com
Noah Misch [Mon, 24 Apr 2023 01:58:19 +0000 (18:58 -0700)]
Remove new <para id="contrib-obsolete">.
Just intagg is obsolete, and having a one-entry list gives undue weight.
Discussion: https://postgr.es/m/
20230409185050[email protected]
Alexander Korotkov [Sun, 23 Apr 2023 10:58:25 +0000 (13:58 +0300)]
Validate ltree siglen GiST option to be int-aligned
Unaligned siglen could lead to an unaligned access to subsequent key fields.
Backpatch to 13, where opclass options were introduced.
Reported-by: Alexander Lakhin
Bug: 17847
Discussion: https://postgr.es/m/17847-
171232970bea406b%40postgresql.org
Reviewed-by: Tom Lane, Pavel Borisov, Alexander Lakhin
Backpatch-through: 13
Alexander Korotkov [Sun, 23 Apr 2023 10:55:49 +0000 (13:55 +0300)]
Fix custom validators call in build_local_reloptions()
We need to call them only when validate == true.
Backpatch to 13, where opclass options were introduced.
Reported-by: Tom Lane
Discussion: https://postgr.es/m/
2656633.
1681831542%40sss.pgh.pa.us
Reviewed-by: Tom Lane, Pavel Borisov
Backpatch-through: 13
Tom Lane [Sat, 22 Apr 2023 15:52:46 +0000 (11:52 -0400)]
Doc: update pgindent/README some more.
In commit
2e6ba1315, I missed that there was a redundant
second reference to pg_bsd_indent's old repo.