pgsql: pg_restore cleanups

2025-04-16 Thread Andrew Dunstan
pg_restore cleanups . remove unnecessary oid_string list stuff . use pg_get_line_buf() instead of open-coding it . cleaner parsing of map.dat lines Reverts 2b69afbe50d add new list type simple_oid_string_list to fe-utils/simple_list Author: Álvaro Herrera Author: Andrew Dunstan Discussion

pgsql: Make AIO error test more portable

2025-04-13 Thread Andrew Dunstan
Make AIO error test more portable Alpine Linux's C library (musl) spells one error message differently. Reported-by: Wolfgang Walther Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/64e193f5dda2075ecc6356625992e190a4347df6 Modified Files -- src/test/mo

pgsql: Free memory properly in pg_restore.c

2025-04-12 Thread Andrew Dunstan
Free memory properly in pg_restore.c Thinko in commit 39729ec01d2. Mea maxima culpa. Per Mahendra Singh Thalor Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/f09088a01d3372fdfe5da12dd0b2e24989f0caa6 Modified Files -- src/bin/pg_dump/pg_restore.c | 2

Re: pgsql: Fix fat fingering in 22cb6d28950

2025-04-12 Thread Andrew Dunstan
On 2025-04-11 Fr 3:24 PM, Mahendra Singh Thalor wrote: On Fri, 11 Apr 2025 at 04:38, Andrew Dunstan wrote: > > Fix fat fingering in 22cb6d28950 > > Per Rainier Vilela > > Branch > -- > master > > Details > --- > http

pgsql: Fix fat fingering in 22cb6d28950

2025-04-10 Thread Andrew Dunstan
Fix fat fingering in 22cb6d28950 Per Rainier Vilela Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/39729ec01d25dbe12e0dd8322c68f242650235c9 Modified Files -- src/bin/pg_dump/pg_restore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)

pgsql: Fix memory leak in pg_restore.c

2025-04-10 Thread Andrew Dunstan
Fix memory leak in pg_restore.c Oversight in 1495eff7bdb Author: Ranier Vilela Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/22cb6d289500ef22163a9d7cf2afa496f41b4d4c Modified Files -- src/bin/pg_dump/pg_restore.c | 2 ++ 1 file changed, 2 insertions(

pgsql: Further cleanup for directory creation on pg_dump/pg_dumpall

2025-04-10 Thread Andrew Dunstan
Further cleanup for directory creation on pg_dump/pg_dumpall Instead of two separate (and different) implementations, refactor to use a single common routine. Along the way, remove use of a hardcoded file permissions constant in favor of the common project setting for directory creation. Author:

pgsql: Clean up error messages from 1495eff7bdb

2025-04-07 Thread Andrew Dunstan
Clean up error messages from 1495eff7bdb Quote file names, and mostly avoid hard coded file names. Along the way make a few other minor improvements. Discussion: https://postgr.es/m/20250407.152721.1397761902317499205.horikyota@gmail.com Branch -- master Details --- https://git.pos

pgsql: Revert "Use workaround of __builtin_setjmp only on MINGW on MSVC

2025-04-07 Thread Andrew Dunstan
Revert "Use workaround of __builtin_setjmp only on MINGW on MSVCRT" This reverts commit c313fa4602defe1be947370ab5b217ca163a1e3c. This is found to cause issues on x86_64 Windows even when using UCRT. Discussion: https://postgr.es/m/3312149.1744001...@sss.pgh.pa.us Branch -- master Details

pgsql: Clean up checking for pg_dumpall output directory

2025-04-06 Thread Andrew Dunstan
Clean up checking for pg_dumpall output directory Coverity objected to the original code, and in any case this is much cleaner, using the existing routine pg_check_dir() instead of rolling its own test. Per suggestion from Tom Lane. Branch -- master Details --- https://git.postgresql.or

pgsql: Avoid unnecessary copying of a string in pg_restore.c

2025-04-06 Thread Andrew Dunstan
Avoid unnecessary copying of a string in pg_restore.c Coverity complained about a possible overrun in the copy, but there is no actual need to copy the string at all. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/5e1915439085014140314979c4dd5e23bd677cac Modified

pgsql: Fix a couple of memory leaks in pg_restore.c

2025-04-06 Thread Andrew Dunstan
Fix a couple of memory leaks in pg_restore.c per complaint from Coverity. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/6d5417e634b3841dcc44bdb43f5586bcde33ddb4 Modified Files -- src/bin/pg_dump/pg_restore.c | 4 1 file changed, 4 insertions(+)

pgsql: Show plperl version in the meson setup summary.

2025-04-05 Thread Andrew Dunstan
Show plperl version in the meson setup summary. Also, use perl 'version' instead of 'api_versionstring' to sync with the configure script. Author: Roman Zharkov Discussion: https://postgr.es/m/93e7f77bf4e1ef4640e4ee733f9e2...@postgrespro.ru Branch -- master Details --- https://git.pos

pgsql: Clean up from commit 1495eff7bdb

2025-04-05 Thread Andrew Dunstan
Clean up from commit 1495eff7bdb Fix some comments, and remove the hacky way of quoting database names in favor of appendStringLiteralConn. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/5db3bf7391d77ae86bc9b5f580141e022803b744 Modified Files -- src/bi

pgsql: Fix a couple of error messages and tests for them

2025-04-04 Thread Andrew Dunstan
Fix a couple of error messages and tests for them oversights in 1495eff7bdb and 289f74d0cb2. Mea culpa. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/2ef57908067ab29c22ae13f7775fe2afc330e8f6 Modified Files -- src/bin/pg_dump/pg_restore.c| 6 ++

Re: pgsql: Add more TAP tests for pg_dumpall

2025-04-04 Thread Andrew Dunstan
On 2025-04-04 Fr 4:09 PM, Andrew Dunstan wrote: Add more TAP tests for pg_dumpall I changed an error message at the last moment and forgot to fix the test ... will fix cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com

pgsql: Non text modes for pg_dumpall, correspondingly change pg_restore

2025-04-04 Thread Andrew Dunstan
database(s) in the same way the same option works in pg_dumpall. Author: Mahendra Singh Thalor Co-authored-by: Andrew Dunstan Reviewed-by: jian he Reviewed-by: Srinath Reddy Reviewed-by: Álvaro Herrera Discussion: https://postgr.es/m/cb103623-8ee6-4ba5-a2c9-f32e3a493...@dunslane.net Branch

pgsql: Add more TAP tests for pg_dumpall

2025-04-04 Thread Andrew Dunstan
Add more TAP tests for pg_dumpall Author: Matheus Alcantara Author: Mahendra Singh Thalor Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/289f74d0cb247ebdb443fec65fb2500531c961b4 Modified Files -- src/bin/pg_dump/meson.build | 1 + src/bin/pg

pgsql: add new list type simple_oid_string_list to fe-utils/simple_list

2025-04-04 Thread Andrew Dunstan
add new list type simple_oid_string_list to fe-utils/simple_list This type contains both an oid and a string. This will be used in forthcoming changes to pg_restore. Author: Andrew Dunstan Branch -- master Details --- https://git.postgresql.org/pg/commitdiff

pgsql: Move common pg_dump code related to connections to a new file

2025-04-04 Thread Andrew Dunstan
Move common pg_dump code related to connections to a new file ConnectDatabase is used by pg_dumpall, pg_restore and pg_dump so move common code to new file. new file name: connectdb.c Author:Mahendra Singh Thalor Branch -- master Details --- https://git.postgresql.org/pg/commitdif

pgsql: Use workaround of __builtin_setjmp only on MINGW on MSVCRT

2025-04-01 Thread Andrew Dunstan
Use workaround of __builtin_setjmp only on MINGW on MSVCRT MSVCRT is not present Windows/ARM64 and the workaround is not necessary on any UCRT based toolchain. Author: Lars Kanis Discussion: https://postgr.es/m/cahxcyb2ojnhtogvkyxtxmw4b3buxwjx6m-lcp1kcmcrumlo...@mail.gmail.com Branch -- m

pgsql: Silence perl critic

2025-03-15 Thread Andrew Dunstan
Silence perl critic Commit 27bdec06841 uses a loop variable that is not strictly local to the loop. Perlcritic disapproves, and there's really no reason as the variable is not used outside the loop. Per buildfarm animals koel and crake. Branch -- master Details --- https://git.postgresq

Re: pgsql: tests: Fix race condition in postmaster/002_connection_limits

2025-03-11 Thread Andrew Dunstan
It's adding an SQL ERRCODE to the DEBUG string. cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com

pgsql: Further fix for json_strip_nulls documentation

2025-03-06 Thread Andrew Dunstan
Further fix for json_strip_nulls documentation Oversight in commit 4603903d294. Author: Shinoda, Noriyoshi (SXD Japan FSI) Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/e33969abc1934cc7fd92d539e51a2b8ae46d6a33 Modified Files -- doc/src/sgml/func.sgm

pgsql: Remove extraneous commas in json{b}_strip_nulls documentation

2025-03-06 Thread Andrew Dunstan
Remove extraneous commas in json{b}_strip_nulls documentation Oversight in commit 4603903d294. Author: Ian Lawrence Barwick Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/0e76f253f4f0bf3d8a85e88dbea62a09be1f3ff8 Modified Files -- doc/src/sgml/func.sg

pgsql: Allow json{b}_strip_nulls to remove null array elements

2025-03-05 Thread Andrew Dunstan
Allow json{b}_strip_nulls to remove null array elements An additional paramater ("strip_in_arrays") is added to these functions. It defaults to false. If true, then null array elements are removed as well as null valued object fields. JSON that just consists of a single null is not affected. Auth

Re: pgsql: Refactor COPY FROM to use format callback functions.

2025-02-28 Thread Andrew Dunstan
() { ... } Agreed. I've updated the patch. I'm going to push it, barring any objections and further comments. I'm OK either way - I have made changes to adapt to the API change, and tested them. cheers andrew -- Andrew Dunstan EDB:https://www.enterprisedb.com

Re: pgsql: Refactor COPY FROM to use format callback functions.

2025-02-28 Thread Andrew Dunstan
On 2025-02-28 Fr 2:55 PM, Masahiko Sawada wrote: On Fri, Feb 28, 2025 at 11:47 AM Andrew Dunstan wrote: On 2025-02-28 Fr 1:31 PM, Masahiko Sawada wrote: Refactor COPY FROM to use format callback functions. This commit introduces a new CopyFromRoutine struct, which is a set of callback

Re: pgsql: Trial fix for old cross-version upgrades.

2025-02-28 Thread Andrew Dunstan
;version',) '\d+'::integer,$} Just noting here that \s{1} is simply the same as \s cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com

Re: pgsql: Refactor COPY FROM to use format callback functions.

2025-02-28 Thread Andrew Dunstan
eviewed-by: Junwang Zhao Discussion:https://postgr.es/m/20231204.153548.2126325458835528809@clear-code.com This patch has completely broken the file_textarray fdw, which uses NextCopyFromRawFields(). Removing that from API is not a good thing. cheers andrew -- Andrew Dunstan

Re: pgsql: Trial fix for old cross-version upgrades.

2025-02-23 Thread Andrew Dunstan
That's darn ugly, and I suspect the implementation will be messy, but do we have another way? Having slept on it I can't see anything better. It's only for very old branches, and nothing is really going wrong here, so ignoring the difference seems quite reasonable. cheers andrew -- Andrew Dunstan EDB:https://www.enterprisedb.com

Re: pgsql: Trial fix for old cross-version upgrades.

2025-02-22 Thread Andrew Dunstan
On 2025-02-22 Sa 1:34 PM, Tom Lane wrote: Andrew Dunstan writes: On 2025-02-21 Fr 10:11 PM, Tom Lane wrote: ... It seems there is something different between what TestUpgradeXversion.pm is doing and what 002_pg_upgrade.pl is doing. No clue what, although it does look like an additional

Re: pgsql: Trial fix for old cross-version upgrades.

2025-02-22 Thread Andrew Dunstan
thinking of doing is running all the eligible upgrades rather than stopping on the first failure. cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com

Re: pgsql: Transfer statistics during pg_upgrade.

2025-02-21 Thread Andrew Dunstan
usage. At best it is jarring. One does not normally follow "mutually exclusive" with a preposition. I would replace the these with something like "This option cannot be used with ...". If you want to use the phrase, it should be something like "This option and ... are mutual

pgsql: Ignore blank lines in pgindent exclude files

2025-02-20 Thread Andrew Dunstan
Ignore blank lines in pgindent exclude files Currently a blank line matches everything, which is almost never what someone would want. If they really want that they can use a wildcard regex to do it. Author: Zsolt Parragi Discussion: https://postgr.es/m/CAN4CZFNka+2q3=-dithr4w65rjfwpav92t62spe

pgsql: Be clearer about when jsonapi's need_escapes is needed

2025-01-19 Thread Andrew Dunstan
Be clearer about when jsonapi's need_escapes is needed Most operations beyond pure json parsing need to set need_escapes to true to get access to field names and string scalars. Document this fact more explicitly. Slightly tweaked patch from: Author: Corey Huinker Discussion: https://postgr.e

pgsql: Fix readlink() for non-PostgreSQL junction points on Windows.

2025-01-18 Thread Andrew Dunstan
Fix readlink() for non-PostgreSQL junction points on Windows. Since commit c5cb8f3b taught stat() to follow symlinks, and since initdb uses pg_mkdir_p(), and that examines parent directories, our humble readlink() implementation can now be exposed to junction points not of PostgreSQL origin. Thos

pgsql: Fix stat() for recursive junction points on Windows.

2025-01-18 Thread Andrew Dunstan
Fix stat() for recursive junction points on Windows. Commit c5cb8f3b supposed that we'd only ever have to follow one junction point in stat(), because we don't construct longer chains of them ourselves. When examining a parent directory supplied by the user, we should really be able to cope with l

pgsql: Fix stat() for recursive junction points on Windows.

2025-01-18 Thread Andrew Dunstan
Fix stat() for recursive junction points on Windows. Commit c5cb8f3b supposed that we'd only ever have to follow one junction point in stat(), because we don't construct longer chains of them ourselves. When examining a parent directory supplied by the user, we should really be able to cope with l

pgsql: Fix readlink() for non-PostgreSQL junction points on Windows.

2025-01-18 Thread Andrew Dunstan
Fix readlink() for non-PostgreSQL junction points on Windows. Since commit c5cb8f3b taught stat() to follow symlinks, and since initdb uses pg_mkdir_p(), and that examines parent directories, our humble readlink() implementation can now be exposed to junction points not of PostgreSQL origin. Thos

pgsql: Fix stat() for recursive junction points on Windows.

2025-01-18 Thread Andrew Dunstan
Fix stat() for recursive junction points on Windows. Commit c5cb8f3b supposed that we'd only ever have to follow one junction point in stat(), because we don't construct longer chains of them ourselves. When examining a parent directory supplied by the user, we should really be able to cope with l

pgsql: Fix readlink() for non-PostgreSQL junction points on Windows.

2025-01-18 Thread Andrew Dunstan
Fix readlink() for non-PostgreSQL junction points on Windows. Since commit c5cb8f3b taught stat() to follow symlinks, and since initdb uses pg_mkdir_p(), and that examines parent directories, our humble readlink() implementation can now be exposed to junction points not of PostgreSQL origin. Thos

pgsql: Set exit status for pgindent if pg_bsd_indent fails

2025-01-08 Thread Andrew Dunstan
Set exit status for pgindent if pg_bsd_indent fails Also document the exit codes in the script. The new exit code is 3, and is not overridden by the exit code set in --check mode. Author: Ashutosh Bapat Discussion: https://postgr.es/m/caexhw5sprsifeldp-u1fa5ba7ys2f0gvljmkoobopkadjwq...@mail.gm

pgsql: Document strange jsonb sort order for empty top level arrays

2025-01-03 Thread Andrew Dunstan
Document strange jsonb sort order for empty top level arrays Slightly faulty logic in the original jsonb code (commit d9134d0a355) results in an empty top level array sorting less than a json null. We can't change the sort order now since it would affect btree indexes over jsonb, so document the a

pgsql: Document strange jsonb sort order for empty top level arrays

2025-01-03 Thread Andrew Dunstan
Document strange jsonb sort order for empty top level arrays Slightly faulty logic in the original jsonb code (commit d9134d0a355) results in an empty top level array sorting less than a json null. We can't change the sort order now since it would affect btree indexes over jsonb, so document the a

pgsql: Document strange jsonb sort order for empty top level arrays

2025-01-03 Thread Andrew Dunstan
Document strange jsonb sort order for empty top level arrays Slightly faulty logic in the original jsonb code (commit d9134d0a355) results in an empty top level array sorting less than a json null. We can't change the sort order now since it would affect btree indexes over jsonb, so document the a

pgsql: Document strange jsonb sort order for empty top level arrays

2025-01-03 Thread Andrew Dunstan
Document strange jsonb sort order for empty top level arrays Slightly faulty logic in the original jsonb code (commit d9134d0a355) results in an empty top level array sorting less than a json null. We can't change the sort order now since it would affect btree indexes over jsonb, so document the a

pgsql: Document strange jsonb sort order for empty top level arrays

2025-01-03 Thread Andrew Dunstan
Document strange jsonb sort order for empty top level arrays Slightly faulty logic in the original jsonb code (commit d9134d0a355) results in an empty top level array sorting less than a json null. We can't change the sort order now since it would affect btree indexes over jsonb, so document the a

pgsql: Document strange jsonb sort order for empty top level arrays

2025-01-03 Thread Andrew Dunstan
Document strange jsonb sort order for empty top level arrays Slightly faulty logic in the original jsonb code (commit d9134d0a355) results in an empty top level array sorting less than a json null. We can't change the sort order now since it would affect btree indexes over jsonb, so document the a

pgsql: jsonapi: add lexer option to keep token ownership

2024-11-27 Thread Andrew Dunstan
jsonapi: add lexer option to keep token ownership Commit 0785d1b8b adds support for libpq as a JSON client, but allocations for string tokens can still be leaked during parsing failures. This is tricky to fix for the object_field semantic callbacks: the field name must remain valid until the end o

pgsql: Fix meson uuid header check so it works with MSVC

2024-11-26 Thread Andrew Dunstan
Fix meson uuid header check so it works with MSVC The OSSP uuid.h file includes unistd.h, so to use it with MSVC we need to include the postgres include directories so it picks up our version of that in src/include/port/win32_msvc. Adjust the meson test accordingly. Backported from commit 7c655a0

Re: pgsql: Release notes for 17.1, 16.5, 15.9, 14.14, 13.17, 12.21.

2024-11-10 Thread Andrew Dunstan
On Mon, Nov 11, 2024 at 10:25 AM Andrew Dunstan wrote: > > > On Mon, Nov 11, 2024 at 5:11 AM Tom Lane wrote: > >> Release notes for 17.1, 16.5, 15.9, 14.14, 13.17, 12.21. >> >> Branch >> -- >> REL_17_STABLE >> >> Details >

Re: pgsql: Release notes for 17.1, 16.5, 15.9, 14.14, 13.17, 12.21.

2024-11-10 Thread Andrew Dunstan
On Mon, Nov 11, 2024 at 5:11 AM Tom Lane wrote: > Release notes for 17.1, 16.5, 15.9, 14.14, 13.17, 12.21. > > Branch > -- > REL_17_STABLE > > Details > --- > > https://git.postgresql.org/pg/commitdiff/ca19f881b071fa57ee469fbc27b520fbb0c67280 > > Modified Files > -- > doc/src/

Re: pgsql: Fix our Windows stat() emulation to handle file sizes > 4GB.

2024-11-09 Thread Andrew Dunstan
On Sat, Nov 9, 2024 at 11:20 AM Thomas Munro wrote: > On Sat, Nov 9, 2024 at 9:30 AM Andrew Dunstan wrote: > > My impression was that this was something we just didn't get around to. > I wouldn't have pushed these so close to release if this hadn't been code > alr

Re: pgsql: Fix our Windows stat() emulation to handle file sizes > 4GB.

2024-11-08 Thread Andrew Dunstan
On Sat, Nov 9, 2024 at 2:33 AM Tom Lane wrote: > Robert Haas writes: > > On Thu, Nov 7, 2024 at 6:19 PM Andrew Dunstan > wrote: > >> Juan José Santamaría Flecha, reviewed by Emil Iggland; > >> based on prior work by Michael Paquier, Sergey Zubkovsky, and others &g

Re: pgsql: Fix our Windows stat() emulation to handle file sizes > 4GB.

2024-11-08 Thread Andrew Dunstan
On Sat, Nov 9, 2024 at 6:11 AM Tom Lane wrote: > I wrote: > > I'm also confused about how to document them in the release notes. > > Alexandra should get some credit I guess for collecting and testing > > the patches, but she's not the original author(s). > > After thinking for awhile, I'm going

pgsql: Provide lstat() for Windows.

2024-11-07 Thread Andrew Dunstan
Provide lstat() for Windows. Junction points will be reported with S_ISLNK(x.st_mode), simulating POSIX lstat(). stat() will follow pseudo-symlinks, like in POSIX (but only one level before giving up, unlike in POSIX). This completes a TODO left by commit bed90759fcb. Tested-by: Andrew Dunstan

pgsql: Fix lstat() for broken junction points on Windows.

2024-11-07 Thread Andrew Dunstan
Fix lstat() for broken junction points on Windows. When using junction points to emulate symlinks on Windows, one edge case was not handled correctly by commit c5cb8f3b: if a junction point is broken (pointing to a non-existent path), we'd report ENOENT. This doesn't break any known use case, but

pgsql: Provide lstat() for Windows.

2024-11-07 Thread Andrew Dunstan
Provide lstat() for Windows. Junction points will be reported with S_ISLNK(x.st_mode), simulating POSIX lstat(). stat() will follow pseudo-symlinks, like in POSIX (but only one level before giving up, unlike in POSIX). This completes a TODO left by commit bed90759fcb. Tested-by: Andrew Dunstan

pgsql: Check for STATUS_DELETE_PENDING on Windows.

2024-11-07 Thread Andrew Dunstan
Check for STATUS_DELETE_PENDING on Windows. 1. Update our open() wrapper to check for NT's STATUS_DELETE_PENDING and translate it to Unix-like errors. This is done with RtlGetLastNtStatus(), which is dynamically loaded from ntdll. A new file win32ntdll.c centralizes lookup of NT functions, in c

pgsql: Fix issues with Windows' stat() for files pending on deletion

2024-11-07 Thread Andrew Dunstan
Fix issues with Windows' stat() for files pending on deletion The code introduced by bed9075 to enhance the stat() implementation on Windows for file sizes larger than 4GB fails to properly detect files pending for deletion with its method based on NtQueryInformationFile() or GetFileInformationByH

pgsql: Replace pgwin32_is_junction() with lstat().

2024-11-07 Thread Andrew Dunstan
was done because lstat() didn't previously work for symlinks (junction points), but now it does. Tested-by: Andrew Dunstan Discussion: https://postgr.es/m/CA%2BhUKGLfOOeyZpm5ByVcAt7x5Pn-%3DxGRNCvgiUPVVzjFLtnY0w%40mail.gmail.com (cherry picked from commit 5fc88c5d53e43fa7dcea93499d230a0bf70

pgsql: Make unlink() work for junction points on Windows.

2024-11-07 Thread Andrew Dunstan
Make unlink() work for junction points on Windows. To support harmonization of Windows and Unix code, teach our unlink() wrapper that junction points need to be unlinked with rmdir() on Windows. Tested-by: Andrew Dunstan Discussion: https://postgr.es/m/CA%2BhUKGLfOOeyZpm5ByVcAt7x5Pn

pgsql: Make unlink() work for junction points on Windows.

2024-11-07 Thread Andrew Dunstan
Make unlink() work for junction points on Windows. To support harmonization of Windows and Unix code, teach our unlink() wrapper that junction points need to be unlinked with rmdir() on Windows. Tested-by: Andrew Dunstan Discussion: https://postgr.es/m/CA%2BhUKGLfOOeyZpm5ByVcAt7x5Pn

pgsql: Add missing include guard to win32ntdll.h.

2024-11-07 Thread Andrew Dunstan
Add missing include guard to win32ntdll.h. Oversight in commit e2f0f8ed. Also add this file to the exclusion lists in headerscheck and cpluscpluscheck, because Unix systems don't have a header it includes. Reported-by: Tom Lane Discussion: https://postgr.es/m/2760528.1641929756%40sss.pgh.pa.us

pgsql: Fix lstat() for broken junction points on Windows.

2024-11-07 Thread Andrew Dunstan
Fix lstat() for broken junction points on Windows. When using junction points to emulate symlinks on Windows, one edge case was not handled correctly by commit c5cb8f3b: if a junction point is broken (pointing to a non-existent path), we'd report ENOENT. This doesn't break any known use case, but

pgsql: Provide lstat() for Windows.

2024-11-07 Thread Andrew Dunstan
Provide lstat() for Windows. Junction points will be reported with S_ISLNK(x.st_mode), simulating POSIX lstat(). stat() will follow pseudo-symlinks, like in POSIX (but only one level before giving up, unlike in POSIX). This completes a TODO left by commit bed90759fcb. Tested-by: Andrew Dunstan

pgsql: Add missing include guard to win32ntdll.h.

2024-11-07 Thread Andrew Dunstan
Add missing include guard to win32ntdll.h. Oversight in commit e2f0f8ed. Also add this file to the exclusion lists in headerscheck and cpluscpluscheck, because Unix systems don't have a header it includes. Reported-by: Tom Lane Discussion: https://postgr.es/m/2760528.1641929756%40sss.pgh.pa.us

pgsql: Fix -Wcast-function-type warnings

2024-11-07 Thread Andrew Dunstan
Fix -Wcast-function-type warnings Three groups of issues needed to be addressed: load_external_function() and related functions returned PGFunction, even though not necessarily all callers are looking for a function of type PGFunction. Since these functions are really just wrappers around dlsym(

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

2024-11-07 Thread Andrew Dunstan
Disable clang 16's -Wcast-function-type-strict. Clang 16 is still in development, but seawasp reveals that it has started warning about many of our casts of function pointers (those introduced by commit 1c27d16e, and some older ones). Disable the new warning for now, since otherwise buildfarm ani

pgsql: Check for STATUS_DELETE_PENDING on Windows.

2024-11-07 Thread Andrew Dunstan
Check for STATUS_DELETE_PENDING on Windows. 1. Update our open() wrapper to check for NT's STATUS_DELETE_PENDING and translate it to Unix-like errors. This is done with RtlGetLastNtStatus(), which is dynamically loaded from ntdll. A new file win32ntdll.c centralizes lookup of NT functions, in c

pgsql: Replace pgwin32_is_junction() with lstat().

2024-11-07 Thread Andrew Dunstan
was done because lstat() didn't previously work for symlinks (junction points), but now it does. Tested-by: Andrew Dunstan Discussion: https://postgr.es/m/CA%2BhUKGLfOOeyZpm5ByVcAt7x5Pn-%3DxGRNCvgiUPVVzjFLtnY0w%40mail.gmail.com (cherry picked from commit 5fc88c5d53e43fa7dcea93499d230a0bf70

pgsql: Make unlink() work for junction points on Windows.

2024-11-07 Thread Andrew Dunstan
Make unlink() work for junction points on Windows. To support harmonization of Windows and Unix code, teach our unlink() wrapper that junction points need to be unlinked with rmdir() on Windows. Tested-by: Andrew Dunstan Discussion: https://postgr.es/m/CA%2BhUKGLfOOeyZpm5ByVcAt7x5Pn

pgsql: Fix our Windows stat() emulation to handle file sizes > 4GB.

2024-11-07 Thread Andrew Dunstan
Fix our Windows stat() emulation to handle file sizes > 4GB. Hack things so that our idea of "struct stat" is equivalent to Windows' struct __stat64, allowing it to have a wide enough st_size field. Instead of relying on native stat(), use GetFileInformationByHandle(). This avoids a number of iss

pgsql: Fix lstat() for broken junction points on Windows.

2024-11-07 Thread Andrew Dunstan
Fix lstat() for broken junction points on Windows. When using junction points to emulate symlinks on Windows, one edge case was not handled correctly by commit c5cb8f3b: if a junction point is broken (pointing to a non-existent path), we'd report ENOENT. This doesn't break any known use case, but

Re: pgsql: Update time zone data files to tzdata release 2024b.

2024-11-01 Thread Andrew Dunstan
On Wed, Oct 30, 2024 at 7:20 PM Tom Lane wrote: > I wrote: > > So the problem is precisely that *our* interpretation of EST5EDT > > changed when we adopted tzdata 2024b, and that is affecting how > > we dump these old timestamps. Or at least, that seems like what > > should be happening, but the

Re: pgsql: Update time zone data files to tzdata release 2024b.

2024-10-30 Thread Andrew Dunstan
On Wed, Oct 30, 2024 at 4:53 PM Andrew Dunstan wrote: > > > On Wed, Oct 30, 2024 at 4:33 PM Tom Lane wrote: > >> Andrew Dunstan writes: >> > On Wed, Oct 30, 2024 at 11:00 AM Tom Lane wrote: >> >> I went to try to test this locally, and got nowhere, becau

Re: pgsql: Update time zone data files to tzdata release 2024b.

2024-10-30 Thread Andrew Dunstan
On Wed, Oct 30, 2024 at 11:00 AM Tom Lane wrote: > Andrew Dunstan writes: > > On Oct 29, 2024, at 5:41 PM, Tom Lane wrote: > >> I would expect that the upgrade tests would pass now for upgrades > >> from v12 or later, thanks to b8ea0f675 et al, but I'm not

Re: pgsql: Update time zone data files to tzdata release 2024b.

2024-10-29 Thread Andrew Dunstan
> On Oct 29, 2024, at 5:41 PM, Tom Lane wrote: > > Andrew Dunstan writes: >> Crake doesn't seem to like this for cross version upgrade, and the diff >> looks rather odd: > > Oh, that's annoying. I forgot to mention the side-effects that 2024b &g

Re: pgsql: Update time zone data files to tzdata release 2024b.

2024-10-29 Thread Andrew Dunstan
On Tue, Oct 29, 2024 at 11:50 AM Tom Lane wrote: > Update time zone data files to tzdata release 2024b. > > Historical corrections for Mexico, Mongolia, and Portugal. > Notably, Asia/Choibalsan is now an alias for Asia/Ulaanbaatar > rather than being a separate zone, mainly because the difference

pgsql: Move Cluster.pm initialization code to a more obvious place

2024-10-06 Thread Andrew Dunstan
Move Cluster.pm initialization code to a more obvious place Commit 460c0076e8 added some module intialization code to set signal handlers. However, that code has now become somewhat buried, as later commits added new subroutines. Therefore, move the initialization code to the module's INIT block w

pgsql: Bump MIN_WINNT for MINGW to clear a build error

2024-09-30 Thread Andrew Dunstan
Bump MIN_WINNT for MINGW to clear a build error Because we have been setting this too low, there has been a long-standing warning about a missing declaration for inet_pton(). Modern gcc now considers this an error, so we have been getting failures on the buildfarm animal fairywren. Fix suggested

Re: pgsql: scripts: add Perl script to add links to release notes

2024-09-17 Thread Andrew Dunstan
ostly stylistic changes (simpler use of print, use of POSIX xdigit class for hex digits), but it does correct one actual error: AFAIK "die" doesn't do printf style substitutions. cheers andrew -- Andrew Dunstan EDB:https://www.enterprisedb.com diff --git a/src/tools/a

Re: pgsql: Perl scripts: eliminate "Useless interpolation" warnings

2024-09-16 Thread Andrew Dunstan
On 2024-09-15 Su 9:28 PM, Bruce Momjian wrote: On Sun, Sep 15, 2024 at 06:07:21PM -0400, Andrew Dunstan wrote: On 2024-09-15 Su 4:36 PM, Bruce Momjian wrote: On Sun, Sep 15, 2024 at 04:33:49PM -0400, Andrew Dunstan wrote: I understand perfectly what the warning is about. But the project&#

Re: pgsql: Perl scripts: eliminate "Useless interpolation" warnings

2024-09-15 Thread Andrew Dunstan
On 2024-09-15 Su 4:36 PM, Bruce Momjian wrote: On Sun, Sep 15, 2024 at 04:33:49PM -0400, Andrew Dunstan wrote: I understand perfectly what the warning is about. But the project's perlcritic policy is expressed at src/tools/perlcheck/ perlcriticrc. It's basically severity 5

Re: pgsql: Perl scripts: eliminate "Useless interpolation" warnings

2024-09-15 Thread Andrew Dunstan
On 2024-09-15 Su 4:16 PM, Bruce Momjian wrote: On Sun, Sep 15, 2024 at 02:30:47PM -0400, Andrew Dunstan wrote: On 2024-09-15 Su 10:56 AM, Bruce Momjian wrote: Perl scripts: eliminate "Useless interpolation" warnings Eliminate warnings of Perl Critic from

Re: pgsql: Perl scripts: eliminate "Useless interpolation" warnings

2024-09-15 Thread Andrew Dunstan
s you can explain how you got the warnings. cheers andrew -- Andrew Dunstan EDB:https://www.enterprisedb.com

pgsql: Improve meson's detection of perl build flags

2024-09-14 Thread Andrew Dunstan
Improve meson's detection of perl build flags The current method of detecting perl build flags breaks if the path to perl contains a space. This change makes two improvements. First, instead of getting a list of ldflags and ccdlflags and then trying to filter those out of the reported ldopts, we t

pgsql: Improve meson's detection of perl build flags

2024-09-14 Thread Andrew Dunstan
Improve meson's detection of perl build flags The current method of detecting perl build flags breaks if the path to perl contains a space. This change makes two improvements. First, instead of getting a list of ldflags and ccdlflags and then trying to filter those out of the reported ldopts, we t

pgsql: Improve meson's detection of perl build flags

2024-09-14 Thread Andrew Dunstan
Improve meson's detection of perl build flags The current method of detecting perl build flags breaks if the path to perl contains a space. This change makes two improvements. First, instead of getting a list of ldflags and ccdlflags and then trying to filter those out of the reported ldopts, we t

pgsql: Only define NO_THREAD_SAFE_LOCALE for MSVC plperl when required

2024-09-14 Thread Andrew Dunstan
Only define NO_THREAD_SAFE_LOCALE for MSVC plperl when required Latest versions of Strawberry Perl define USE_THREAD_SAFE_LOCALE, and we therefore get a handshake error when building against such instances. The solution is to perform a test to see if USE_THREAD_SAFE_LOCALE is defined and only defi

pgsql: Only define NO_THREAD_SAFE_LOCALE for MSVC plperl when required

2024-09-14 Thread Andrew Dunstan
Only define NO_THREAD_SAFE_LOCALE for MSVC plperl when required Latest versions of Strawberry Perl define USE_THREAD_SAFE_LOCALE, and we therefore get a handshake error when building against such instances. The solution is to perform a test to see if USE_THREAD_SAFE_LOCALE is defined and only defi

pgsql: Only define NO_THREAD_SAFE_LOCALE for MSVC plperl when required

2024-09-14 Thread Andrew Dunstan
Only define NO_THREAD_SAFE_LOCALE for MSVC plperl when required Latest versions of Strawberry Perl define USE_THREAD_SAFE_LOCALE, and we therefore get a handshake error when building against such instances. The solution is to perform a test to see if USE_THREAD_SAFE_LOCALE is defined and only defi

pgsql: Only define NO_THREAD_SAFE_LOCALE for MSVC plperl when required

2024-09-14 Thread Andrew Dunstan
Only define NO_THREAD_SAFE_LOCALE for MSVC plperl when required Latest versions of Strawberry Perl define USE_THREAD_SAFE_LOCALE, and we therefore get a handshake error when building against such instances. The solution is to perform a test to see if USE_THREAD_SAFE_LOCALE is defined and only defi

pgsql: Only define NO_THREAD_SAFE_LOCALE for MSVC plperl when required

2024-09-14 Thread Andrew Dunstan
Only define NO_THREAD_SAFE_LOCALE for MSVC plperl when required Latest versions of Strawberry Perl define USE_THREAD_SAFE_LOCALE, and we therefore get a handshake error when building against such instances. The solution is to perform a test to see if USE_THREAD_SAFE_LOCALE is defined and only defi

pgsql: Only define NO_THREAD_SAFE_LOCALE for MSVC plperl when required

2024-09-14 Thread Andrew Dunstan
Only define NO_THREAD_SAFE_LOCALE for MSVC plperl when required Latest versions of Strawberry Perl define USE_THREAD_SAFE_LOCALE, and we therefore get a handshake error when building against such instances. The solution is to perform a test to see if USE_THREAD_SAFE_LOCALE is defined and only defi

pgsql: Only define NO_THREAD_SAFE_LOCALE for MSVC plperl when required

2024-09-14 Thread Andrew Dunstan
Only define NO_THREAD_SAFE_LOCALE for MSVC plperl when required Latest versions of Strawberry Perl define USE_THREAD_SAFE_LOCALE, and we therefore get a handshake error when building against such instances. The solution is to perform a test to see if USE_THREAD_SAFE_LOCALE is defined and only defi

pgsql: Preserve tz when converting to jsonb timestamptz

2024-07-30 Thread Andrew Dunstan
Preserve tz when converting to jsonb timestamptz This removes an inconsistency in the treatment of different datatypes by the jsonpath timestamp_tz() function. Conversions from data types that are not timestamp-aware, such as date and timestamp, are now treated consistently with conversion from th

pgsql: Preserve tz when converting to jsonb timestamptz

2024-07-30 Thread Andrew Dunstan
Preserve tz when converting to jsonb timestamptz This removes an inconsistency in the treatment of different datatypes by the jsonpath timestamp_tz() function. Conversions from data types that are not timestamp-aware, such as date and timestamp, are now treated consistently with conversion from th

pgsql: Stabilize xid_wraparound tests

2024-07-30 Thread Andrew Dunstan
Stabilize xid_wraparound tests The tests had a race condition if autovacuum was set to off. Instead we create all the tables we are interested in with autovacuum disabled, so they are only ever touched when in danger of wraparound. Discussion: https://postgr.es/m/3e2cbd24-f45e-4b2b-ba83-8149214f

  1   2   3   4   5   6   7   8   9   10   >