pgsql: Reject non-ASCII locale names.

2024-10-04 Thread Thomas Munro
Reject non-ASCII locale names. Commit bf03cfd1 started scanning all available BCP 47 locale names on Windows. This caused an abort/crash in the Windows runtime library if the default locale name contained non-ASCII characters, because of our use of the setlocale() save/restore pattern with "char"

pgsql: Reject non-ASCII locale names.

2024-10-04 Thread Thomas Munro
Reject non-ASCII locale names. Commit bf03cfd1 started scanning all available BCP 47 locale names on Windows. This caused an abort/crash in the Windows runtime library if the default locale name contained non-ASCII characters, because of our use of the setlocale() save/restore pattern with "char"

pgsql: Reject non-ASCII locale names.

2024-10-04 Thread Thomas Munro
Reject non-ASCII locale names. Commit bf03cfd1 started scanning all available BCP 47 locale names on Windows. This caused an abort/crash in the Windows runtime library if the default locale name contained non-ASCII characters, because of our use of the setlocale() save/restore pattern with "char"

Re: pgsql: Convert some extern variables to static

2024-09-19 Thread Thomas Munro
On Fri, Sep 20, 2024 at 11:15 AM Tom Lane wrote: > Peter Eisentraut writes: > > Convert some extern variables to static > > I'm surprised it took me so long to notice, but this commit > makes headerscheck unhappy: Also discussed at: https://www.postgresql.org/message-id/flat/CA%2BhUKG%2BYVt5MBD

pgsql: Allow ReadStream to be consumed as raw block numbers.

2024-09-17 Thread Thomas Munro
Allow ReadStream to be consumed as raw block numbers. Commits 041b9680 and 6377e12a changed the interface of scan_analyze_next_block() to take a ReadStream instead of a BlockNumber and a BufferAccessStrategy, and to return a value to indicate when the stream has run out of blocks. This caused int

pgsql: Allow ReadStream to be consumed as raw block numbers.

2024-09-17 Thread Thomas Munro
Allow ReadStream to be consumed as raw block numbers. Commits 041b9680 and 6377e12a changed the interface of scan_analyze_next_block() to take a ReadStream instead of a BlockNumber and a BufferAccessStrategy, and to return a value to indicate when the stream has run out of blocks. This caused int

pgsql: Standardize "read-ahead advice" terminology.

2024-09-03 Thread Thomas Munro
Standardize "read-ahead advice" terminology. Commit 6654bb920 added macOS's equivalent of POSIX_FADV_WILLNEED, and changed some explicit references to posix_fadvise to use this more general name for the concept. Update some remaining references. Reviewed-by: Peter Eisentraut Discussion: https:

pgsql: Fix unfairness in all-cached parallel seq scan.

2024-08-30 Thread Thomas Munro
Fix unfairness in all-cached parallel seq scan. Commit b5a9b18c introduced block streaming infrastructure with a special fast path for all-cached scans, and commit b7b0f3f2 connected the infrastructure up to sequential scans. One of the fast path micro-optimizations had an unintended consequence:

pgsql: Fix unfairness in all-cached parallel seq scan.

2024-08-30 Thread Thomas Munro
Fix unfairness in all-cached parallel seq scan. Commit b5a9b18c introduced block streaming infrastructure with a special fast path for all-cached scans, and commit b7b0f3f2 connected the infrastructure up to sequential scans. One of the fast path micro-optimizations had an unintended consequence:

pgsql: Stabilize 039_end_of_wal test.

2024-08-30 Thread Thomas Munro
Stabilize 039_end_of_wal test. The first test was sensitive to the insert LSN after setting up the catalogs, which depended on environmental things like the locales on the OS and usernames. Switch to a new WAL file before the first test, as a simple way to put every computer into the same state.

pgsql: Stabilize 039_end_of_wal test.

2024-08-30 Thread Thomas Munro
Stabilize 039_end_of_wal test. The first test was sensitive to the insert LSN after setting up the catalogs, which depended on environmental things like the locales on the OS and usernames. Switch to a new WAL file before the first test, as a simple way to put every computer into the same state.

pgsql: Stabilize 039_end_of_wal test.

2024-08-30 Thread Thomas Munro
Stabilize 039_end_of_wal test. The first test was sensitive to the insert LSN after setting up the catalogs, which depended on environmental things like the locales on the OS and usernames. Switch to a new WAL file before the first test, as a simple way to put every computer into the same state.

pgsql: Stabilize 039_end_of_wal test.

2024-08-30 Thread Thomas Munro
Stabilize 039_end_of_wal test. The first test was sensitive to the insert LSN after setting up the catalogs, which depended on environmental things like the locales on the OS and usernames. Switch to a new WAL file before the first test, as a simple way to put every computer into the same state.

pgsql: Stabilize 039_end_of_wal test.

2024-08-30 Thread Thomas Munro
Stabilize 039_end_of_wal test. The first test was sensitive to the insert LSN after setting up the catalogs, which depended on environmental things like the locales on the OS and usernames. Switch to a new WAL file before the first test, as a simple way to put every computer into the same state.

pgsql: Stabilize 039_end_of_wal test.

2024-08-30 Thread Thomas Munro
Stabilize 039_end_of_wal test. The first test was sensitive to the insert LSN after setting up the catalogs, which depended on environmental things like the locales on the OS and usernames. Switch to a new WAL file before the first test, as a simple way to put every computer into the same state.

pgsql: Stabilize 039_end_of_wal test.

2024-08-30 Thread Thomas Munro
Stabilize 039_end_of_wal test. The first test was sensitive to the insert LSN after setting up the catalogs, which depended on environmental things like the locales on the OS and usernames. Switch to a new WAL file before the first test, as a simple way to put every computer into the same state.

pgsql: Fix harmless LC_COLLATE[_MASK] confusion.

2024-08-19 Thread Thomas Munro
Fix harmless LC_COLLATE[_MASK] confusion. Commit ca051d8b101 called newlocale(LC_COLLATE, ...) instead of newlocale(LC_COLLATE_MASK, ...), in code reached only on FreeBSD. They have the same value on that OS, explaining why it worked. Fix. Back-patch to 14, where ca051d8b101 landed. Branch ---

pgsql: Fix harmless LC_COLLATE[_MASK] confusion.

2024-08-19 Thread Thomas Munro
Fix harmless LC_COLLATE[_MASK] confusion. Commit ca051d8b101 called newlocale(LC_COLLATE, ...) instead of newlocale(LC_COLLATE_MASK, ...), in code reached only on FreeBSD. They have the same value on that OS, explaining why it worked. Fix. Back-patch to 14, where ca051d8b101 landed. Branch ---

pgsql: Fix harmless LC_COLLATE[_MASK] confusion.

2024-08-19 Thread Thomas Munro
Fix harmless LC_COLLATE[_MASK] confusion. Commit ca051d8b101 called newlocale(LC_COLLATE, ...) instead of newlocale(LC_COLLATE_MASK, ...), in code reached only on FreeBSD. They have the same value on that OS, explaining why it worked. Fix. Back-patch to 14, where ca051d8b101 landed. Branch ---

pgsql: Fix harmless LC_COLLATE[_MASK] confusion.

2024-08-19 Thread Thomas Munro
Fix harmless LC_COLLATE[_MASK] confusion. Commit ca051d8b101 called newlocale(LC_COLLATE, ...) instead of newlocale(LC_COLLATE_MASK, ...), in code reached only on FreeBSD. They have the same value on that OS, explaining why it worked. Fix. Back-patch to 14, where ca051d8b101 landed. Branch ---

pgsql: Fix harmless LC_COLLATE[_MASK] confusion.

2024-08-19 Thread Thomas Munro
Fix harmless LC_COLLATE[_MASK] confusion. Commit ca051d8b101 called newlocale(LC_COLLATE, ...) instead of newlocale(LC_COLLATE_MASK, ...), in code reached only on FreeBSD. They have the same value on that OS, explaining why it worked. Fix. Back-patch to 14, where ca051d8b101 landed. Branch ---

pgsql: ci: Upgrade MacPorts version to 2.10.1.

2024-08-18 Thread Thomas Munro
ci: Upgrade MacPorts version to 2.10.1. MacPorts version 2.9.3 started failing in our ci_macports_packages.sh script, for reasons not fully determined, but plausibly linked to the release of 2.10.1. 2.10.1 seems to work, so let's switch to it. Back-patch to 15, where CI began. Reported-by: Pete

pgsql: ci: Upgrade MacPorts version to 2.10.1.

2024-08-18 Thread Thomas Munro
ci: Upgrade MacPorts version to 2.10.1. MacPorts version 2.9.3 started failing in our ci_macports_packages.sh script, for reasons not fully determined, but plausibly linked to the release of 2.10.1. 2.10.1 seems to work, so let's switch to it. Back-patch to 15, where CI began. Reported-by: Pete

pgsql: ci: Upgrade MacPorts version to 2.10.1.

2024-08-18 Thread Thomas Munro
ci: Upgrade MacPorts version to 2.10.1. MacPorts version 2.9.3 started failing in our ci_macports_packages.sh script, for reasons not fully determined, but plausibly linked to the release of 2.10.1. 2.10.1 seems to work, so let's switch to it. Back-patch to 15, where CI began. Reported-by: Pete

pgsql: ci: Upgrade MacPorts version to 2.10.1.

2024-08-18 Thread Thomas Munro
ci: Upgrade MacPorts version to 2.10.1. MacPorts version 2.9.3 started failing in our ci_macports_packages.sh script, for reasons not fully determined, but plausibly linked to the release of 2.10.1. 2.10.1 seems to work, so let's switch to it. Back-patch to 15, where CI began. Reported-by: Pete

pgsql: Fix cpluspluscheck for pg_verifybackup.h.

2024-08-18 Thread Thomas Munro
Fix cpluspluscheck for pg_verifybackup.h. simplehash.h references pg_fatal(), which cpluspluscheck says is undeclared, causing the CI CompilerWarnings task to fail since commit aa2d6b15. Include the header it needs. Discussion: https://postgr.es/m/CA%2BhUKGJC3d4PXkErpfOWrzQqcq6MLiCv0%2BAH0CMQnB

pgsql: Harmonize MinGW CODESET lookup with MSVC.

2024-08-13 Thread Thomas Munro
Harmonize MinGW CODESET lookup with MSVC. Historically, MinGW environments lacked some Windows API calls, so we took a different code path in win32_langinfo(). Somehow, the code change in commit 35eeea62 (removing setlocale() calls) caused one particular 001_initdb.pl test to fail on MinGW + ICU

pgsql: Include for macOS, take II.

2024-08-13 Thread Thomas Munro
Include for macOS, take II. Fix typo in macro name. Discussion: https://postgr.es/m/CA%2BhUKG%2Bk-o3N_SyNJNJpAcdtMo_HheN30miAeXehk9yw%3D9WYzA%40mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/2488058dc356a43455b21a099ea879fff9266634 Modified Files

pgsql: Include for older macOS.

2024-08-13 Thread Thomas Munro
Include for older macOS. Commit 35eeea62 forgot to include when using locale_t (which didn't seem to be required on newer Apple SDK as used by CI, hence mistake). Let's see if this fixes build farm animals longfin and sifika. Branch -- master Details --- https://git.postgresql.org/pg/

pgsql: All POSIX systems have langinfo.h and CODESET.

2024-08-13 Thread Thomas Munro
All POSIX systems have langinfo.h and CODESET. We don't need configure probes for HAVE_LANGINFO_H (it is implied by !WIN32), and we don't need to consider systems that have it but don't define CODESET (that was for OpenBSD in commit 81cca218, but it has now had it for 19 years). Reviewed-by: Heik

pgsql: Use thread-safe nl_langinfo_l(), not nl_langinfo().

2024-08-13 Thread Thomas Munro
Use thread-safe nl_langinfo_l(), not nl_langinfo(). This gets rid of some setlocale() calls. The remaining call to setlocale() in pg_get_encoding_from_locale() is a query of the name of the current locale when none was provided (in a multi-threaded future that would need more work). All known no

pgsql: Skip citext_utf8 test on Windows.

2024-08-01 Thread Thomas Munro
Skip citext_utf8 test on Windows. Back-patch of commit cff4e5a3 to 15 and 16, per request from Oleg Tselebrovskiy. Original commit message: 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

pgsql: Skip citext_utf8 test on Windows.

2024-08-01 Thread Thomas Munro
Skip citext_utf8 test on Windows. Back-patch of commit cff4e5a3 to 15 and 16, per request from Oleg Tselebrovskiy. Original commit message: 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

pgsql: Remove spinlocks and atomics from meson_options.txt.

2024-07-30 Thread Thomas Munro
Remove spinlocks and atomics from meson_options.txt. Commits e2562667 and 81385261 removed the configure equivalents, but forgot to remove these options from meson_options.txt. Revealed by the fact that build farm animals rorqual and francolin didn't fail, despite being configured to set those op

Re: pgsql: Remove --disable-spinlocks.

2024-07-30 Thread Thomas Munro
On Tue, Jul 30, 2024 at 11:09 PM Heikki Linnakangas wrote: > The SpinLockSemaArray field should be completely completely, nut just > the #ifndef guard around it. Looks like I had that right in the first version, but got confused while rebasing over a conflict. Fixed, thanks!

pgsql: Remove useless member of BackendParameters.

2024-07-30 Thread Thomas Munro
Remove useless member of BackendParameters. Oversight in e2562667, which stopped using SpinlockSemaArray but forgot to remove it from the array. Reported-by: Heikki Linnakangas Discussion: https://postgr.es/m/310f4005-91d7-42b2-ac70-92624260dd28%40iki.fi Branch -- master Details --- ht

pgsql: Remove --disable-spinlocks.

2024-07-30 Thread Thomas Munro
Remove --disable-spinlocks. A later change will require atomic support, so it wouldn't make sense for a hypothetical new system not to be able to implement spinlocks. Reviewed-by: Heikki Linnakangas Reviewed-by: Tom Lane (concept, not the patch) Reviewed-by: Andres Freund (concept, not the pat

pgsql: Require compiler barrier support.

2024-07-30 Thread Thomas Munro
Require compiler barrier support. Previously we had a fallback implementation of pg_compiler_barrier() that called an empty function across a translation unit boundary so the compiler couldn't see what it did. That shouldn't be needed on any current systems, and might not even work with a link ti

pgsql: Remove --disable-atomics, require 32 bit atomics.

2024-07-30 Thread Thomas Munro
Remove --disable-atomics, require 32 bit atomics. Modern versions of all relevant architectures and tool chains have atomics support. Since edadeb07, there is no remaining reason to carry code that simulates atomic flags and uint32 imperfectly with spinlocks. 64 bit atomics are still emulated wit

pgsql: Require memory barrier support.

2024-07-30 Thread Thomas Munro
Require memory barrier support. Previously we had a fallback implementation that made a harmless system call, based on the assumption that system calls must contain a memory barrier. That shouldn't be reached on any current system, and it seems highly likely that we can easily find out how to req

pgsql: ci: Pin MacPorts version to 2.9.3.

2024-07-24 Thread Thomas Munro
ci: Pin MacPorts version to 2.9.3. Commit d01ce180 invented a new way to find the latest MacPorts version. By bad luck, a new beta release has just been published, and it seems to lack some packages we need. Go back to searching for this specific version for now. We still search with a pattern s

pgsql: ci: Pin MacPorts version to 2.9.3.

2024-07-24 Thread Thomas Munro
ci: Pin MacPorts version to 2.9.3. Commit d01ce180 invented a new way to find the latest MacPorts version. By bad luck, a new beta release has just been published, and it seems to lack some packages we need. Go back to searching for this specific version for now. We still search with a pattern s

pgsql: ci: Pin MacPorts version to 2.9.3.

2024-07-24 Thread Thomas Munro
ci: Pin MacPorts version to 2.9.3. Commit d01ce180 invented a new way to find the latest MacPorts version. By bad luck, a new beta release has just been published, and it seems to lack some packages we need. Go back to searching for this specific version for now. We still search with a pattern s

pgsql: ci: Pin MacPorts version to 2.9.3.

2024-07-24 Thread Thomas Munro
ci: Pin MacPorts version to 2.9.3. Commit d01ce180 invented a new way to find the latest MacPorts version. By bad luck, a new beta release has just been published, and it seems to lack some packages we need. Go back to searching for this specific version for now. We still search with a pattern s

pgsql: ci: Upgrade macOS version from 13 to 14.

2024-07-24 Thread Thomas Munro
ci: Upgrade macOS version from 13 to 14. 1. Previously we were using ghcr.io/cirruslabs/macos-XXX-base:latest images, but Cirrus has started ignoring that and using a particular image, currently ghcr.io/cirruslabs/macos-runner:sonoma, for github accounts using free CI resources (as opposed to ded

pgsql: ci: Upgrade macOS version from 13 to 14.

2024-07-24 Thread Thomas Munro
ci: Upgrade macOS version from 13 to 14. 1. Previously we were using ghcr.io/cirruslabs/macos-XXX-base:latest images, but Cirrus has started ignoring that and using a particular image, currently ghcr.io/cirruslabs/macos-runner:sonoma, for github accounts using free CI resources (as opposed to ded

pgsql: ci: Upgrade macOS version from 13 to 14.

2024-07-24 Thread Thomas Munro
ci: Upgrade macOS version from 13 to 14. 1. Previously we were using ghcr.io/cirruslabs/macos-XXX-base:latest images, but Cirrus has started ignoring that and using a particular image, currently ghcr.io/cirruslabs/macos-runner:sonoma, for github accounts using free CI resources (as opposed to ded

pgsql: ci: Upgrade macOS version from 13 to 14.

2024-07-24 Thread Thomas Munro
ci: Upgrade macOS version from 13 to 14. 1. Previously we were using ghcr.io/cirruslabs/macos-XXX-base:latest images, but Cirrus has started ignoring that and using a particular image, currently ghcr.io/cirruslabs/macos-runner:sonoma, for github accounts using free CI resources (as opposed to ded

pgsql: Refactor tidstore.c iterator buffering.

2024-07-23 Thread Thomas Munro
Refactor tidstore.c iterator buffering. Previously, TidStoreIterateNext() would expand the set of offsets for each block into an internal buffer that it overwrote each time. In order to be able to collect the offsets for multiple blocks before working with them, change the contract. Now, the off

pgsql: Run LLVM verify pass on IR in assert builds.

2024-07-15 Thread Thomas Munro
Run LLVM verify pass on IR in assert builds. The problem fixed by commit 53c8d6c9 would have been noticed if we'd been running LLVM's verify pass on generated IR. Doing so also reveals a complaint about incorrect name mangling, fixed here. Only enabled for LLVM 17+ because it uses the new pass m

pgsql: Fix lost Windows socket EOF events.

2024-07-12 Thread Thomas Munro
Fix lost Windows socket EOF events. Winsock only signals an FD_CLOSE event once if the other end of the socket shuts down gracefully. Because each WaitLatchOrSocket() call constructs and destroys a new event handle every time, with unlucky timing we can lose it and hang. We get away with this on

pgsql: Fix lost Windows socket EOF events.

2024-07-12 Thread Thomas Munro
Fix lost Windows socket EOF events. Winsock only signals an FD_CLOSE event once if the other end of the socket shuts down gracefully. Because each WaitLatchOrSocket() call constructs and destroys a new event handle every time, with unlucky timing we can lose it and hang. We get away with this on

pgsql: Fix lost Windows socket EOF events.

2024-07-12 Thread Thomas Munro
Fix lost Windows socket EOF events. Winsock only signals an FD_CLOSE event once if the other end of the socket shuts down gracefully. Because each WaitLatchOrSocket() call constructs and destroys a new event handle every time, with unlucky timing we can lose it and hang. We get away with this on

pgsql: Fix lost Windows socket EOF events.

2024-07-12 Thread Thomas Munro
Fix lost Windows socket EOF events. Winsock only signals an FD_CLOSE event once if the other end of the socket shuts down gracefully. Because each WaitLatchOrSocket() call constructs and destroys a new event handle every time, with unlucky timing we can lose it and hang. We get away with this on

pgsql: Fix lost Windows socket EOF events.

2024-07-12 Thread Thomas Munro
Fix lost Windows socket EOF events. Winsock only signals an FD_CLOSE event once if the other end of the socket shuts down gracefully. Because each WaitLatchOrSocket() call constructs and destroys a new event handle every time, with unlucky timing we can lose it and hang. We get away with this on

pgsql: Fix lost Windows socket EOF events.

2024-07-12 Thread Thomas Munro
Fix lost Windows socket EOF events. Winsock only signals an FD_CLOSE event once if the other end of the socket shuts down gracefully. Because each WaitLatchOrSocket() call constructs and destroys a new event handle every time, with unlucky timing we can lose it and hang. We get away with this on

pgsql: Fix lost Windows socket EOF events.

2024-07-12 Thread Thomas Munro
Fix lost Windows socket EOF events. Winsock only signals an FD_CLOSE event once if the other end of the socket shuts down gracefully. Because each WaitLatchOrSocket() call constructs and destroys a new event handle every time, with unlucky timing we can lose it and hang. We get away with this on

pgsql: Disable clang 16's -Wcast-function-type-strict.

2024-07-11 Thread Thomas Munro
Disable clang 16's -Wcast-function-type-strict. This is a back-patch of commit 101c37cd into REL_14_STABLE and REL_15_STABLE. Those branches had commit de8feb1f3, which turned on -Wcast-function-type, but did not disable -Wcast-function-type-strict. This silences warnings about function pointer t

pgsql: Disable clang 16's -Wcast-function-type-strict.

2024-07-11 Thread Thomas Munro
Disable clang 16's -Wcast-function-type-strict. This is a back-patch of commit 101c37cd into REL_14_STABLE and REL_15_STABLE. Those branches had commit de8feb1f3, which turned on -Wcast-function-type, but did not disable -Wcast-function-type-strict. This silences warnings about function pointer t

Re: pgsql: Replace BackendIds with 0-based ProcNumbers

2024-07-09 Thread Thomas Munro
--- a/src/backend/libpq/pqmq.c +++ b/src/backend/libpq/pqmq.c @@ -26,7 +26,7 @@ static shm_mq_handle *pq_mq_handle; static bool pq_mq_busy = false; static pid_t pq_mq_parallel_leader_pid = 0; -static pid_t pq_mq_parallel_leader_backend_id = InvalidBackendId; +static pid_t pq_mq_parallel_leader_p

pgsql: Cope with name clashes.

2024-07-05 Thread Thomas Munro
Cope with name clashes. macOS 15's SDK pulls in headers related to when we include . This causes our own regex_t implementation to clash with the OS's regex_t implementation. Luckily our function names already had pg_ prefixes, but the macros and typenames did not. Include explicitly on all

pgsql: Cope with name clashes.

2024-07-05 Thread Thomas Munro
Cope with name clashes. macOS 15's SDK pulls in headers related to when we include . This causes our own regex_t implementation to clash with the OS's regex_t implementation. Luckily our function names already had pg_ prefixes, but the macros and typenames did not. Include explicitly on all

pgsql: Cope with name clashes.

2024-07-05 Thread Thomas Munro
Cope with name clashes. macOS 15's SDK pulls in headers related to when we include . This causes our own regex_t implementation to clash with the OS's regex_t implementation. Luckily our function names already had pg_ prefixes, but the macros and typenames did not. Include explicitly on all

pgsql: Cope with name clashes.

2024-07-05 Thread Thomas Munro
Cope with name clashes. macOS 15's SDK pulls in headers related to when we include . This causes our own regex_t implementation to clash with the OS's regex_t implementation. Luckily our function names already had pg_ prefixes, but the macros and typenames did not. Include explicitly on all

pgsql: Cope with name clashes.

2024-07-05 Thread Thomas Munro
Cope with name clashes. macOS 15's SDK pulls in headers related to when we include . This causes our own regex_t implementation to clash with the OS's regex_t implementation. Luckily our function names already had pg_ prefixes, but the macros and typenames did not. Include explicitly on all

pgsql: Cope with name clashes.

2024-07-05 Thread Thomas Munro
Cope with name clashes. macOS 15's SDK pulls in headers related to when we include . This causes our own regex_t implementation to clash with the OS's regex_t implementation. Luckily our function names already had pg_ prefixes, but the macros and typenames did not. Include explicitly on all

pgsql: Cope with name clashes.

2024-07-05 Thread Thomas Munro
Cope with name clashes. macOS 15's SDK pulls in headers related to when we include . This causes our own regex_t implementation to clash with the OS's regex_t implementation. Luckily our function names already had pg_ prefixes, but the macros and typenames did not. Include explicitly on all

pgsql: Add simple codepoint redirections to unaccent.rules.

2024-07-04 Thread Thomas Munro
Add simple codepoint redirections to unaccent.rules. Previously we searched for code points where the Unicode data file listed an equivalent combining character sequence that added accents. Some codepoints redirect to a single other codepoint, instead of doing any combining. We can follow those r

pgsql: Fix RBM_ZERO_AND_LOCK.

2024-06-09 Thread Thomas Munro
Fix RBM_ZERO_AND_LOCK. Commit 210622c6 accidentally zeroed out pages even if they were found in the buffer pool. It should always lock the page, but it should only zero pages that were not already valid. Otherwise, concurrent readers that hold only a pin could see corrupted page contents changin

pgsql: jit: Remove {llvm-config,clang}-N configure probes.

2024-05-15 Thread Thomas Munro
jit: Remove {llvm-config,clang}-N configure probes. Previously we searched for llvm-config-N and clang-N as well as the unversioned names, and maintained a list of expected values of N. There doesn't seem to be any reason to think that the default llvm-config and clang won't be good enough, and i

pgsql: Skip citext_utf8 test on Windows.

2024-05-12 Thread Thomas Munro
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 sophis

Re: pgsql: Fix potential stack overflow in incremental backup.

2024-04-10 Thread Thomas Munro
On Thu, Apr 11, 2024 at 2:28 PM Michael Paquier wrote: > + * file just as if this were not an incremental backup. The contents of the > + * relative_block_numbers array is unspecified in this case. > > Perhaps you mean s/is/are/ here? The contents are what's not > specified. Thanks, fixed. Duh

pgsql: Fix grammar.

2024-04-10 Thread Thomas Munro
Fix grammar. Reported-by: Michael Paquier Discussion: https://postgr.es/m/ZhdKqj5DwoOzirFv%40paquier.xyz Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/942219996c632ae9e66c2c4a759e93abc92014ff Modified Files -- src/backend/backup/basebackup_incrementa

pgsql: Fix potential stack overflow in incremental backup.

2024-04-10 Thread Thomas Munro
Fix potential stack overflow in incremental backup. The user can set RELSEG_SIZE to a high number at compile time, so we can't use it to control the size of an array on the stack: it could be many gigabytes in size. On closer inspection, we don't really need that intermediate array anyway. Let's

Re: pgsql: Refactor libpq state machine for negotiating encryption

2024-04-10 Thread Thomas Munro
On Thu, Apr 11, 2024 at 11:25 AM Tom Lane wrote: > Thomas Munro writes: > > If -Dssl=none and -Dgssapi=disabled, compilation of fe-connect.c > > fails: call to undeclared function 'encryption_negotiation_failed'. I > > didn't look too hard, but maybe ENABLE_G

Re: pgsql: Refactor libpq state machine for negotiating encryption

2024-04-10 Thread Thomas Munro
On Mon, Apr 8, 2024 at 1:25 PM Heikki Linnakangas wrote: > Refactor libpq state machine for negotiating encryption > > This fixes the few corner cases noted in commit 705843d294, as shown > by the changes in the test. > > Author: Heikki Linnakangas, Matthias van de Meent > Reviewed-by: Jacob Champ

pgsql: Fix illegal attribute propagation in LLVM JIT.

2024-04-09 Thread Thomas Munro
Fix illegal attribute propagation in LLVM JIT. Commit 72559438 started copying more attributes from AttributeTemplate to the functions we generate on the fly. In the case of deform functions, which return void, this meant that "noundef", from AttributeTemplate's return value (a Datum) was copied

pgsql: Fix illegal attribute propagation in LLVM JIT.

2024-04-09 Thread Thomas Munro
Fix illegal attribute propagation in LLVM JIT. Commit 72559438 started copying more attributes from AttributeTemplate to the functions we generate on the fly. In the case of deform functions, which return void, this meant that "noundef", from AttributeTemplate's return value (a Datum) was copied

pgsql: Fix illegal attribute propagation in LLVM JIT.

2024-04-09 Thread Thomas Munro
Fix illegal attribute propagation in LLVM JIT. Commit 72559438 started copying more attributes from AttributeTemplate to the functions we generate on the fly. In the case of deform functions, which return void, this meant that "noundef", from AttributeTemplate's return value (a Datum) was copied

pgsql: Fix illegal attribute propagation in LLVM JIT.

2024-04-09 Thread Thomas Munro
Fix illegal attribute propagation in LLVM JIT. Commit 72559438 started copying more attributes from AttributeTemplate to the functions we generate on the fly. In the case of deform functions, which return void, this meant that "noundef", from AttributeTemplate's return value (a Datum) was copied

pgsql: Fix illegal attribute propagation in LLVM JIT.

2024-04-09 Thread Thomas Munro
Fix illegal attribute propagation in LLVM JIT. Commit 72559438 started copying more attributes from AttributeTemplate to the functions we generate on the fly. In the case of deform functions, which return void, this meant that "noundef", from AttributeTemplate's return value (a Datum) was copied

pgsql: Fix illegal attribute propagation in LLVM JIT.

2024-04-09 Thread Thomas Munro
Fix illegal attribute propagation in LLVM JIT. Commit 72559438 started copying more attributes from AttributeTemplate to the functions we generate on the fly. In the case of deform functions, which return void, this meant that "noundef", from AttributeTemplate's return value (a Datum) was copied

Re: pgsql: Custom reloptions for table AM

2024-04-08 Thread Thomas Munro
Hi Alexander, I think this is uninitialised memory: ../pgsql/src/backend/postmaster/autovacuum.c:2988:33: runtime error: load of value 80, which is not a valid value for type '_Bool' #0 0x56010b3b6e47 in relation_needs_vacanalyze ../pgsql/src/backend/postmaster/autovacuum.c:2988 #1 0x5601

pgsql: Add pg_buffercache_evict() function for testing.

2024-04-07 Thread Thomas Munro
ikely be less flexible for actual testing work anyway. Superuser-only. Author: Palak Chaturvedi Author: Thomas Munro (docs, small tweaks) Reviewed-by: Nitin Jadhav Reviewed-by: Andres Freund Reviewed-by: Cary Huang Reviewed-by: Cédric Villemain Reviewed-by: Jim Nasby Reviewed-by: Maxim

pgsql: Use streaming I/O in ANALYZE.

2024-04-07 Thread Thomas Munro
Plageman Reviewed-by: Andres Freund Reviewed-by: Jakub Wartak Reviewed-by: Heikki Linnakangas Reviewed-by: Thomas Munro Discussion: https://postgr.es/m/flat/CAN55FZ0UhXqk9v3y-zW_fp4-WCp43V8y0A72xPmLkOM%2B6M%2BmJg%40mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg

pgsql: Use streaming I/O in sequential scans.

2024-04-07 Thread Thomas Munro
Use streaming I/O in sequential scans. Instead of calling ReadBuffer() for each block, heap sequential scans and TID range scans now use the streaming API introduced in b5a9b18cd0. Author: Melanie Plageman Reviewed-by: Andres Freund Reviewed-by: Thomas Munro Discussion: https://postgr.es/m

pgsql: Fix if/while thinko in read_stream.c edge case.

2024-04-06 Thread Thomas Munro
Fix if/while thinko in read_stream.c edge case. When we determine that a wanted block can't be combined with the current pending read, it's time to start that read to get it out of the way. An "if" in that code path should have been a "while", because it might take more than one go in case of par

pgsql: Allow BufferAccessStrategy to limit pin count.

2024-04-06 Thread Thomas Munro
Allow BufferAccessStrategy to limit pin count. While pinning extra buffers to look ahead, users of strategies are in danger of using too many buffers. For some strategies, that means "escaping" from the ring, and in others it means forcing dirty data to disk very frequently with associated WAL fl

pgsql: Increase default vacuum_buffer_usage_limit to 2MB.

2024-04-06 Thread Thomas Munro
Increase default vacuum_buffer_usage_limit to 2MB. The BAS_VACUUM ring size has been 256kB since commit d526575f introduced the mechanism 17 years ago. Commit 1cbbee03 recently made it configurable but retained the traditional default. The correct default size has been debated for years, but 256

pgsql: Improve read_stream.c's fast path.

2024-04-05 Thread Thomas Munro
Improve read_stream.c's fast path. The "fast path" for well cached scans that don't do any I/O was accidentally coded in a way that could only be triggered by pg_prewarm's usage pattern, which starts out with a higher distance because of the flags it passes in. We want it to work for streaming se

Re: pgsql: Implement pg_wal_replay_wait() stored procedure

2024-04-02 Thread Thomas Munro
On Wed, Apr 3, 2024 at 9:42 AM Alexander Korotkov wrote: > On Tue, Apr 2, 2024 at 10:58 PM Alexander Korotkov > wrote: > > Implement pg_wal_replay_wait() stored procedure > > I'm trying to figure out if this failure could be related to this commit... > https://buildfarm.postgresql.org/cgi-bin/sho

pgsql: Provide vectored variant of ReadBuffer().

2024-04-02 Thread Thomas Munro
advice and leaving WaitReadBuffers() to do the work synchronously. Author: Thomas Munro Author: Andres Freund (some optimization tweaks) Reviewed-by: Melanie Plageman Reviewed-by: Heikki Linnakangas Reviewed-by: Nazir Bilal Yavuz Reviewed-by: Dilip Kumar Reviewed-by: Andres Freund Tested-by

pgsql: Provide API for streaming relation data.

2024-04-02 Thread Thomas Munro
patterns involving predictable access to a single fork of a single relation. Several patches using this API are proposed separately. This stream concept is loosely based on ideas from Andres Freund on how we should pave the way for later work on asynchronous I/O. Author: Thomas Munro Author

pgsql: Use streaming I/O in pg_prewarm.

2024-04-02 Thread Thomas Munro
Use streaming I/O in pg_prewarm. Instead of calling ReadBuffer() repeatedly, use the new streaming interface. This commit provides a very simple example of such a transformation. Discussion: https://postgr.es/m/CA+hUKGJkOiOCa+mag4BF+zHo7qo=o9CFheB8=g6ut5tum2g...@mail.gmail.com Branch -- ma

pgsql: ci: Use a RAM disk and more CPUs on FreeBSD.

2024-03-12 Thread Thomas Munro
ci: Use a RAM disk and more CPUs on FreeBSD. Run the tests in a RAM disk. It's still a UFS file system and is backed by 20GB of disk, but this avoids a lot of I/O. Even though we disable fsync, our tests do a lot of directory manipulations, some of which force file system meta-data to disk and f

pgsql: Add --copy-file-range option to pg_upgrade.

2024-03-05 Thread Thomas Munro
Add --copy-file-range option to pg_upgrade. The copy_file_range() system call is available on at least Linux and FreeBSD, and asks the kernel to use efficient ways to copy ranges of a file. Options available to the kernel include sharing block ranges (similar to --clone mode), and pushing down bl

pgsql: Fix overflow in Windows replacement pg_pread/pg_pwrite.

2024-03-02 Thread Thomas Munro
Fix overflow in Windows replacement pg_pread/pg_pwrite. When calling the Windows file I/O APIs there is an implicit conversion from size_t to DWORD, which could overflow. Clamp the size at 1GB to avoid that. Not a really a live bug as we don't expect anything in PostgreSQL to call with such larg

pgsql: Return ssize_t in fd.c I/O functions.

2024-03-01 Thread Thomas Munro
Return ssize_t in fd.c I/O functions. In the past, FileRead() and FileWrite() used types based on the Unix read() and write() functions from before C and POSIX standardization, though not exactly (we had int for amount instead of unsigned). In commit 2d4f1ba6 we changed to the appropriate standar

pgsql: Fix gai_strerror() thread-safety on Windows.

2024-02-11 Thread Thomas Munro
Fix gai_strerror() thread-safety on Windows. Commit 5579388d removed code that supplied a fallback implementation of getaddrinfo(), which was dead code on modern systems. One tiny piece of the removed code was still doing something useful on Windows, though: that OS's own gai_strerror()/gai_strer

pgsql: Fix gai_strerror() thread-safety on Windows.

2024-02-11 Thread Thomas Munro
Fix gai_strerror() thread-safety on Windows. Commit 5579388d removed code that supplied a fallback implementation of getaddrinfo(), which was dead code on modern systems. One tiny piece of the removed code was still doing something useful on Windows, though: that OS's own gai_strerror()/gai_strer

  1   2   3   4   5   6   7   8   9   10   >