David Rowley [Thu, 16 May 2024 00:50:16 +0000 (12:50 +1200)] Fix some inconsistencies in EXPLAIN output
06286709e added a SERIALIZE option to EXPLAIN which included showing the
amount of kilobytes serialized. The calculation to convert bytes into
kilobytes wasn't consistent with how that's done in the rest of EXPLAIN.
Traditionally we round up to the nearest kB, but the new code rounded to
the nearest kB.
To fix this, invent a macro that does the conversion and use that macro
everywhere that requires this conversion.
Additionally,
5de890e36 added EXPLAIN (MEMORY) but included the memory
sizes in bytes. Convert these values to kilobytes to align with the
other memory related outputs.
In passing, swap out a "long" type in show_hash_info() and use a uint64
instead. We do support platforms where sizeof(Size) == 8 and
sizeof(long) == 4, so using a long there is questionable.
Reported-by: jian heReviewed-by: jian heDiscussion: https://www.postgresql.org/message-id/CACJufxE4Sp7xvgOwhqtFx5hS85AxMKobPWDo-xZHZVTpK3EBjA@mail.gmail.com
Michael Paquier [Thu, 16 May 2024 00:15:01 +0000 (09:15 +0900)] doc: Mention more variant --name=value of -c name=value for postgres
postgres --name=value and -c name=value are equivalents. This commit
expands the documentation of libpq's "option" connection parameter and
the server startup sequence for shell interactions to mention both
rather than only -c.
Extracted from a larger by the same authors.
Reported-by: Alexey Palazhchenko
Author: David Johnston, Aleksander Alekseev
Reviewed-by: Nathan Bossart, Peter Eisentraut, Álvaro Herrera
Discussion: https://postgr.es/m/CAJ7c6TMkuLiLfrA+EFCPYfhXoMKRxxssB5c86+ibxfaz6+=Sdg@mail.gmail.com
Tom Lane [Wed, 15 May 2024 23:01:56 +0000 (19:01 -0400)] Doc: update src/tools/pgindent/README for current practice.
This README explains how to run pgindent, but it was written
for our former practice of running pgindent only infrequently.
Nowadays the plan is to keep the tree indent-clean all the time,
so the typical thing is to do an incremental pgindent run with
each commit. Revise to explain that as the normal case, and
the infrequent full-on process as a separate thing.
For now, pgperltidy is still a run-it-infrequently item.
Daniel Gustafsson [Wed, 15 May 2024 20:48:51 +0000 (22:48 +0200)] Fix query result during binary upgrade
9a974cbcba00 moved the query in binary_upgrade_set_pg_class_oids to the
outer level, but left the PQclear and query buffer destruction in the
is_index conditional.
353708e1fb2d fixed the of the query buffer
but left the PGresult . This moves clearing the result to the outer
level ensuring that it will be called.
Reviewed-by: Tom Lane <[email protected]>Discussion: https://postgr.es/m/
374550C1-F4ED-4D9D-9498-
0FD029CCF674@yesql.se
Back-through: v15
Peter Eisentraut [Wed, 15 May 2024 11:49:41 +0000 (13:49 +0200)] Re-forbid underscore in positional parameters
Underscores were added to numeric literals in
faff8f8e47. This change
also affected the positional parameters (e.g., $1) rule, which uses
the same production for its digits. But this did not actually work,
because the digits for parameters are processed using atol(), which
does not handle underscores and ignores whatever it cannot parse.
The underscores notation is probably not useful for positional
parameters, so for simplicity revert that rule to its old form that
only accepts digits 0-9.
Author: Erik Wienhold <
[email protected]>
Reviewed-by: Michael Paquier <[email protected]>Discussion: https://www.postgresql.org/message-id/flat/
5d216d1c-91f6-4cbe-95e2-
b4cbd930520c%40ewie.name
Peter Eisentraut [Wed, 15 May 2024 11:05:30 +0000 (13:05 +0200)] doc: Add standard Environment section to pg_upgrade ref page
Reviewed-by: Daniel Gustafsson <[email protected]>Discussion: https://www.postgresql.org/message-id/flat/
8458c9c5-18f1-46d7-94c4-
1c30e4f44908%40eisentraut.org
Peter Eisentraut [Wed, 15 May 2024 11:05:30 +0000 (13:05 +0200)] doc: Add standard Environment section to pg_amcheck ref page
Reviewed-by: Daniel Gustafsson <[email protected]>Discussion: https://www.postgresql.org/message-id/flat/
8458c9c5-18f1-46d7-94c4-
1c30e4f44908%40eisentraut.org
Peter Eisentraut [Wed, 15 May 2024 11:05:30 +0000 (13:05 +0200)] doc: Remove claims that initdb and pg_ctl use libpq environment variables
Erroneously introduced by
571df93cff8.
Reviewed-by: Daniel Gustafsson <[email protected]>Discussion: https://www.postgresql.org/message-id/flat/
8458c9c5-18f1-46d7-94c4-
1c30e4f44908%40eisentraut.org
Peter Eisentraut [Wed, 15 May 2024 08:52:26 +0000 (10:52 +0200)] Remove stray blank line among gram.y keywords
introduced by
de3600452bPeter Eisentraut [Wed, 15 May 2024 07:44:05 +0000 (09:44 +0200)] Make all Perl warnings fatal, catch-up
Apply
c5385929593 to new Perl files that had missed the note.
Michael Paquier [Wed, 15 May 2024 05:31:47 +0000 (14:31 +0900)] Add missing newline at the end of index_including.sql
Thinko in
a63224be49b8.
David Rowley [Wed, 15 May 2024 03:01:21 +0000 (15:01 +1200)] Fix incorrect year in some copyright notices added this year
A few es that were written <= 2023 and committed in 2024 still
contained 2023 copyright year. Fix that.
Discussion: https://postgr.es/m/CAApHDvr5egyW3FmHbAg-Uq2p_Aizwco1Zjs6Vbq18KqN64-hRA@mail.gmail.com
Bruce Momjian [Wed, 15 May 2024 02:12:49 +0000 (22:12 -0400)] doc PG 17 relnotes: add logical replication apply subtrans item
Reported-by: Masahiko Sawada
Discussion: https://postgr.es/m/CAD21AoD5jjB+M+BK5JTis8=W1g8KsS1961FyMqRpj=NBFXrJeA@mail.gmail.com
Back-through: master
Bruce Momjian [Wed, 15 May 2024 02:03:47 +0000 (22:03 -0400)] doc PG 17 relnotes: remove NOT NULL revert, add ALPN item
Make current as of 2024-05-14
Back-through: master
Bruce Momjian [Wed, 15 May 2024 00:48:11 +0000 (20:48 -0400)] doc PG 17 relnotes: wording fix
Reported-by: Pantelis Theodosiou
Discussion: https://postgr.es/m/CAE3TBxxvkSGJGv7S0SMLSAe0khrQJBHsTca799r=vDJTn+BDAw@mail.gmail.com
Back-through: master
Bruce Momjian [Wed, 15 May 2024 00:42:55 +0000 (20:42 -0400)] doc PG 17 relnotes: wording fixes
Reported-by: Elena IndrupskayaDiscussion: https://postgr.es/m/
22110133-bca5-4a99-889c-
aa0096423456@postgrespro.ru
Author: Elena Indrupskaya
Back-through: master
Bruce Momjian [Wed, 15 May 2024 00:36:36 +0000 (20:36 -0400)] doc PG 17 relnotes: add two optimizer items
One is about subqueries becoming joins and the other is about optimizing
LIMIT by improving startup cost.
Reported-by: Andy FanDiscussion: https://postgr.es/m/
[email protected]Reviewed-by: David RowleyBack-through: master
Tom Lane [Wed, 15 May 2024 00:19:20 +0000 (20:19 -0400)] Fix handling of polymorphic output arguments for procedures.
Most of the infrastructure for procedure arguments was already
okay with polymorphic output arguments, but it turns out that
CallStmtResultDesc() was a few bricks shy of a load here. It thought
all it needed to do was call build_function_result_tupdesc_t, but
that function specifically disclaims responsibility for resolving
polymorphic arguments. Failing to handle that doesn't seem to be
a problem for CALL in plpgsql, but CALL from plain SQL would get
errors like "cannot display a value of type anyelement", or even
crash outright.
In v14 and later we can simply examine the exposed types of the
CallStmt.outargs nodes to get the right type OIDs. But it's a lot
more complicated to fix in v12/v13, because those versions don't
have CallStmt.outargs, nor do they do expand_function_arguments
until ExecuteCallStmt runs. We have to duplicatively run
expand_function_arguments, and then re-determine which elements
of the args list are output arguments.
Per bug #18463 from Drew Kimball. Back- to all supported
versions, since it's busted in all of them.
Discussion: https://postgr.es/m/18463-
f8cd77e12564d8a2@postgresql.org
Tom Lane [Tue, 14 May 2024 20:46:38 +0000 (16:46 -0400)] Do housekeeping on catalog data.
Run renumber_oids.pl to move high-numbered OIDs down, as per pre-beta
tasks specified by RELEASE_CHANGES. For reference, the command was
./renumber_oids.pl --first-mapped-oid 8000 --target-oid 6300
Tom Lane [Tue, 14 May 2024 20:37:22 +0000 (16:37 -0400)] Add
da256a4a7 to .git-blame-ignore-revs.
Tom Lane [Tue, 14 May 2024 20:34:50 +0000 (16:34 -0400)] Pre-beta mechanical code beautification.
Run pgindent, pgperltidy, and reformat-dat-files.
The pgindent part of this is pretty small, consisting mainly of
fixing up self-inflicted formatting damage from es that
hadn't bothered to add their new typedefs to typedefs.list.
In order to keep it from making anything worse, I manually added
a dozen or so typedefs that appeared in the existing typedefs.list
but not in the buildfarm's list. Perhaps we should formalize that,
or better find a way to get those typedefs into the automatic list.
pgperltidy is as opinionated as always, and reformat-dat-files too.
Peter Eisentraut [Tue, 14 May 2024 10:57:22 +0000 (12:57 +0200)] Add missing gettext triggers
Commit
d6607016c7 moved all the jsonapi.c error messages into
token_error(). This needs to be added to the various nls.mk files
that use this. Since that makes token_error() effectively a globally
known symbol, the name seems a bit too general, so rename to
json_token_error() for more clarity.
Peter Eisentraut [Tue, 14 May 2024 09:34:11 +0000 (11:34 +0200)] Add missing source files to pg_combinebackup/nls.mk
Daniel Gustafsson [Tue, 14 May 2024 08:50:26 +0000 (10:50 +0200)] Remove auth-options support from initdb
When --auth was added to initdb in commit
e7029b212755 it had support
for auth options separated by space from the auth type, like:
--auth pam <servicename>
--auth ident sameuser
Passing an option to the ident auth type was removed in
01c1a12a5bb4which left the pam auth-options support in place.
8a02339e9ba3 broke
this by inverting a calculation in the strncmp arguments, which went
unnoticed for a long time. The ability to pass options to the auth
type was never documented.
Rather than fixing the support for an undocumented feature which has
been broken for all supported versions, and which only supports one
out of many auth types which can take options, it is removed.
Reported-by: Jingxian Li <[email protected]>Reviewed-by: Michael Paquier <[email protected]>Reviewed-by: Aleksander Alekseev <[email protected]>Discussion: https://postgr.es/m/
[email protected]Daniel Gustafsson [Tue, 14 May 2024 08:41:32 +0000 (10:41 +0200)] Fix memory s in error reporting with LOG level
When loglevel is set to LOG, allocated strings used in the error
message would . Fix by explicitly pfreeing them.
Author: Ranier Vilela <
[email protected]>
Reviewed-by: Daniel Gustafsson <[email protected]>Reviewed-by: Michael Paquier <[email protected]>Discussion: https://postgr.es/m/CAEudQAqMeE0AHcOsOzZx51Z0eiFJAjhBPRFt+Bxi3ETXWen7ig@mail.gmail.com
Peter Eisentraut [Tue, 14 May 2024 08:26:27 +0000 (10:26 +0200)] Add missing gettext triggers
Due to commit
dc212340058, which added use of
src/common/parse_manifest.c in the backend.
Peter Eisentraut [Tue, 14 May 2024 07:15:31 +0000 (09:15 +0200)] Make formatting in nls.mk files more consistent
Some of the nls.mk files used different indentation or line breaks
than the majority, which makes editing these files unnecessarily
confusing.
Bruce Momjian [Tue, 14 May 2024 00:55:13 +0000 (20:55 -0400)] doc PG 17 relnotes: add item about libpq large data transfers
Reported-by: Jelte Fennema-Nio
Discussion: https://postgr.es/m/CAGECzQTz5aUqLEL6daLd2Hu2FXS_LOSh4keDndJ1fwThsb_b5w@mail.gmail.com
Reviewed-by: Joe Conway
Back-through: master
David Rowley [Tue, 14 May 2024 00:39:30 +0000 (12:39 +1200)] Revert "Temporarily install debugging in partition_prune test"
1db689715 added debugging output to the partition_prune regression test
to help us figure out why buildfarm member Parula was occasionally
failing.
We've not seen any failures in around 4 weeks and the best guess as to
what the problem was is a compiler bug. Since there are no recent
failures, there's now no need to keep this debugging code, so revert it.
Discussion: https://postgr.es/m/CAApHDvqyLF881EvDtXT=ossa0i4ioJBtW2c0Wbouzt5d3HDb5Q@mail.gmail.com
Bruce Momjian [Tue, 14 May 2024 00:01:51 +0000 (20:01 -0400)] doc PG 17 relnotes: add psql connection control-C item
Reported-by: Jelte Fennema-Nio
Discussion: https://postgr.es/m/CAGECzQTz5aUqLEL6daLd2Hu2FXS_LOSh4keDndJ1fwThsb_b5w@mail.gmail.com
Reviewed-by: Tom Lane
Back-through: master
Nathan Bossart [Mon, 13 May 2024 20:53:50 +0000 (15:53 -0500)] Fix pg_sequence_last_value() for unlogged sequences on standbys.
Presently, when this function is called for an unlogged sequence on
a standby server, it will error out with a message like
ERROR: could not open file "base/5/16388": No such file or directory
Since the pg_sequences system view uses pg_sequence_last_value(),
it can error similarly. To fix, modify the function to return NULL
for unlogged sequences on standby servers. Since this bug is
present on all versions since v15, this approach is preferable to
making the ERROR nicer because we need to repair the pg_sequences
view without modifying its definition on released versions. For
consistency, this commit also modifies the function to return NULL
for other sessions' temporary sequences. The pg_sequences view
already appropriately filters out such sequences, so there's no bug
there, but we might as well offer some defense in case someone
invokes this function directly.
Unlogged sequences were first introduced in v15, but temporary
sequences are much older, so while the fix for unlogged sequences
is only back-ed to v15, the temporary sequence portion is
back-ed to all supported versions.
We could also remove the privilege check in the pg_sequences view
definition in v18 if we modify this function to return NULL for
sequences for which the current user lacks privileges, but that is
left as a future exercise for when v18 development begins.
Reviewed-by: Tom Lane, Michael PaquierDiscussion: https://postgr.es/m/
20240501005730.GA594666%40nathanxps13
Back-through: 12
Tom Lane [Mon, 13 May 2024 17:52:17 +0000 (13:52 -0400)] Remove COMMAND_TAG_NEXTTAG from enum CommandTag.
COMMAND_TAG_NEXTTAG isn't really a valid command tag. Declaring it
as if it were one prompts complaints from Coverity and perhaps other
static analyzers. Our only use of it is in an entirely-unnecessary
array sizing declaration, so let's just drop it.
Ranier Vilela
Discussion: https://postgr.es/m/CAEudQAoY0xrKuTAX7W10zsjjUpKBPFRtdCyScb3Z0FB2v6HNmQ@mail.gmail.com
Alvaro Herrera [Mon, 13 May 2024 11:13:25 +0000 (13:13 +0200)] Fix typo
Alexander Korotkov [Mon, 13 May 2024 10:26:34 +0000 (13:26 +0300)] Fix regression tests conflict in
3ca43dbbb63ca43dbbb6 adds regression tests with permission checks. The conflict has
been observed at buildfarm member piculet.
This commit fixes the conflict in the following way.
1. partition_split.sql now uses role names regress_partition_split_alice and
regress_partition_split_bob (it mistakenly used
regress_partition_merge_alice and regress_partition_merge_bob before).
2. Permissions on schemas partitions_merge_schema and partition_split_schema
are granted to corresponding roles. Before, the lack of permissions led to
the creation of objects in the public schema and potential conflict.
Reported-by: Daniel GustafssonDiscussion: https://postgr.es/m/
03A07EF6-98D2-419B-A3AA-
A111C64CC207%40yesql.se
Alvaro Herrera [Mon, 13 May 2024 09:31:09 +0000 (11:31 +0200)] Revert structural changes to not-null constraints
There are some problems with the new way to handle these constraints
that were detected at the last minute, and require fixes that appear too
invasive to be doing this late in the cycle. Revert this (again) for
now, we'll try again with these problems fixed.
The following commits are reverted:
b0e96f311985 Catalog not-null constraints
9b581c534186 Disallow changing NO INHERIT status of a not-null constraint
d0ec2ddbe088 Fix not-null constraint test
ac22a9545ca9 Move privilege check to the right place
b0f7dd915bca Check stack depth in new recursive functions
3af721794272 Update information_schema definition for not-null constraints
c3709100be73 Fix propagating attnotnull in multiple inheritance
d9f686a72ee9 Fix restore of not-null constraints with inheritance
d72d32f52d26 Don't try to assign smart names to constraints
0cd711271d42 Better handle indirect constraint drops
13daa33fa5a6 Disallow NO INHERIT not-null constraints on partitioned tables
d45597f72fe5 Disallow direct change of NO INHERIT of not-null constraints
21ac38f498b3 Fix inconsistencies in error messages
Discussion: https://postgr.es/m/
202405110940[email protected]Alvaro Herrera [Mon, 13 May 2024 08:32:33 +0000 (10:32 +0200)] Fix test case to do what it intends to
This test case intended to fail because setting a column as generated to
the partitioned table while leaving the partition alone is not allowed;
but instead failed because of a discrepancy of not-null constraint. Fix
this by adding the not-null constraint first, then set the column as
generated in a separate ALTER TABLE command, which gets the expected
error. Also, because the next test also wants to set the column as
not-null, add a BEGIN/ROLLBACK block so that the added not-null is
removed.
Oversight in
699586315704.
Alexander Korotkov [Sun, 12 May 2024 21:00:21 +0000 (00:00 +0300)] Add permission check for MERGE/SPLIT partition operations
Currently, we check only owner permission for the parent table before
MERGE/SPLIT partition operations. This leads to a security hole when users
can get access to the data of partitions without permission. This commit
fixes this problem by requiring owner permission on all the partitions
involved.
Reported-by: Alexander LakhinDiscussion: https://postgr.es/m/
0520c72e-8d97-245e-53f9-
173beca2ab2e%40gmail.com
Author: Dmitry Koval, Alexander Korotkov
Thomas Munro [Sun, 12 May 2024 19:55:20 +0000 (07:55 +1200)] Skip citext_utf8 test on Windows.
On other Windows build farm animals it is already skipped because they
don't use UTF-8 encoding. On "hamerkop", UTF-8 is used, and then the
test fails.
It is not clear to me (a non-Windows person looking only at buildfarm
evidence) whether Windows is less sophisticated than other OSes and
doesn't know how to downcase Turkish İ with the standard Unicode
database, or if it is more sophisticated than other systems and uses
locale-specific behavior like ICU does.
Whichever the reason, the result is the same: we need to skip the test
on Windows, just as we already do for ICU, at least until a
Windows-savvy developer comes up with a better idea. The technique for
detecting the OS is borrowed from collate.windows.win1252.sql.
This was anticipated by commit
c2e8bd27, but the problem only surfaced
when Windows build farm animals started using Meson.
Reviewed-by: Tom Lane <[email protected]>Discussion: https://postgr.es/m/CA%2BhUKGJ1LeC3aE2qQYTK95rFVON3ZVoTQpTKJqxkHdtEyawH4A%40mail.gmail.com
Michael Paquier [Sun, 12 May 2024 10:42:26 +0000 (19:42 +0900)] injection_points: Store runtime conditions in private area
This commit fixes a race condition between injection point run and
detach, where a point detached by a backend and concurrently running in
a second backend could cause the second backend to do an incorrect
condition check. This issue happens because the second backend
retrieves the callback information in a first step in the shmem hash
table for injection points, and the condition in a second step within
the callback. If the point is detached between these two steps, the
condition would be removed, causing the point to run while it should
not. Storing the condition in the new private_data area introduced in
33181b48fd0e ensures that the condition retrieved is consistent with its
callback.
This commit leads to a lot of simplifications in the module
injection_points, as there is no need to handle the runtime conditions
inside it anymore. Runtime conditions have no more a maximum number.
Per discussion with Noah Misch.
Reviewed-by: Noah MischDiscussion: https://postgr.es/m/
20240509031553[email protected]Michael Paquier [Sun, 12 May 2024 09:53:06 +0000 (18:53 +0900)] Introduce private data area for injection points
This commit extends the backend-side infrastructure of injection points
so as it becomes possible to register some input data when attaching a
point. This private data can be registered with the function name and
the library name of the callback when attaching a point, then it is
given as input argument to the callback. This gives the possibility for
modules to pass down custom data at runtime when attaching a point
without managing that internally, in a manner consistent with the
callback entry retrieved from the hash shmem table storing the injection
point data.
InjectionPointAttach() gains two arguments, to be able to define the
private data contents and its size.
A follow-up commit will rely on this infrastructure to close a race
condition with the injection point detach in the module
injection_points.
While on it, this changes InjectionPointDetach() to return a boolean,
returning false if a point cannot be detached. This has been mentioned
by Noah as useful when it comes to implement more complex tests with
concurrent point detach, solid with the automatic detach done for local
points in the test module.
Documentation is adjusted in consequence.
Per discussion with Noah Misch.
Reviewed-by: Noah MischDiscussion: https://postgr.es/m/
20240509031553[email protected]Heikki Linnakangas [Sat, 11 May 2024 15:48:19 +0000 (18:48 +0300)] Change ALPN protocol ID to IANA-approved "postgresql"
"TBD-pgsql" was a placeholder until the IANA registration was
approved.
Discussion: https://www.postgresql.org/message-id/87jzk2hj2n.fsf%40wibble.ilmari.org
Discussion: https://mailarchive.ietf.org/arch/msg/tls-reg-review/9LWPzQfOpbc8dTT7vc9ahNeNaiw/
Bruce Momjian [Fri, 10 May 2024 21:34:33 +0000 (17:34 -0400)] doc PG 17 relnotes: move FETCH_COUNT item, and clarify
Back-through: master
Bruce Momjian [Fri, 10 May 2024 19:47:08 +0000 (15:47 -0400)] doc PG 17 relnotes: add FETCH_COUNT item
Reported-by: Daniel VeriteDiscussion: https://postgr.es/m/
82569de4-9b2a-4311-beb2-
81d5418491ec@manitou-mail.org
Back-through: master
Peter Eisentraut [Fri, 10 May 2024 12:36:49 +0000 (14:36 +0200)] Fix ON CONFLICT DO NOTHING/UPDATE for temporal indexes
A PRIMARY KEY or UNIQUE constraint with WITHOUT OVERLAPS will be a
GiST index, not a B-Tree, but it will still have indisunique set. The
code for ON CONFLICT fails if it sees a non-btree index that has
indisunique. This commit fixes that and adds some tests. But now
that we can't just test indisunique, we also need some extra checks to
prevent DO UPDATE from running against a WITHOUT OVERLAPS constraint
(because the conflict could happen against more than one row, and we'd
only update one).
Author: Paul A. Jungwirth <
[email protected]>
Discussion: https://www.postgresql.org/message-id/
1426589a-83cb-4a89-bf40-
713970c07e63@illuminatedcomputing.com
Tom Lane [Thu, 9 May 2024 22:56:35 +0000 (18:56 -0400)] Doc: update the "Using EXPLAIN" examples to match current code.
A lot of the examples in this section are quite ancient and no
longer match the system's current behavior. I ran through them
and updated the sample output to match what I get today.
Notably, it seems that the tenk1 table got a few pages smaller back
around v12, so that a lot of the cost estimates for queries on that
table are a little different now. (This also caused some examples
to surprisingly not match others, depending on when they were made.)
One mergejoin-based example no longer produces the same plan at all,
so I had to work around that, including switching to a different
example of using an enable_xxx setting.
I also changed a couple of examples that were relying on nonexistent
tables or indexes. IMO the premise of this section is that the
examples should be more-or-less reproducible against the regression
database, so that these examples were unhelpful as given. It's not
that hard to find a corresponding example with the tables we do have.
Some of the EXPLAIN ANALYZE examples were out of date in that we show
more numbers than we did at the time.
Possibly chapter 68 could use similar review, but I'm out of
energy for today.
Bruce Momjian [Thu, 9 May 2024 20:37:51 +0000 (16:37 -0400)] doc PG 17 relnotes: fix author of LLVM item
Discussion: https://postgr.es/m/CA+hUKG+yU4+YqsCuQuzdCeETPdU+FjebXgV5Fkp6xrtr7EKC3w@mail.gmail.com
Back-through: master
Bruce Momjian [Thu, 9 May 2024 20:34:09 +0000 (16:34 -0400)] doc: clarify PERIOD and WITHOUT OVERLAPS in CREATE TABLE
Discussion: https://postgr.es/m/
04938501-fc8f-46f3-97a4-
9a81a3f24530@illuminatedcomputing.com
Author: Paul Jungwirth
Back-through: master
Tom Lane [Thu, 9 May 2024 17:16:21 +0000 (13:16 -0400)] Fix recursive RECORD-returning plpython functions.
If we recursed to a new call of the same function, with a different
coldeflist (AS clause), it would fail because the inner call would
overwrite the outer call's idea of what to return. This is vaguely
like
1d2fe56e4 and
c5bec5426, but it's not due to any API decisions:
it's just that we computed the actual output rowtype at the start of
the call, and saved it in the per-procedure data structure. We can
fix it at basically zero cost by doing the computation at the end
of each call instead of the start.
It's not clear that there's any real-world use-case for such a
function, but given that it doesn't cost anything to fix,
it'd be silly not to.
Per report from Andreas Karlsson. Back- to all supported
branches.
Discussion: https://postgr.es/m/
1651a46d-3c15-4028-a8c1-
d74937b54e19@proxel.se
Bruce Momjian [Thu, 9 May 2024 16:34:43 +0000 (12:34 -0400)] doc PG 17 relnotes: Visual Studio clarification
Reported-by: Andrew Dunstan
Back-through: master
Tom Lane [Thu, 9 May 2024 16:19:43 +0000 (12:19 -0400)] Repair ALTER EXTENSION ... SET SCHEMA.
It turns out that we broke this in commit
e5bc9454e, because
the code was assuming that no dependent types would appear
among the extension's direct dependencies, and now they do.
This isn't terribly hard to fix: just skip dependent types,
expecting that we will recurse to them when we process the parent
object (which should also be among the direct dependencies).
But a little bit of refactoring is needed so that we can avoid
duplicating logic about what is a dependent type.
Although there is some testing of ALTER EXTENSION SET SCHEMA,
it failed to cover interesting cases, so add more tests.
Discussion: https://postgr.es/m/930191.
1715205151@sss.pgh.pa.us
Bruce Momjian [Thu, 9 May 2024 15:43:03 +0000 (11:43 -0400)] doc PG 17 relnotes: Fixes from jian he
Back-through: master
Bruce Momjian [Thu, 9 May 2024 15:19:35 +0000 (11:19 -0400)] doc PG 17 relnotes: various fixes
Fixes suggested by David Rowley, Bertrand Drouvot, Masahiko
Sawada, Richard Guo, jian he, Dagfinn Ilmari Mannsåker
Back-through: master
Tom Lane [Thu, 9 May 2024 15:01:42 +0000 (11:01 -0400)] Make left-join removal safe under -DREALLOCATE_BITMAPSETS.
The initial building of RestrictInfos and SpecialJoinInfos tends to
create structures that share relid sets (such as syn_lefthand and
outer_relids). There's nothing wrong with that in itself, but when
we modify those relid sets during join removal, we have to be sure
not to corrupt the values that other structures are pointing at.
remove_rel_from_query() was careless about this. It accidentally
worked anyway because (1) we'd never be reducing the sets to empty,
so they wouldn't get pfree'd; and (2) the in-place modification is the
same one that we did or will apply to the other struct's relid set,
so that there wasn't visible corruption at the end of the process.
While there's no live bug in a standard build, of course this is way
too fragile to accept going forward. (Maybe we should back-
this change too for safety, but I've refrained for now.)
This bug was exposed by the recent invention of REALLOCATE_BITMAPSETS.
Commit
e0477837c had installed a fix, but that went away with the
reversion of SJE, so now we need to fix it again.
David Rowley and Tom Lane
Discussion: https://postgr.es/m/CACJufxFVQmr4=JWHAOSLuKA5Zy9H26nY6tVrRFBOekHoALyCkQ@mail.gmail.com
Peter Eisentraut [Thu, 9 May 2024 14:35:41 +0000 (16:35 +0200)] psql: Add missing punctuation in help output
Peter Eisentraut [Thu, 9 May 2024 14:34:50 +0000 (16:34 +0200)] doc: Use better placeholder in COPY synopsis
Alvaro Herrera [Thu, 9 May 2024 11:31:22 +0000 (13:31 +0200)] Fix inconsistencies in error messages
Reported by Kyotaro Horiguchi
Also some comments mentioning wrong version numbers, spotted by Justin
Pryzby.
Discussion: https://postgr.es/m/
20240507.171724.
750916195320223609[email protected]Discussion: https://postgr.es/m/Zh0aAH7tbZb-9HbC@pryzbyj2023
Bruce Momjian [Thu, 9 May 2024 03:54:30 +0000 (23:54 -0400)] doc: first draft of Postgres 17 release notes
Back-through: master
Michael Paquier [Thu, 9 May 2024 03:45:37 +0000 (12:45 +0900)] Fix overread in JSON parsing errors for incomplete byte sequences
json_lex_string() relies on pg_encoding_mblen_bounded() to point to the
end of a JSON string when generating an error message, and the input it
uses is not guaranteed to be null-terminated.
It was possible to walk off the end of the input buffer by a few bytes
when the last bytes consist of an incomplete multi-byte sequence, as
token_terminator would point to a location defined by
pg_encoding_mblen_bounded() rather than the end of the input. This
commit switches token_terminator so as the error uses data up to the
end of the JSON input.
More work should be done so as this code could rely on an equivalent of
report_invalid_encoding() so as incorrect byte sequences can show in
error messages in a readable form. This requires work for at least two
cases in the JSON parsing API: an incomplete token and an invalid escape
sequence. A more complete solution may be too invasive for a back,
so this is left as a future improvement, taking care of the overread
first.
A test is added on HEAD as test_json_parser makes this issue
straight-forward to check.
Note that pg_encoding_mblen_bounded() no longer has any callers. This
will be removed on HEAD with a separate commit, as this is proving to
encourage unsafe coding.
Author: Jacob Champion
Discussion: https://postgr.es/m/CAOYmi+ncM7pwLS3AnKCSmoqqtpjvA8wmCdoBtKA3ZrB2hZG6zA@mail.gmail.com
Back-through: 13
Tom Lane [Wed, 8 May 2024 15:13:40 +0000 (11:13 -0400)] Doc: document that triggers can break referential integrity.
User-written triggers can modify or block the effects of SQL update
and delete operations. That includes operations that are executed
to implement foreign keys' referential integrity actions (such as
ON UPDATE SET NULL or ON DELETE CASCADE). Therefore it's possible
for a misdesigned trigger to result in a database state that violates
the foreign key constraint.
While this isn't great, the alternatives seem worse: in particular,
refusing to fire triggers for such updates would break many valuable
use-cases. We could also try to recheck the constraint after the
action, but that'd roughly double the already-high cost of FK
constraint enforcement, for no benefit in normal cases. So we've
always considered that it's on the trigger programmer's head to
avoid breaking RI actions. This was never documented anywhere,
though. Add a para to the Triggers chapter to explain it.
Laurenz Albe, David Johnston, Tom Lane
Discussion: https://postgr.es/m/
b81fe38fcc25a81be6e2e5b3fc1ff624130762fa[email protected]Peter Eisentraut [Wed, 8 May 2024 13:24:48 +0000 (15:24 +0200)] Add test for REPLICA IDENTITY with a temporal key
You can only use REPLICA IDENTITY USING INDEX with a unique B-tree
index. This commit just adds a test showing that you cannot use it
with a WITHOUT OVERLAPS index (which is GiST).
Author: Paul A. Jungwirth <
[email protected]>
Discussion: https://www.postgresql.org/message-id/
3775839b-3f0f-4c8a-ac03-
a253222e6a4b%40illuminatedcomputing.com
Peter Eisentraut [Wed, 8 May 2024 08:17:51 +0000 (10:17 +0200)] doc: Improve order of options on pg_upgrade reference page
Put the new long-only options in a location that is consistent with
the existing long-only options and also the --help output.
Etsuro Fujita [Wed, 8 May 2024 07:15:00 +0000 (16:15 +0900)] Fix typo in src/backend/utils/resowner/README.
Peter Eisentraut [Wed, 8 May 2024 06:37:46 +0000 (08:37 +0200)] Fix incorrect format placeholder
Tom Lane [Tue, 7 May 2024 22:22:52 +0000 (18:22 -0400)] Ensure that "pg_restore -l" reports dependent TOC entries correctly.
If -l was specified together with selective-restore options such as -n
or -N, dependent TOC entries such as comments would be omitted from
the listing, even when an actual restore would have selected them.
This happened because PrintTOCSummary neglected to update the te->reqs
marking of the entry they depended on.
Per report from Justin Pryzby. This has been wrong since
0d4e6ed30taught _tocEntryRequired to sometimes look at the "reqs" marking of
other TOC entries, so back- to all supported branches.
Discussion: https://postgr.es/m/ZjoeirG7yxODdC4P@pryzbyj2023
Tom Lane [Tue, 7 May 2024 22:15:00 +0000 (18:15 -0400)] Don't corrupt plpython's "TD" dictionary in a recursive trigger call.
If a plpython-language trigger caused another one to be invoked,
the "TD" dictionary created for the inner one would overwrite the
outer one's "TD" dictionary. This is more or less the same problem
that
1d2fe56e4 fixed for ordinary functions in plpython, so fix it
the same way, by saving and restoring "TD" during a recursive
invocation.
This fix makes an ABI-incompatible change in struct PLySavedArgs.
I'm not too worried about that because it seems highly unlikely that
any extension is messing with those structs. We could imagine doing
something weird to preserve nominal ABI compatibility in the back
branches, like keeping the saved TD object in an extra element of
namedargs[]. However, that would only be very nominal compatibility:
if anything *is* touching PLySavedArgs, it would likely do the wrong
thing due to not knowing about the additional value. So I judge it
not worth the ugliness to do something different there.
(I also changed struct PLyProcedure, but its added field fits
into formerly-padding space, so that should be safe.)
Per bug #18456 from Jacques Combrink. This bug is very ancient,
so back- to all supported branches.
Discussion: https://postgr.es/m/
3008982.
1714853799@sss.pgh.pa.us
Peter Eisentraut [Tue, 7 May 2024 20:42:32 +0000 (22:42 +0200)] Fix assorted bugs related to identity column in partitioned tables
When changing the data type of a column of a partitioned table, craft
the ALTER SEQUENCE command only once. Partitions do not have identity
sequences of their own and thus do not need a ALTER SEQUENCE command
for each partition.
Fix getIdentitySequence() to fetch the identity sequence associated
with the top-level partitioned table when a Relation of a partition is
passed to it. While doing so, translate the attribute number of the
partition into the attribute number of the partitioned table.
Author: Ashutosh Bapat <
[email protected]>
Reported-by: Alexander Lakhin <[email protected]>Reviewed-by: Dmitry Dolgov <[email protected]>Discussion: https://www.postgresql.org/message-id/
3b8a9dc1-bbc7-0ef5-6863-
c432afac7d59@gmail.com
Jeff Davis [Tue, 7 May 2024 18:44:47 +0000 (11:44 -0700)] Remove obsolete comment.
Per suggestion from Peter, the comment was not helpful, so remove it
rather than fixing it.
Reported-by: Peter EisentrautDiscussion: https://postgr.es/m/
d9421b21-e759-4b74-a039-
c487b469c1f3@eisentraut.org
Tom Lane [Tue, 7 May 2024 17:35:10 +0000 (13:35 -0400)] Prevent RLS filters on ctid from breaking WHERE CURRENT OF <cursor>.
The executor only supports CurrentOfExpr as the sole tidqual of a
TidScan plan node. tidpath.c failed to take any particular care about
that, but would just take the first ctid equality qual it could find
in the target relation's baserestrictinfo list. Originally that was
fine because the grammar prevents any other WHERE conditions from
being combined with CURRENT OF <cursor>. However, if the relation has
RLS visibility policies then those would get included in the list.
Should such a policy include a condition on ctid, we'd typically grab
the wrong qual and produce a malfunctioning plan.
To fix, introduce a simplistic priority ordering scheme for which ctid
equality qual to prefer. Real-world cases involving more than one
such qual are so rare that it doesn't seem worth going to any great
trouble to choose one over another, so I didn't work very hard; but
this code could be extended in future if someone thinks differently.
It's extremely difficult to think of a reasonable use-case for an RLS
restriction involving ctid, and certainly we've heard no field reports
of this failure. So this doesn't seem worthy of back-ing, but
in the name of cleanliness let's fix it going forward.
by me, per report from Robert Haas.
Discussion: https://postgr.es/m/
3914881.
1715038270@sss.pgh.pa.us
Peter Eisentraut [Tue, 7 May 2024 09:25:55 +0000 (11:25 +0200)] doc: Improve order of options on pgbench reference page
Both the pgbench --help output and the reference page have sections
for initialization options, benchmarking options, and common options.
But the --debug option ended up in the wrong place on the reference
page. Fix that by making the documentation match the --help output.
Bruce Momjian [Tue, 7 May 2024 01:16:06 +0000 (21:16 -0400)] postgresql.conf: align variable comments, mostly new ones
Back-through: master
Tom Lane [Mon, 6 May 2024 18:22:45 +0000 (14:22 -0400)] Finish incomplete revert of
ec63622c0.
The code change this made might well be fine to keep, but the
comment justifying it by reference to self-join removal isn't.
Let's just go back to the status quo ante, pending a more thorough
review/redesign of SJE.
(I found this by grepping to see if any references to self-join
removal remained in the tree.)
Nathan Bossart [Mon, 6 May 2024 14:00:00 +0000 (09:00 -0500)] Fix privilege checks in pg_stats_ext and pg_stats_ext_exprs.
The catalog view pg_stats_ext fails to consider privileges for
expression statistics. The catalog view pg_stats_ext_exprs fails
to consider privileges and row-level security policies. To fix,
restrict the data in these views to table owners or roles that
inherit privileges of the table owner. It may be possible to apply
less restrictive privilege checks in some cases, but that is left
as a future exercise. Furthermore, for pg_stats_ext_exprs, do not
return data for tables with row-level security enabled, as is
already done for pg_stats_ext.
On the back-branches, a fix-CVE-2024-4317.sql script is provided
that will install into the "share" directory. This file can be
used to apply the fix to existing clusters.
Bumps catversion on 'master' branch only.
Reported-by: Lukas Fittl
Reviewed-by: Noah Misch, Tomas Vondra, Tom Lane
Security: CVE-2024-4317
Back-through: 14
Alexander Korotkov [Mon, 6 May 2024 11:35:58 +0000 (14:35 +0300)] Revert: Remove useless self-joins
This commit reverts
d3d55ce5713 and subsequent fixes
2b26a694554,
93c85db3b5b,
b44a1708abe,
b7f315c9d7d,
8a8ed916f73,
b5fb6736ed3,
0a93f803f45,
e0477837ce4,
a7928a57b9f,
5ef34a8fc38,
30b4955a466,
8c441c08279,
028b15405b4,
fe093994db4,
489072ab7a9, and
466979ef031.
We are quite late in the release cycle and new bugs continue to appear. Even
though we have fixes for all known bugs, there is a risk of throwing many
bugs to end users.
The plan for self-join elimination would be to do more review and testing,
then re-commit in the early v18 cycle.
Reported-by: Tom LaneDiscussion: https://postgr.es/m/
2422119.
1714691974%40sss.pgh.pa.us
Alvaro Herrera [Mon, 6 May 2024 10:45:17 +0000 (12:45 +0200)] Remove mention of nchar
This datatype is purposefully not documented.
Erik Wienhold <
[email protected]>
Discussion: https://postgr.es/m/om3g7p7u3ztlrdp4tfswgulavljgn2fe6u2agk34mrr65dffuu@cpzlzuv6flko
Peter Eisentraut [Mon, 6 May 2024 10:06:31 +0000 (12:06 +0200)] Translation updates
Source-Git-URL: https://git.postgresql.org/git/pgtranslation/messages.git
Source-Git-Hash:
be182cc55e6f72c66215fd9b38851969e3ce5480Peter Eisentraut [Mon, 6 May 2024 07:56:54 +0000 (09:56 +0200)] doc: Improve order of options on initdb reference page
Both the initdb --help output and the reference page have a section
for options and a section for less commonly used options. But some
recently added options were sprinkled around inconsistently. Fix that
by making the documentation match the --help output.
Michael Paquier [Mon, 6 May 2024 00:45:46 +0000 (09:45 +0900)] injection_points: Fix incorrect spinlock acquisition
Injection points created under injection_points_set_local() are cleaned
up by a shmem_exit() callback. The spinlock used by the module would
be hold while calling InjectionPointDetach(), which is incorrect as
spinlocks should avoid external calls while hold.
This commit changes the shmem_exit() callback to detach the points in
three steps with the spinlock acquired twice, knowing that the
injection points should be around with the conditions related to them:
- Scans for the points to detach in a first loop, while holding the
spinlock.
- Detach them.
- Remove the registered conditions.
It is still possible for other processes to detach local points
concurrently of the callback. I have wanted to restrict the detach, but
Noah has mentioned that he has in mind some cases that may require this
capability. No tests in the tree based on injection points need that
currently.
Thinko in
f587338dec87.
Reported-by: Noah MischReviewed-by: Noah MischDiscussion: https://postgr.es/m/
20240501231214[email protected]Tom Lane [Sun, 5 May 2024 15:23:49 +0000 (11:23 -0400)] Silence Coverity complaint about possible null-pointer dereference.
If pg_init_privs were to contain a NULL ACL field, this code would
pass old_acl == NULL to merge_acl_with_grant, which would crash.
The case shouldn't happen, but it just takes a couple more lines
of code to guard against it, so do so.
Oversight in
534287403; no back- needed.
Daniel Gustafsson [Sun, 5 May 2024 07:47:35 +0000 (09:47 +0200)] Fix comment regarding LibreSSL availability
SSL_AD_NO_APPLICATION_PROTOCOL is indeed available in LibreSSL, but only
in 3.4.3 and later (shipped in OpenBSD 7.0).
Discussion: https://postgr.es/m/
[email protected]David Rowley [Sun, 5 May 2024 00:54:46 +0000 (12:54 +1200)] Fix query pullup issue with WindowClause runCondition
94985c210 added code to detect when WindowFuncs were monotonic and
allowed additional quals to be "pushed down" into the subquery to be
used as WindowClause runConditions in order to short-circuit execution
in nodeWindowAgg.c.
The Node representation of runConditions wasn't well selected and
because we do qual pushdown before planning the subquery, the planning
of the subquery could perform subquery pull-up of nested subqueries.
For WindowFuncs with args, the arguments could be changed after pushing
the qual down to the subquery.
This was made more difficult by the fact that the code duplicated the
WindowFunc inside an OpExpr to include in the WindowClauses runCondition
field. This could result in duplication of subqueries and a pull-up of
such a subquery could result in another initplan parameter being issued
for the 2nd version of the subplan. This could result in errors such as:
ERROR: WindowFunc not found in subplan target lists
To fix this, we change the node representation of these run conditions
and instead of storing an OpExpr containing the WindowFunc in a list
inside WindowClause, we now store a new node type named
WindowFuncRunCondition within a new field in the WindowFunc. These get
transformed into OpExprs later in planning once subquery pull-up has been
performed.
This problem did exist in v15 and v16, but that was fixed by
9d36b883band
e5d20bbd.
Cat version bump due to new node type and modifying WindowFunc struct.
Bug: #18305
Reported-by: Zuming JiangDiscussion: https://postgr.es/m/18305-
33c49b4c830b37b3%40postgresql.org
Tom Lane [Fri, 3 May 2024 15:08:50 +0000 (11:08 -0400)] Allow selecting the git revision to be packaged by "make dist".
Commit
619bc23a1 changed "make dist" to invoke "git archive",
but hard-wired the call to specify that the HEAD revision should
be packaged. Our tarball building process needs to be able to
specify which git commit to package (notably, for packaging
back branches). While we could make that work with some hackery
to operate in detached-HEAD state, it's a lot nicer just to expose
git archive's ability to specify what to package. Hence, invent
a new make variable PG_GIT_REVISION. This is undocumented, but
so is "make dist".
Also make corresponding changes in the meson scripts. We have no
near-term intention of using that for package building, but it
will likely happen eventually, so stay prepared.
Discussion: https://postgr.es/m/
3552543.
1713909947@sss.pgh.pa.us
David Rowley [Fri, 3 May 2024 14:33:25 +0000 (02:33 +1200)] Fix an assortment of typos
Author: Alexander Lakhin
Discussion: https://postgr.es/m/
ae9f2fcb-4b24-5bb0-4240-
efbbbd944ca1@gmail.com
Peter Eisentraut [Fri, 3 May 2024 13:11:41 +0000 (15:11 +0200)] Fix expected test output
For builds without lz4, for
8f0a97dfff.
Peter Eisentraut [Fri, 3 May 2024 09:10:40 +0000 (11:10 +0200)] Fix segmentation fault in MergeInheritedAttribute()
While converting a pg_attribute tuple into a ColumnDef,
ColumnDef::compression remains NULL if there is no compression method
set fot the attribute. Calling strcmp() with NULL
ColumnDef::compression, when comparing compression methods of parents,
causes segmentation fault in MergeInheritedAttribute(). Skip
comparing compression methods if either of them is NULL.
Author: Ashutosh Bapat <
[email protected]>
Reported-by: Alexander Lakhin <[email protected]>Discussion: https://www.postgresql.org/message-id/
b22a6834-aacb-7b18-0424-
a3f5fe889667%40gmail.com
Tom Lane [Thu, 2 May 2024 21:36:31 +0000 (17:36 -0400)] Throw a more on-point error for publications depending on columns.
Same as
42b041243, except that the trouble case is a publication
WHERE clause that depends on a column.
Again reported by Alexander Lakhin. Back- to v15 where
we added publication WHERE clauses.
Discussion: https://postgr.es/m/
548a47bc-87ae-b3df-c6a2-
60b9966f808b@gmail.com
Alvaro Herrera [Thu, 2 May 2024 15:26:30 +0000 (17:26 +0200)] Disallow direct change of NO INHERIT of not-null constraints
We support changing NO INHERIT constraint to INHERIT for constraints in
child relations when adding a constraint to some ancestor relation, and
also during pg_upgrade's schema restore; but other than those special
cases, command ALTER TABLE ADD CONSTRAINT should not be allowed to
change an existing constraint from NO INHERIT to INHERIT, as that would
require to process child relations so that they also acquire an
appropriate constraint, which we may not be in a position to do. (It'd
also be surprising behavior.)
It is conceivable that we want to allow ALTER TABLE SET NOT NULL to make
such a change; but in that case some more code is needed to implement it
correctly, so for now I've made that throw the same error message.
Also, during the prep phase of ALTER TABLE ADD CONSTRAINT, acquire locks
on all descendant tables; otherwise we might operate on child tables on
which no locks are held, particularly in the mode where a primary key
causes not-null constraints to be created on children.
Reported-by: Alexander Lakhin <[email protected]>Discussion: https://postgr.es/m/
7d923a66-55f0-3395-cd40-
81c142b5448b@gmail.com
Peter Eisentraut [Thu, 2 May 2024 13:59:27 +0000 (15:59 +0200)] Rename libpq trace internal functions
libpq's pqTraceOutputMessage() used to look like this:
case 'Z': /* Ready For Query */
pqTraceOutputZ(conn->Pfdebug, message, &logCursor);
break;
Commit
f4b54e1ed98 introduced macros for protocol characters, so now
it looks like this:
case PqMsg_ReadyForQuery:
pqTraceOutputZ(conn->Pfdebug, message, &logCursor);
break;
But this introduced a disconnect between the symbol in the switch case
and the function name to be called, so this made the manageability of
this file a bit worse.
This changes the function names to match, so now it looks like
this:
case PqMsg_ReadyForQuery:
pqTraceOutput_ReadyForQuery(conn->Pfdebug, message, &logCursor);
break;
(This also improves the readability of the file in general, since some
function names like "pqTraceOutputt" were a little hard to read
accurately.)
Some protocol characters have different meanings to and from the
server. The old code structure had a common function for both, for
example, pqTraceOutputD(). The new structure splits this up into
separate ones to match the protocol message name, like
pqTraceOutput_Describe() and pqTraceOutput_DataRow().
Reviewed-by: Yugo NAGATA <[email protected]>Discussion: https://www.postgresql.org/message-id/flat/
575e4f9d-acfe-45e3-b7f1-
7e32c579090e%40eisentraut.org
Alvaro Herrera [Thu, 2 May 2024 08:51:46 +0000 (10:51 +0200)] Disallow NO INHERIT not-null constraints on partitioned tables
Such constraints are semantically useless and only bring weird cases
along, so reject them.
As a side effect, we can no longer have "throwaway" constraints in
pg_dump for primary keys in partitioned tables, but since they don't
serve any useful purpose, we can just omit them.
Maybe this should be done for all types of constraints, but it's just
not-null ones that acquired this "ability" in the 17 timeframe, so for
the moment I'm not changing anything else.
Per note by Alexander Lakhin.
Discussion: https://postgr.es/m/
7d923a66-55f0-3395-cd40-
81c142b5448b@gmail.com
Daniel Gustafsson [Thu, 2 May 2024 08:38:28 +0000 (10:38 +0200)] doc: Fix incorrectly spelled structname
Commit
61461a300c1 accidentally misspelled the PGcancelConn struct
using the PQ prefix (which admittedly is a very easy typo to make).
Reported off-list.
Reported-by: Alexander Lakhin <[email protected]>Peter Eisentraut [Thu, 2 May 2024 06:21:18 +0000 (08:21 +0200)] doc: Fix description of deterministic flag of CREATE COLLATION
The documentation said that you need to pick a suitable LC_COLLATE
setting in addition to setting the DETERMINISTIC flag. This would
have been correct if the libc provider supported nondeterministic
collations, but since it doesn't, you actually need to set the LOCALE
option.
Reviewed-by: Kashif Zeeshan <[email protected]>Discussion: https://www.postgresql.org/message-id/flat/
a71023c2-0ae0-45ad-9688-
cf3b93d0d65b%40eisentraut.org
Peter Eisentraut [Thu, 2 May 2024 05:55:53 +0000 (07:55 +0200)] doc: Fix description of configure --with-icu option
It was claiming that the ICU locale provider is used by default, which
is not correct. (From commit
fcb21b3acdc; it was once contemplated to
make it the default, but it wouldn't have been part of that in
any case.)
Reviewed-by: Kashif Zeeshan <[email protected]>Discussion: https://www.postgresql.org/message-id/flat/
a71023c2-0ae0-45ad-9688-
cf3b93d0d65b%40eisentraut.org
Alvaro Herrera [Wed, 1 May 2024 09:50:05 +0000 (11:50 +0200)] Skip invalid database pg_upgrade test on obsolete servers
When testing pg_upgrade against an old server, ignore failures on the
check to upgrade invalid databases. This is necessary because old
servers don't know to raise the appropriate error of the database being
invalid.
This change causes no reduction in coverage, because such old versions
don't know to mark databases invalid when a drop is interrupted; but
testing against such old servers is useful in some circumstances.
Back to 16, where it cherry-picks with minimal conflicts.
On 16, perltidy
20230309 chooses to change an unrelated line. I let it
do that because that's the version we document as preferred for that
branch, even though it would make other changes to many other files in
the tree.
Discussion: https://postgr.es/m/
202404181539[email protected]David Rowley [Wed, 1 May 2024 05:04:52 +0000 (17:04 +1200)] Fix typos and incorrect type in read_stream.c
max_ios should be int rather than int16, otherwise there's not much
point in doing:
max_ios = Min(max_ios, PG_INT16_MAX);
Discussion: https://postgr.es/m/CAApHDvr9Un-XpDr_+AFdOGM38O2K8SpfoHimqZ838gguTGYBiQ@mail.gmail.com
Masahiko Sawada [Wed, 1 May 2024 03:34:06 +0000 (12:34 +0900)] Fix parallel vacuum buffer usage reporting.
A parallel worker's buffer usage is accumulated to its pgBufferUsage
and then is accumulated into the leader's one at the end of the
parallel vacuum. However, since the leader process used to use
dedicated VacuumPage{Hit, Miss, Dirty} globals for the buffer usage
reporting, the worker's buffer usage was not included, leading to an
incorrect buffer usage report.
To fix the problem, this commit makes vacuum use pgBufferUsage
instruments for buffer usage reporting instead of VacuumPage{Hit,
Miss, Dirty} globals. These global variables are still used by ANALYZE
command and autoanalyze.
This also fixes the buffer usage report of vacuuming on temporary
tables, since the buffers dirtied by MarkLocalBufferDirty() were not
tracked by the VacuumPageDirty variable.
Parallel vacuum was introduced in 13, but the buffer usage reporting
for VACUUM command with the VERBOSE option was implemented in
15. So back to 15.
Reported-by: Anthonin Bonnefoy
Author: Anthonin Bonnefoy
Reviewed-by: Alena Rybakina, Masahiko Sawada
Discussion: https://postgr.es/m/CAO6_XqrQk+QZQcYs_C6nk0cMfHuUWk85vT9CrcA1NffFbAVE2A@mail.gmail.com
Back-through: 15
Michael Paquier [Wed, 1 May 2024 02:59:14 +0000 (11:59 +0900)] Add tab completion for EXPLAIN (MEMORY|SERIALIZE)
SERIALIZE has been added in
06286709ee06, and MEMORY in
5de890e3610d.
Author: Jian He
Discussion: https://postgr.es/m/CACJufxH5UbhbCg-oMt7pHOmvNABF2x48Jfefu24FexSqVgzA3g@mail.gmail.com
David Rowley [Wed, 1 May 2024 01:21:21 +0000 (13:21 +1200)] Ensure we allocate NAMEDATALEN bytes for names in Index Only Scans
As an optimization, we store "name" columns as cstrings in btree
indexes.
Here we modify it so that Index Only Scans convert these cstrings back
to names with NAMEDATALEN bytes rather than storing the cstring in the
tuple slot, as was happening previously.
Bug: #17855
Reported-by: Alexander LakhinReviewed-by: Alexander Lakhin, Tom LaneDiscussion: https://postgr.es/m/17855-
5f523e0f9769a566@postgresql.org
Back-through: 12, all supported versions
Jeff Davis [Wed, 1 May 2024 00:08:49 +0000 (17:08 -0700)] Fix locale options checking in CREATE DATABASE.
Discussion: https://postgr.es/m/
4ea13583-7305-40b0-8525-
58381533e2b1@eisentraut.org
Reported-by: Peter EisentrautTom Lane [Tue, 30 Apr 2024 14:45:14 +0000 (10:45 -0400)] Fix one more portability shortcoming in new test_pg_dump test.
If the bootstrap superuser's name requires quoting, regroleout
will supply double quotes ... but the result of CURRENT_USER
is just the literal name. Apply quote_ident() to ensure a match.
Per Andrew Dunstan's off-list investigation of buildfarm member
prion's failures.
Michael Paquier [Tue, 30 Apr 2024 10:24:12 +0000 (19:24 +0900)] doc: Remove one example related to pg_input_error_info()
This slightly bloated the contents of the function table for this entry,
without really bringing extra value.
Per discussion with Jian He and David G. Johnston.
Discussion: https://postgr.es/m/CACJufxGdyoBJQMSxwdxNK=k8M5WUth5FDFd4Wq_K4f7+1J2xuQ@mail.gmail.com
Alexander Korotkov [Tue, 30 Apr 2024 09:12:43 +0000 (12:12 +0300)] Stabilize regression tests introduced by
259c96fa8fAdd the ORDER BY clause to new queries to avoid ordering ambiguity.
Per buildfarm member rorqual.