Commit Graph

58613 Commits

Author SHA1 Message Date
David Rowley 0de37b5106 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 he
Reviewed-by: jian he
Discussion: https://www.postgresql.org/message-id/CACJufxE4Sp7xvgOwhqtFx5hS85AxMKobPWDo-xZHZVTpK3EBjA@mail.gmail.com
2024-05-16 12:50:16 +12:00
Michael Paquier f01e3ba56f 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 patch 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
2024-05-16 09:15:01 +09:00
Tom Lane 3c03ee1a39 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.
2024-05-15 19:02:14 -04:00
Daniel Gustafsson a8f87d5d21 Fix query result leak during binary upgrade
9a974cbcba 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.  353708e1fb fixed the leak of the query buffer
but left the PGresult leak. This moves clearing the result to the outer
level ensuring that it will be called.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/374550C1-F4ED-4D9D-9498-0FD029CCF674@yesql.se
Backpatch-through: v15
2024-05-15 22:48:51 +02:00
Peter Eisentraut 98b4f53d15 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 <ewie@ewie.name>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://www.postgresql.org/message-id/flat/5d216d1c-91f6-4cbe-95e2-b4cbd930520c%40ewie.name
2024-05-15 13:49:41 +02:00
Peter Eisentraut 96bc29edfd doc: Add standard Environment section to pg_upgrade ref page
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://www.postgresql.org/message-id/flat/8458c9c5-18f1-46d7-94c4-1c30e4f44908%40eisentraut.org
2024-05-15 13:06:12 +02:00
Peter Eisentraut cff942453f doc: Add standard Environment section to pg_amcheck ref page
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://www.postgresql.org/message-id/flat/8458c9c5-18f1-46d7-94c4-1c30e4f44908%40eisentraut.org
2024-05-15 13:06:12 +02:00
Peter Eisentraut 4f8ff6af1f doc: Remove claims that initdb and pg_ctl use libpq environment variables
Erroneously introduced by 571df93cff.

Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://www.postgresql.org/message-id/flat/8458c9c5-18f1-46d7-94c4-1c30e4f44908%40eisentraut.org
2024-05-15 13:06:12 +02:00
Peter Eisentraut 54cf0c5118 Remove stray blank line among gram.y keywords
introduced by de3600452b
2024-05-15 10:52:26 +02:00
Peter Eisentraut cc70e170c0 Make all Perl warnings fatal, catch-up
Apply c538592959 to new Perl files that had missed the note.
2024-05-15 10:10:19 +02:00
Michael Paquier 54b69f1bd7 Add missing newline at the end of index_including.sql
Thinko in a63224be49.
2024-05-15 14:31:47 +09:00
David Rowley 8cb653b245 Fix incorrect year in some copyright notices added this year
A few patches 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
2024-05-15 15:01:21 +12:00
Bruce Momjian 771fa58df2 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

Backpatch-through: master
2024-05-14 22:12:49 -04:00
Bruce Momjian 9bb47338d0 doc PG 17 relnotes: remove NOT NULL revert, add ALPN item
Make current as of 2024-05-14

Backpatch-through: master
2024-05-14 22:03:47 -04:00
Bruce Momjian 2b065fc549 doc PG 17 relnotes: wording fix
Reported-by: Pantelis Theodosiou

Discussion: https://postgr.es/m/CAE3TBxxvkSGJGv7S0SMLSAe0khrQJBHsTca799r=vDJTn+BDAw@mail.gmail.com

Backpatch-through: master
2024-05-14 20:48:11 -04:00
Bruce Momjian 78e4841c1b doc PG 17 relnotes: wording fixes
Reported-by: Elena Indrupskaya

Discussion: https://postgr.es/m/22110133-bca5-4a99-889c-aa0096423456@postgrespro.ru

Author: Elena Indrupskaya

Backpatch-through: master
2024-05-14 20:42:55 -04:00
Bruce Momjian 1a48f8b40d 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 Fan

Discussion: https://postgr.es/m/87h6f4ncc6.fsf@163.com

Reviewed-by: David Rowley

Backpatch-through: master
2024-05-14 20:37:01 -04:00
Tom Lane f535f350c1 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-patch to all supported
versions, since it's busted in all of them.

Discussion: https://postgr.es/m/18463-f8cd77e12564d8a2@postgresql.org
2024-05-14 20:19:20 -04:00
Tom Lane 245f1cec59 Do pre-release 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
2024-05-14 16:46:38 -04:00
Tom Lane ce13f54e60 Add da256a4a7 to .git-blame-ignore-revs. 2024-05-14 16:37:22 -04:00
Tom Lane da256a4a7f 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 patches 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.
2024-05-14 16:34:50 -04:00
Peter Eisentraut 3ddbac368c 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.
2024-05-14 12:57:22 +02:00
Peter Eisentraut 9eb54a258f Add missing source files to pg_combinebackup/nls.mk 2024-05-14 11:36:20 +02:00
Daniel Gustafsson 83ae824c87 Remove auth-options support from initdb
When --auth was added to initdb in commit e7029b2127 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 01c1a12a5b
which left the pam auth-options support in place. 8a02339e9b 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 <aqktjcm@qq.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Aleksander Alekseev <aleksander@timescale.com>
Discussion: https://postgr.es/m/tencent_29731C7C7E6A2F9FB807C3A1DC3D81293C06@qq.com
2024-05-14 10:50:26 +02:00
Daniel Gustafsson b362d14816 Fix memory leaks in error reporting with LOG level
When loglevel is set to LOG, allocated strings used in the error
message would leak. Fix by explicitly pfreeing them.

Author: Ranier Vilela <ranier.vf@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAEudQAqMeE0AHcOsOzZx51Z0eiFJAjhBPRFt+Bxi3ETXWen7ig@mail.gmail.com
2024-05-14 10:41:32 +02:00
Peter Eisentraut ab4d7a38c3 Add missing gettext triggers
Due to commit dc21234005, which added use of
src/common/parse_manifest.c in the backend.
2024-05-14 10:26:27 +02:00
Peter Eisentraut 2e810bdb7f 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.
2024-05-14 09:21:17 +02:00
Bruce Momjian e87e732455 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

Backpatch-through: master
2024-05-13 20:55:33 -04:00
David Rowley ec1a405adc 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
2024-05-14 12:39:30 +12:00
Bruce Momjian 6961753381 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

Backpatch-through: master
2024-05-13 20:01:51 -04:00
Nathan Bossart 3cb2f13ac5 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-patched to v15, the temporary sequence portion is
back-patched 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 Paquier
Discussion: https://postgr.es/m/20240501005730.GA594666%40nathanxps13
Backpatch-through: 12
2024-05-13 15:53:50 -05:00
Tom Lane 1f7452fa59 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
2024-05-13 13:52:17 -04:00
Alvaro Herrera 11c1984ccc
Fix typo 2024-05-13 13:13:25 +02:00
Alexander Korotkov 2a679ae94e Fix regression tests conflict in 3ca43dbbb6
3ca43dbbb6 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 Gustafsson
Discussion: https://postgr.es/m/03A07EF6-98D2-419B-A3AA-A111C64CC207%40yesql.se
2024-05-13 13:26:34 +03:00
Alvaro Herrera 6f8bb7c1e9
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:

    b0e96f3119  Catalog not-null constraints
    9b581c5341  Disallow changing NO INHERIT status of a not-null constraint
    d0ec2ddbe0  Fix not-null constraint test
    ac22a9545c  Move privilege check to the right place
    b0f7dd915b  Check stack depth in new recursive functions
    3af7217942  Update information_schema definition for not-null constraints
    c3709100be  Fix propagating attnotnull in multiple inheritance
    d9f686a72e  Fix restore of not-null constraints with inheritance
    d72d32f52d  Don't try to assign smart names to constraints
    0cd711271d  Better handle indirect constraint drops
    13daa33fa5  Disallow NO INHERIT not-null constraints on partitioned tables
    d45597f72f  Disallow direct change of NO INHERIT of not-null constraints
    21ac38f498  Fix inconsistencies in error messages

Discussion: https://postgr.es/m/202405110940.joxlqcx4dogd@alvherre.pgsql
2024-05-13 11:31:09 +02:00
Alvaro Herrera e89f4c6618
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 6995863157.
2024-05-13 10:32:33 +02:00
Alexander Korotkov 3ca43dbbb6 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 Lakhin
Discussion: https://postgr.es/m/0520c72e-8d97-245e-53f9-173beca2ab2e%40gmail.com
Author: Dmitry Koval, Alexander Korotkov
2024-05-13 00:00:21 +03:00
Thomas Munro cff4e5a36b 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 <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CA%2BhUKGJ1LeC3aE2qQYTK95rFVON3ZVoTQpTKJqxkHdtEyawH4A%40mail.gmail.com
2024-05-13 07:55:58 +12:00
Michael Paquier 267d41dc4f 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
33181b48fd 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 Misch
Discussion: https://postgr.es/m/20240509031553.47@rfd.leadboat.com
2024-05-12 19:42:26 +09:00
Michael Paquier 33181b48fd 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 Misch
Discussion: https://postgr.es/m/20240509031553.47@rfd.leadboat.com
2024-05-12 18:53:06 +09:00
Heikki Linnakangas 407e0b023c 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/
2024-05-11 18:48:19 +03:00
Bruce Momjian 31e8f4e619 doc PG 17 relnotes: move FETCH_COUNT item, and clarify
Backpatch-through: master
2024-05-10 17:34:33 -04:00
Bruce Momjian e7b2593bd6 doc PG 17 relnotes: add FETCH_COUNT item
Reported-by: Daniel Verite

Discussion: https://postgr.es/m/82569de4-9b2a-4311-beb2-81d5418491ec@manitou-mail.org

Backpatch-through: master
2024-05-10 15:47:08 -04:00
Peter Eisentraut 144c2ce0cc 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 <pj@illuminatedcomputing.com>
Discussion: https://www.postgresql.org/message-id/1426589a-83cb-4a89-bf40-713970c07e63@illuminatedcomputing.com
2024-05-10 14:55:31 +02:00
Tom Lane 5caa057496 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.
2024-05-09 18:56:46 -04:00
Bruce Momjian 6a126d91cd doc PG 17 relnotes: fix author of LLVM item
Discussion: https://postgr.es/m/CA+hUKG+yU4+YqsCuQuzdCeETPdU+FjebXgV5Fkp6xrtr7EKC3w@mail.gmail.com

Backpatch-through: master
2024-05-09 16:37:51 -04:00
Bruce Momjian c3db1f30cb doc: clarify PERIOD and WITHOUT OVERLAPS in CREATE TABLE
Discussion: https://postgr.es/m/04938501-fc8f-46f3-97a4-9a81a3f24530@illuminatedcomputing.com

Author: Paul Jungwirth

Backpatch-through: master
2024-05-09 16:34:09 -04:00
Tom Lane d727c54317 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-patch to all supported
branches.

Discussion: https://postgr.es/m/1651a46d-3c15-4028-a8c1-d74937b54e19@proxel.se
2024-05-09 13:16:34 -04:00
Bruce Momjian b538e69249 doc PG 17 relnotes: Visual Studio clarification
Reported-by: Andrew Dunstan

Backpatch-through: master
2024-05-09 12:35:04 -04:00
Tom Lane 9effc4608e 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
2024-05-09 12:19:52 -04:00