Commit Graph

54575 Commits

Author SHA1 Message Date
Peter Geoghegan cb8ff7ed5a Consistently use named parameters in regex code consistently.
Adjust a handful of remaining function prototypes that were overlooked
by recent commit bc2187ed.  This oversight wasn't caught by clang-tidy
because the functions in question are only built in custom REG_DEBUG
builds.

Author: Peter Geoghegan <pg@bowt.ie>
Reported-By: Tom Lane <tgl@sss.pgh.pa.us>
2022-09-19 15:47:04 -07:00
Andres Freund 70df2df1cc Extend gendef.pl in preparation for meson
The main issue with using gendef.pl as-is for meson is that with meson the
filenames are a bit longer, exceeding the max commandline length when calling
dumpbin with all objects. As it's easier to pass in a library anyway, do so.

The .def file location, input and temporary file location need to be tunable
as well.

This also fixes a bug in gendef.pl: The logic when to regenerate was broken
and never avoid regenerating.

Author: Andres Freund <andres@anarazel.de>
Reviewed-By: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Discussion: https://postgr.es/m/20220809071055.rgikv3qn74ypnnbb@awork3.anarazel.de
Discussion: https://postgr.es/m/7dae5979-c6c0-cec5-7a36-76a85aa8053d@enterprisedb.com
2022-09-19 15:39:35 -07:00
Peter Eisentraut 1091b48cd7 Update Unicode data to Unicode 15.0.0 2022-09-19 18:30:05 -04:00
Peter Geoghegan c4f8e89fef Consistently use named parameters in timezone code.
Make our copy of the IANA timezone library use named parameters in
function declarations.  Also make sure that parameter names from each
function's declaration match corresponding definition parameter names.

This makes the timezone code follow Postgres coding standards.  The
value of having a consistent standard everywhere seems to outweigh the
cost of keeping the function declarations in sync with future IANA
releases.

Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com
2022-09-19 15:13:42 -07:00
Peter Geoghegan bc2187ed63 Consistently use named parameters in regex code.
Make regex code consistently use named parameters in function
declarations.  Also make sure that parameter names from each function's
declaration match corresponding definition parameter names.

This makes Henry Spencer's regex code follow Postgres coding standards.

Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com
2022-09-19 15:10:24 -07:00
David Rowley 55b4966365 Fix misleading comment for get_cheapest_group_keys_order
The header comment for get_cheapest_group_keys_order() claimed that the
output arguments were set to a newly allocated list which may be freed by
the calling function, however, this was not always true as the function
would simply leave these arguments untouched in some cases.

This tripped me up when working on 1349d2790 as I mistakenly assumed I
could perform a list_concat with the output parameters.  That turned out
bad due to list_concat modifying the original input lists.

In passing, make it more clear that the number of distinct values is
important to reduce tiebreaks during sorts.  Also, explain what the
n_preordered parameter means.

Backpatch-through: 15, where get_cheapest_group_keys_order was introduced.
2022-09-20 10:03:26 +12:00
David Rowley 78a9af1a27 Fix out-dated comment in preprocess_groupclause()
The comment claimed we don't consider other orders of the GROUP BY clause,
but this is no longer true as of db0d67db2.

Discussion: https://postgr.es/m/CAApHDvq65=9Ro+hLX1i9ugWEiNDvHrBibAO7ARcTnf38_JE+UQ@mail.gmail.com
Backpatch-through: 15, where db0d67db2 was introduced.
2022-09-20 09:13:49 +12:00
David Rowley 66fa8ff637 Remove various duplicated words
Author: Justin Pryzby
Discussion: https://postgr.es/m/20220919111000.GW31833@telsasoft.com
2022-09-20 08:37:02 +12:00
Peter Eisentraut cab3ce7a06 Fix icu tests with C locale
Similar to 1e08576691, but for the icu
test suite.

Reported-by: Christoph Berg <myon@debian.org>
Discussion: https://www.postgresql.org/message-id/YyWeU61YMFwjVdxE@msg.df7cb.de
2022-09-19 15:22:43 -04:00
Robert Haas 48a257d444 Make ALTER DEFAULT PRIVILEGES require privileges, not membership.
If role A is a direct or indirect member of role B but does not inherit
B's privileges (because at least one relevant grant was created WITH
INHERIT FALSE) then A should not be permitted to bypass privilege
checks that require the privileges of B. For example, A can't change
the privileges of objects owned by B, nor can A drop those objects.

However, up until now, it's been possible for A to change default
privileges for role B. That doesn't seem to be correct, because a
non-inherited role grant is only supposed to permit you to assume
the identity of the granted role via SET ROLE, and should not
otherwise permit you to exercise the privileges of that role. Most
places followed that rule, but this case was an exception.

This could be construed as a security vulnerability, but it does not
seem entirely clear cut, since older branches were fuzzy about the
distinction between is_member_of_role() and has_privs_of_role() in
a number of other ways as well. Because of this, and because
user-visible behavior changes in minor releases are to be avoided
whenever possible, no back-patch.

Discussion: http://postgr.es/m/CA+TgmobG_YUP06R_PM_2Z7wR0qv_52gQPHD8CYXbJva0cf0E+A@mail.gmail.com
2022-09-19 14:21:59 -04:00
Robert Haas ebfb814f7c walmethods.c/h: Make WalWriteMethod more object-oriented.
Normally when we use object-oriented programming techniques, we
provide a pointer to an object and then some way of looking up the
associated table of callbacks, but walmethods.c/h took the alternative
approach of providing only a pointer to the table of callbacks and
thus imposed the artificial restriction that there could only ever be
one object of each type, so that the callbacks could find it via a
global variable. That doesn't seem like the right idea, so revise the
approach.

Each callback which does not already have an argument of type
Walfile * now takes a pointer to the relevant WalWriteMethod *
so that these callbacks need not rely on there being only one
object of each type.

Freeing a WalWriteMethod is now performed via a callback provided
for that purpose rather than requiring the caller to know which
WAL method they want to free.

Discussion: http://postgr.es/m/CA+TgmoZS0Kw98fOoAcGz8B9iDhdqB4Be4e=vDZaJZ5A-xMYBqA@mail.gmail.com
2022-09-19 12:53:46 -04:00
Tom Lane c35ba141de Future-proof the recursion inside ExecShutdownNode().
The API contract for planstate_tree_walker() callbacks is that they
take a PlanState pointer and a context pointer.  Somebody figured
they could save a couple lines of code by ignoring that, and passing
ExecShutdownNode itself as the walker even though it has but one
argument.  Somewhat remarkably, we've gotten away with that so far.
However, it seems clear that the upcoming C2x standard means to
forbid such cases, and compilers that actively break such code
likely won't be far behind.  So spend the extra few lines of code
to do it honestly with a separate walker function.

In HEAD, we might as well go further and remove ExecShutdownNode's
useless return value.  I left that as-is in back branches though,
to forestall complaints about ABI breakage.

Back-patch, with the thought that this might become of practical
importance before our stable branches are all out of service.
It doesn't seem to be fixing any live bug on any currently known
platform, however.

Discussion: https://postgr.es/m/208054.1663534665@sss.pgh.pa.us
2022-09-19 12:16:07 -04:00
Robert Haas 4fd1479494 walmethods.c/h: Make Walfile a struct, rather than a void *
This makes the curent file position and pathname visible in a generic
way, so we no longer need current_walfile_name global variable or the
get_current_pos() method. Since that purported to be able to fail but
never actually did, this also lets us get rid of some unnecessary
error-handling code.

One risk of this change is that the get_current_pos() method
previously cleared the error indicator, and that will no longer happen
with the new approach. I looked for a way that this could cause problems
and did not find one.

The previous code was confused about whether "Walfile" was the
implementation-dependent structure representing a WAL file or
whether it was a pointer to that stucture. Some of the code used it
one way, and some in the other. The compiler tolerated that because
void * is interchangeable with void **, but now that Walfile is a
struct, it's necessary to be consistent. Hence, some references to
"Walfile" have been converted to "Walfile *".

Discussion: http://postgr.es/m/CA+TgmoZS0Kw98fOoAcGz8B9iDhdqB4Be4e=vDZaJZ5A-xMYBqA@mail.gmail.com
2022-09-19 11:20:18 -04:00
Peter Eisentraut 1fe1d09652 Add missing serial commas 2022-09-19 06:35:01 -04:00
Amit Kapila a234177906 Fix typos.
Author: Hou Zhijie and Zhang Mingli
Discussion: https://postgr.es/m/OS0PR01MB57162559C01FE2848C12E8F7944D9@OS0PR01MB5716.jpnprd01.prod.outlook.com
2022-09-19 14:21:39 +05:30
John Naylor 08f8af983a Fix typos referring to PGPROC
Japin Li

Reviewed by Kyotaro Horiguchi
Discussion: https://www.postgresql.org/message-id/MEYP282MB1669459813B36FB5EAA38434B6499@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
2022-09-19 11:36:51 +07:00
Peter Geoghegan f66d997fd0 Harmonize missed reorderbuffer parameter names.
The function ReorderBufferCommitChild() was overlooked by initial work
from commit 035ce1fe.

Author: Peter Geoghegan <pg@bowt.ie>
Discussion: https://postgr.es/m/CAH2-WzkhzFESnRo+VaGqyEZuzc33Dw09BdZBVmW896Sa22ci_A@mail.gmail.com
2022-09-18 12:05:07 -07:00
Michael Paquier 9f65aaa408 Remove unused argument "isSlice" from transformAssignmentSubscripts()
Since c7aba7c, the transform method used during parse analysis of a
subcripting construct has moved from transformAssignmentSubscripts() to
the per-type transform method (arrays or arbitrary types) the step that
checks for slicing support, but transformAssignmentSubscripts() has kept
traces of it.  Removing it simplifies the code, so let's clean up all
that.

Author: Zhang Mingli
Reviewed-by: Richard Guo
Discussion: https://postgr.es/m/0d7041ac-c704-48ad-86fd-e05feddf08ed@Spark
2022-09-18 15:33:16 +09:00
Peter Geoghegan 035ce1feb2 Harmonize reorderbuffer parameter names.
Make reorderbuffer.h function declarations consistently use named
parameters.  Also make sure that the declarations use names that match
corresponding names from function definitions in reorderbuffer.c.  This
makes the definitions easier to follow, especially in the case of
functions that happen to have adjoining arguments of the same type.

This patch was written with help from clang-tidy.  Specifically, its
"readability-inconsistent-declaration-parameter-name" check and its
"readability-named-parameter" check were used.

Author: Peter Geoghegan <pg@bowt.ie>
Discussion: https://postgr.es/m/3955318.1663377656@sss.pgh.pa.us
2022-09-17 17:20:17 -07:00
Peter Geoghegan 4274dc223c Make check_usermap() parameter names consistent.
The function has a bool argument named "case_insensitive", but that was
spelled "case_sensitive" in the declaration.  Make them consistent now
to avoid confusion in the future.

Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Michael Paquiër <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com
Backpatch: 10-
2022-09-17 16:54:17 -07:00
Andres Freund 43fcaa345d Include c.h instead of postgres.h in src/port/*p{read,write}*.c
Frontend code shouldn't include postgres.h. Some files in src/port/ need to
include postgres.h/postgres_fe.h, but these files don't.

Discussion: https://postgr.es/m/20220915022626.5xx3ccgkzpkqw5mq@awork3.anarazel.de
Backpatch: 12-, where 3fd2a7932e introduced (some) of these files
2022-09-17 09:21:59 -07:00
Andres Freund 8d513a6b71 Remove DLLTOOL, DLLWRAP from configure / Makefile.global.in
We got rid of the need for them in 4f5f485d10 and 846e91e022.

Discussion: https://postgr.es/m/20220915022626.5xx3ccgkzpkqw5mq@awork3.anarazel.de
2022-09-17 09:15:12 -07:00
Andres Freund 9d3ebba729 pgstat: Create memory contexts below TopMemoryContext
So far they were created below CacheMemoryContext. However, that's not
guaranteed to exist in all situations, leading to memory contexts created as
top-level contexts. There isn't actually a good reason anymore to create them
below CacheMemoryContext, so just creating them below TopMemoryContext seems
the best approach.

Reported-by: Reid Thompson <reid.thompson@crunchydata.com>
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Author: "Drouvot, Bertrand" <bdrouvot@amazon.com>
Discussion: https://postgr.es/m/b948b729-42fe-f88c-2f4a-0e65d84c049b@amazon.com
Backpatch: 15-
2022-09-17 09:04:23 -07:00
Michael Paquier fdd8937c07 Fix huge_pages on Windows
Since Windows 10 1703, it is additionally necessary to pass a flag
called FILE_MAP_LARGE_PAGES to MapViewOfFile() to enable large pages at
map time.  This flag is ignored on older versions of Windows, where
large pages should still be able to work properly without setting it.
Note that the flag would be set only for binaries that knew about it at
compile-time, which should be more or less all the Windows environments
these days.

Since 495ed0e, Windows 10 is the minimum version of Windows supported by
Postgres, making this change easy to reason about on HEAD.  Per
discussion, no backpatch is done for the moment.

Reported-by: Okano Naoki
Author: Thomas Munro
Reviewed-by: Tom Lane, Michael Paquier, Julien Rouhaud
Discussion: https://postgr.es/m/17448-0a96583a67edb1f7@postgresql.org
2022-09-17 15:39:55 +09:00
Peter Eisentraut a0b65155d0 Message style improvements 2022-09-17 08:15:11 +02:00
Andres Freund 32914d900f Fix race condition in stats.sql added in 5264add784
Very occasionally the stats test failed due to the number of sessions not
being updated yet. Likely this requires that there is contention on the
database's stats entry. Solve this by forcing pending stats to be flushed
before fetching the stats.

I verified that there are no other test failures after making
pgstat_report_stat() only flush stats when force = true.

Per message from Tom Lane and buildfarm member crake.

Discussion: https://postgr.es/m/3428246.1663271992@sss.pgh.pa.us
Backpatch: 15-, where 5264add784 added the test
2022-09-16 11:28:20 -07:00
Tom Lane bfd6b3bc4e Improve plpgsql's ability to handle arguments declared as RECORD.
Treat arguments declared as RECORD as if that were a polymorphic type
(which it is, sort of), in that we substitute the actual argument type
while forming the function cache lookup key.  This allows the specific
composite type to be known in some cases where it was not before,
at the cost of making a separate function cache entry for each named
composite type that's passed to the function during a session.  The
particular symptom discussed in bug #17610 could be solved in other
more-efficient ways, but only at the cost of considerable development
work, and there are other cases where we'd still fail without this.

Per bug #17610 from Martin Jurča.  Back-patch to v11 where we first
allowed plpgsql functions to be declared as taking type RECORD.

Discussion: https://postgr.es/m/17610-fb1eef75bf6c2364@postgresql.org
2022-09-16 13:23:01 -04:00
Andres Freund d08a049db9 aix: xlc: Use -Wl,-b,expfull for old compiler versions
Unfortunately xlc 12.1 and earlier don't support -qvisibility. Therefore
be7c15b194 doesn't suffice to make extension libraries work without the
explicit mkldexport step removed in fe6a64a58a. While 12.1 is EOL, there is
some desire to leave buildfarm animals using it run a bit longer. But instead
of adding back the complicated mkldexport step, we can use -Wl,-b,expfull to
force all symbols to be exported.

Reviewed-By: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/2490844.1663123546@sss.pgh.pa.us
2022-09-16 08:46:36 -07:00
Tom Lane eacbe94ab1 Clean up minor inconsistencies in pg_attribute_printf() usage.
For some reason we'd never decorated pg_v*printf() with
pg_attribute_printf() annotations.  There is a convention for
how to label va_list-using printf functions (write zero for the
second argument), and we use that liberally elsewhere in the
code, but these core functions lacked it.  It's not clear how
much useful checking the compiler can do for calls of these,
but we might as well add the annotations.

Also, sync win32security.c's log_error() with our normal convention
that pg_attribute_printf must be attached to a function's declaration
not definition.  Apparently this file is only compiled with compilers
that aren't picky about that, but still it'd be better to be
consistent.

No back-patch since there's little reason to think we would catch
anything.

Discussion: https://postgr.es/m/3492412.1663283395@sss.pgh.pa.us
2022-09-16 11:10:48 -04:00
Peter Eisentraut b2451385cb Message wording improvements 2022-09-16 16:39:26 +02:00
Peter Eisentraut 32b507378f postgres_fdw: Remove useless DO block in test
Discussion: https://www.postgresql.org/message-id/flat/b1f9f399-3a1a-b554-283f-4ae7f34608e2@enterprisedb.com
2022-09-16 15:57:34 +02:00
Peter Eisentraut 5ac51c8c9e Adjust assorted hint messages that list all valid options.
Instead of listing all valid options, we now try to provide one
that looks similar.  Since this may be useful elsewhere, this
change introduces a new set of functions that can be reused for
similar purposes.

Author: Nathan Bossart <nathandbossart@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/b1f9f399-3a1a-b554-283f-4ae7f34608e2@enterprisedb.com
2022-09-16 14:53:12 +02:00
Peter Eisentraut 1e08576691 Fix createdb tests for C locale
If the createdb tests run under the C locale, the database cluster
will be initialized with encoding SQL_ASCII.  With the checks added in
c7db01e325, this will cause several
ICU-related tests to fail because SQL_ASCII is not supported by ICU.
To work around that, use initdb option -E UTF8 for those tests to get
past that check.
2022-09-16 11:10:41 +02:00
Peter Eisentraut c7db01e325 Don't allow creation of database with ICU locale with unsupported encoding
Check in CREATE DATABASE and initdb that the selected encoding is
supported by ICU.  Before, they would pass but users would later get
an error from the server when they tried to use the database.

Also document that initdb sets the encoding to UTF8 by default if the
ICU locale provider is chosen.

Author: Marina Polyakova <m.polyakova@postgrespro.ru>
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Discussion: https://www.postgresql.org/message-id/6dd6db0984d86a51b7255ba79f111971@postgrespro.ru
2022-09-16 09:41:33 +02:00
Tom Lane cf2c7a736e Detect format-string mistakes in the libpq_pipeline test module.
I happened to notice that libpq_pipeline's private implementation
of pg_fatal lacked any pg_attribute_printf decoration.  Indeed,
adding that turned up a mistake!  We'd likely never have noticed
because the error exits in this code are unlikely to get hit,
but still, it's a bug.

We're so used to having the compiler check this stuff for us that
a printf-like function without pg_attribute_printf is a land mine.
I wonder if there is a way to detect such omissions.

Back-patch to v14 where this code came in.
2022-09-15 17:17:53 -04:00
Alvaro Herrera 3a06a79cd1
Copy-edit docs for logical replication column lists
There was a excessive structure, leading to somewhat disorganized
presentation of the information. Remove a few tags and reorder
paragraphs to make the text flow more easily.  Also, reword some of it
to be more concise.

The bit about column list combination is not modified, other than to
remove an uninteresting (and IMO confusing and wrong) paragraph; I
intend to deal with it differently afterwards.

Backpatch to 15.

Discussion: https://postgr.es/m/20220913121138.yn7ekkfysxzhkm2u@alvherre.pgsql
2022-09-15 18:04:00 +02:00
Tom Lane 918de37652 Revert ill-considered change in pg_resetwal output.
Commit 31dcfae83 changed one pg_resetwal output string, and a
corresponding test in pg_upgrade, without sufficient thought for
the consequences.  We can't change that output without creating
hazards for cross-version upgrades, since pg_upgrade needs to be able
to read the output of several different versions of pg_resetwal.
There may well be external tools with the same requirement.

For the moment, just revert those two changes.  What we really
ought to do here is have a separate, stable, easily machine-readable
output format for pg_resetwal and pg_controldata, as proposed
years ago by Alvaro.  Once that's in place and tools no longer
need to depend on the exact spelling of the human-readable output,
we can put back this change.

Discussion: https://postgr.es/m/fbea8c6f-415a-bad9-c3de-969c40d08a84@dunslane.net
2022-09-15 10:58:03 -04:00
Noah Misch b4f584f9d2 Reset InstallXLogFileSegmentActive after walreceiver self-initiated exit.
After commit cc2c7d65fc added this flag,
failure to reset it caused assertion failures.  In non-assert builds, it
made the system fail to achieve the objectives listed in that commit;
chiefly, we might emit a spurious log message.  Back-patch to v15, where
that commit first appeared.

Bharath Rupireddy and Kyotaro Horiguchi.  Reviewed by Dilip Kumar,
Nathan Bossart and Michael Paquier.  Reported by Dilip Kumar.

Discussion: https://postgr.es/m/CAFiTN-sE3ry=ycMPVtC+Djw4Fd7gbUGVv_qqw6qfzp=JLvqT3g@mail.gmail.com
2022-09-15 06:45:23 -07:00
John Naylor 7beda87b6a Fix grammar in error message
While at it, make ellipses formatting consistent when describing SQL statements.

Ekaterina Kiryanova and Alexander Lakhin

Reviewed by myself and Álvaro Herrera
Discussion: https://www.postgresql.org/message-id/eed5cec0-a542-53da-6a5e-7789c6ed9817%40postgrespro.ru
Backpatch only the grammar fix to v15
2022-09-15 11:40:17 +07:00
John Naylor 16492df70b Blind attempt to fix LLVM dependency in the backend
Commit ecaf7c5df5 removed gram.h from the backend's generated-headers
target. In LLVM builds, this leads to loss of dependency information
when generating .bc files. To fix, add a rule that mirrors ad-hoc .o
dependencies for .bc files as well.

Per cfbot (no buildfarm failures reported)
Analysis by Tom Lane and Andres Freund
Proposed fix by Andres Freund
Discussion: https://www.postgresql.org/message-id/20220914210427.y26tkagmxo5wwbvp%40awork3.anarazel.de
2022-09-15 10:53:48 +07:00
Tom Lane 31dcfae83c Use the terminology "WAL file" not "log file" more consistently.
Referring to the WAL as just "log" invites confusion with the
postmaster log, so avoid doing that in docs and error messages.
Also shorten "WAL segment file" to just "WAL file" in various
places.

Bharath Rupireddy, reviewed by Nathan Bossart and Kyotaro Horiguchi

Discussion: https://postgr.es/m/CALj2ACUeXa8tDPaiTLexBDMZ7hgvaN+RTb957-cn5qwv9zf-MQ@mail.gmail.com
2022-09-14 18:40:58 -04:00
David Rowley 63840526b0 Fix outdated convert_saop_to_hashed_saop comment
In 29f45e299, we added support for optimizing the execution of NOT
IN(values) by using a hash table instead of a linear search over the
array.  That commit neglected to update the header comment for
convert_saop_to_hashed_saop() to mention this fact.  Here we fix that.

Author: James Coleman
Discussion: https://postgr.es/m/CAAaqYe99NUpAPcxgchGstgM23fmiGjqQPot8627YgkBgNt=BfA@mail.gmail.com
Backpatch-through: 15, where 29f45e299 was added.
2022-09-15 09:40:34 +12:00
Peter Eisentraut 111d954024 Small wording improvements 2022-09-14 22:56:55 +02:00
Tom Lane f40346ff0b Doc: add some doco about using the libpq_pipeline test module.
The README file here was barely a stub.  Try to make it useful.

Jelte Fennema, with some further work by me

Discussion: https://postgr.es/m/AM5PR83MB0178D3B31CA1B6EC4A8ECC42F7529@AM5PR83MB0178.EURPRD83.prod.outlook.com
2022-09-14 16:43:37 -04:00
Daniel Gustafsson 1d3566f1b2 pgcrypto: Remove unused code
The mbuf_tell, mbuf_rewind and pgp_get_cipher_name functions were
introduced in commit e94dd6ab91, but were never used, so remove.

Reviewed-by: Aleksander Alekseev <aleksander@timescale.com>
Discussion: https://postgr.es/m/FCF3F14E-17D5-41F2-AC58-0A97B341193A@yesql.se
2022-09-14 21:58:30 +02:00
Peter Eisentraut 5f84647ee1 Update .gitignore
Add entry for ab393528fa.  Remove one
obsolete entry.
2022-09-14 21:56:01 +02:00
Tom Lane b66fbd8afe Use SIGNAL_ARGS consistently to declare signal handlers.
Various bits of code were declaring signal handlers manually,
using "int signum" or variants of that.  We evidently have no
platforms where that's actually wrong, but let's use our
SIGNAL_ARGS macro everywhere anyway.  If nothing else, it's
good for finding signal handlers easily.

No need for back-patch, since this is just cosmetic AFAICS.

Discussion: https://postgr.es/m/2684964.1663167995@sss.pgh.pa.us
2022-09-14 14:44:50 -04:00
Peter Eisentraut ab393528fa Run xmllint validation only once
Before, each documentation target that built something from
postgres.sgml ran xmllint first to validate the input.  Here, we
change it so that the validation only runs once and produces an output
file, and all the other targets build from that output file.  This
avoids redundant work when building multiple documentation targets
(such as html and man).

Also, when we run xmllint, we can resolve entities (included files).
This helps with tools that don't support vpath builds, such as
dbtoepub.

All this also organizes the make targets a bit better for implementing
equivalent steps in meson.

Discussion: https://www.postgresql.org/message-id/e3ae16de-c9f9-f559-2d11-70b1342ae3d1@enterprisedb.com
2022-09-14 18:10:18 +02:00
Daniel Gustafsson 8b60db7743 Handle SIGTERM in pg_receivewal and pg_recvlogical
In pg_receivewal, compressed output is only flushed on clean exits.  The
reason to support SIGTERM as well as SIGINT (which is currently handled)
is that pg_receivewal might well be running as a daemon, and systemd's
default KillSignal is SIGTERM.

Since pg_recvlogical is also supposed to run as a daemon, teach it about
SIGTERM as well and update the documentation to match.  While in there,
change pg_receivewal's time_to_stop to be sig_atomic_t like it is in
pg_recvlogical.

Author: Christoph Berg <myon@debian.org>
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/Yvo/5No5S0c4EFMj@msg.df7cb.de
2022-09-14 16:32:24 +02:00
Alvaro Herrera 0e733278e3
Add subxid-overflow "isolation" test
This test covers a few lines of subxid-overflow-handling code in various
part of the backend, which are otherwise uncovered.

Author: Simon Riggs <simon.riggs@enterprisedb.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Discussion: https://postgr.es/m/CANbhV-H8ov5+nCMBYQFKhO+UZJjrFgY_ORiMWr3RhS4+x44PzA@mail.gmail.com
2022-09-14 16:10:01 +02:00