aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
...
* Add new win32 header to headerscheck and cpluspluscheckThomas Munro2022-08-14
| | | | | | Commit 5579388d added src/include/port/win32/netdb.h but forgot to filter it out in the header checking scripts. Per build farm animal crake.
* Remove configure probe for gethostbyname_r.Thomas Munro2022-08-14
| | | | | | | It was only used by src/port/getaddrinfo.c, removed by the previous commit. Discussion: https://postgr.es/m/CA%2BhUKGJFLPCtAC58EAimF6a6GPw30TU_59FUY%3DGWB_kC%3DJEmVQ%40mail.gmail.com
* Remove replacement code for getaddrinfo.Thomas Munro2022-08-14
| | | | | | | | | | SUSv3, all targeted Unixes and modern Windows have getaddrinfo() and related interfaces. Drop the replacement implementation, and adjust some headers slightly to make sure that the APIs are visible everywhere using standard POSIX headers and names. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CA%2BhUKG%2BL_3brvh%3D8e0BW_VfX9h7MtwgN%3DnFHP5o7X2oZucY9dg%40mail.gmail.com
* Remove configure probe for struct sockaddr_storage.Thomas Munro2022-08-14
| | | | | | | | <sys/socket.h> provides sockaddr_storage in SUSv3 and all targeted Unix systems have it. Windows has it too. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CA%2BhUKG%2BL_3brvh%3D8e0BW_VfX9h7MtwgN%3DnFHP5o7X2oZucY9dg%40mail.gmail.com
* Avoid misbehavior when hash_table_bytes < bucket_size.Tom Lane2022-08-13
| | | | | | | | | | | | | | | It's possible to reach this case when work_mem is very small and tupsize is (relatively) very large. In that case ExecChooseHashTableSize would get an assertion failure, or with asserts off it'd compute nbuckets = 0, which'd likely cause misbehavior later (I've not checked). To fix, clamp the number of buckets to be at least 1. This is due to faulty conversion of old my_log2() coding in 28d936031. Back-patch to v13, as that was. Zhang Mingli Discussion: https://postgr.es/m/beb64ca0-91e2-44ac-bf4a-7ea36275ec02@Spark
* Remove HAVE_UNIX_SOCKETS.Thomas Munro2022-08-14
| | | | | | | | | | | | | | | | | | | | | | | | | Since HAVE_UNIX_SOCKETS is now defined unconditionally, remove the macro and drop a small amount of dead code. The last known systems not to have them (as far as I know at least) were QNX, which we de-supported years ago, and Windows, which now has them. If a new OS ever shows up with the POSIX sockets API but without working AF_UNIX, it'll presumably still be able to compile the code, and fail at runtime with an unsupported address family error. We might want to consider adding a HINT that you should turn off the option to use it if your network stack doesn't support it at that point, but it doesn't seem worth making the relevant code conditional at compile time. Also adjust a couple of places in the docs and comments that referred to builds without Unix-domain sockets, since there aren't any. Windows still gets a special mention in those places, though, because we don't try to use them by default there yet. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Andres Freund <andres@anarazel.de> Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com> Discussion: https://postgr.es/m/CA%2BhUKG%2BL_3brvh%3D8e0BW_VfX9h7MtwgN%3DnFHP5o7X2oZucY9dg%40mail.gmail.com
* Catch stack overflow when recursing in transformFromClauseItem().Tom Lane2022-08-13
| | | | | | | | | | | | | | | Most parts of the parser can expect that the stack overflow check in transformExprRecurse() will trigger before things get desperate. However, transformFromClauseItem() can recurse directly to self without having analyzed any expressions, so it's possible to drive it to a stack-overrun crash. Add a check to prevent that. Per bug #17583 from Egor Chindyaskin. Back-patch to all supported branches. Richard Guo Discussion: https://postgr.es/m/17583-33be55b9f981f75c@postgresql.org
* Remove configurability of PPC spinlock assembly code.Tom Lane2022-08-13
| | | | | | | | | | | | | | | | | | | | | Assume that we can use LWARX hint flags and the LWSYNC instruction on any PPC machine. The check on the assembler's behavior was only needed for Apple's old assembler, which is no longer of interest now that we've de-supported all PPC-era versions of macOS (thanks to them not having clock_gettime()). Also, given an up-to-date assembler these instructions work even on Apple's old hardware. It seems quite unlikely that anyone would be interested in running current Postgres on PPC hardware that's so old as to not have these instructions. Hence, rip out associated configure test and manual configuration options, and just use the modernized instructions all the time. Also, update atomics/arch-ppc.h to use these instructions as well. (It was already using LWSYNC unconditionally in another place, providing further proof that nobody is using PG on hardware old enough to have a problem with that.) Discussion: https://postgr.es/m/166622.1660323391@sss.pgh.pa.us
* Remove configure probe for sys/resource.h and refactor.Thomas Munro2022-08-14
| | | | | | | | | | | | <sys/resource.h> is in SUSv2 and is on all targeted Unix systems. We have a replacement for getrusage() on Windows, so let's just move its declarations into src/include/port/win32/sys/resource.h so that we can use a standard-looking #include. Also remove an obsolete reference to CLK_TCK. Also rename src/port/getrusage.c to win32getrusage.c, following the convention for Windows-only fallback code. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CA%2BhUKG%2BL_3brvh%3D8e0BW_VfX9h7MtwgN%3DnFHP5o7X2oZucY9dg%40mail.gmail.com
* Remove configure probes for sys/ipc.h, sys/sem.h, sys/shm.h.Thomas Munro2022-08-14
| | | | | | | | | These are in SUSv2 and every targeted Unix system has them. It's not hard to avoid including them on Windows system because they're mostly used in platform-specific translation units. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CA%2BhUKG%2BL_3brvh%3D8e0BW_VfX9h7MtwgN%3DnFHP5o7X2oZucY9dg%40mail.gmail.com
* Remove configure probe for sys/select.h.Thomas Munro2022-08-14
| | | | | | | | | <sys/select.h> is in SUSv3 and every targeted Unix system has it. Provide an empty header in src/include/port/win32 so that we can include it unguarded even on Windows. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CA%2BhUKG%2BL_3brvh%3D8e0BW_VfX9h7MtwgN%3DnFHP5o7X2oZucY9dg%40mail.gmail.com
* Remove configure probes for sys/un.h and struct sockaddr_un.Thomas Munro2022-08-14
| | | | | | | | | | | | | | | | <sys/un.h> is in SUSv3 and every targeted Unix has it. Some Windows tool chains may still lack the approximately equivalent header <afunix.h>, so we already defined struct sockaddr_un ourselves on that OS for now. To harmonize things a bit, move our definition into a new header src/include/port/win32/sys/un.h. HAVE_UNIX_SOCKETS is now defined unconditionally. We migh remove that in a separate commit, pending discussion. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com> Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/CA%2BhUKG%2BL_3brvh%3D8e0BW_VfX9h7MtwgN%3DnFHP5o7X2oZucY9dg%40mail.gmail.com
* Remove configure probe for sys/uio.h.Thomas Munro2022-08-14
| | | | | | | | | | | | | | | | | | | | <sys/uio.h> is in SUSv2, and all targeted Unix system have it, so we might as well drop the probe (in fact we never really needed this one). It's where struct iovec is defined, and as a common extension, it's also where non-standard preadv() and pwritev() are declared on systems that have them. We should also be able to assume that IOV_MAX is defined on Unix. To spell out what our pg_iovec.h header does for the OSes in the build farm as of today: Windows: our own struct and functions Solaris, Cygwin: <sys/uio.h>'s struct, our own functions Every other Unix: <sys/uio.h>'s struct and functions Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CA%2BhUKG%2BL_3brvh%3D8e0BW_VfX9h7MtwgN%3DnFHP5o7X2oZucY9dg%40mail.gmail.com
* Add missing fields to _outConstraint()Peter Eisentraut2022-08-13
| | | | | | | | As of 897795240cfaaed724af2f53ed2c50c9862f951f, check constraints can be declared invalid. But that patch didn't update _outConstraint() to also show the relevant struct fields (which were only applicable to foreign keys before that). This currently only affects debugging output, so no impact in practice.
* pg_upgrade: Fix some minor code issuesPeter Eisentraut2022-08-13
| | | | | | | | | | | | 96ef3b8ff1cf1950e897fd2f766d4bd9ef0d5d56 accidentally copied a not applicable comment from the float8_pass_by_value code to the data_checksums code. Remove that. 87d3b35a1ca31a9d947a8f919a6006679216dff0 changed pg_upgrade to checking the checksum version rather than just the Boolean presence of checksums, but didn't change the field type in its ControlData struct from bool. So this would not work correctly if there ever is a checksum version larger than 1.
* pg_upgrade: Remove unused typedefPeter Eisentraut2022-08-12
| | | | pgpid_t has been unused in pg_upgrade for a long time.
* Avoid using a fake relcache entry to own an SmgrRelation.Robert Haas2022-08-12
| | | | | | | | | | | | | | | | | | | | If an error occurs before we close the fake relcache entry, the the fake relcache entry will be destroyed by the SmgrRelation will survive until end of transaction. Its smgr_owner pointer ends up pointing to already-freed memory. The original reason for using a fake relcache entry here was to try to avoid reusing an SMgrRelation across a relevant invalidation. To avoid that problem, just call smgropen() again each time we need a reference to it. Hopefully someday we will come up with a more elegant approach, but accessing uninitialized memory is bad so let's do this for now. Dilip Kumar, reviewed by Andres Freund and Tom Lane. Report by Justin Pryzby. Discussion: http://postgr.es/m/20220802175043.GA13682@telsasoft.com Discussion: http://postgr.es/m/CAFiTN-vSFeE6_W9z698XNtFROOA_nSqUXWqLcG0emob_kJ+dEQ@mail.gmail.com
* Reject MERGE in CTEs and COPYAlvaro Herrera2022-08-12
| | | | | | | | | | | | The grammar added for MERGE inadvertently made it accepted syntax in places that were not prepared to deal with it -- namely COPY and inside CTEs, but invoking these things with MERGE currently causes assertion failures or weird misbehavior in non-assertion builds. Protect those places by checking for it explicitly until somebody decides to implement it. Reported-by: Alexey Borzov <borz_off@cs.msu.su> Discussion: https://postgr.es/m/17579-82482cd7b267b862@postgresql.org
* Fix _outConstraint() for "identity" constraintsPeter Eisentraut2022-08-12
| | | | | | | | | The set of fields printed by _outConstraint() in the CONSTR_IDENTITY case didn't match the set of fields actually used in that case. (The code was probably uncarefully copied from the CONSTR_DEFAULT case.) Fix that by using the right set of fields. Since there is no read support for this node type, this is really just for debugging output right now, so it doesn't affect anything important.
* Fix non-specific error message.Robert Haas2022-08-11
| | | | | | | "something has gone wrong" is not helpful. Make this elog() consistent with the other one in the same function. Discussion: http://postgr.es/m/CA+Tgmoa_AZ2jUWSA_noiqOqnxBaWDR+t3bHjSygZi6+wqDBCXQ@mail.gmail.com
* struct PQWalReceiverFunctions: use designated initializersAlvaro Herrera2022-08-11
| | | | | | | | | We now require that compilers support this, and it makes the code easier to trace, so change it. I'm fixated on this particular struct because I've had to navigate around it a number of times, but there are others elsewhere that could use the same treatment. Discussion: https://postgr.es/m/20220810140300.ixhbmm4svo5yypv6@alvherre.pgsql
* Add missing space in _outA_Const() outputPeter Eisentraut2022-08-11
| | | | Mistake introduced by 639a86e36aaecb84faaf941dcd0b183ba0aba9e9.
* Fix catalog lookup with the wrong snapshot during logical decoding.Amit Kapila2022-08-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we relied on HEAP2_NEW_CID records and XACT_INVALIDATION records to know if the transaction has modified the catalog, and that information is not serialized to snapshot. Therefore, after the restart, if the logical decoding decodes only the commit record of the transaction that has actually modified a catalog, we will miss adding its XID to the snapshot. Thus, we will end up looking at catalogs with the wrong snapshot. To fix this problem, this change adds the list of transaction IDs and sub-transaction IDs, that have modified catalogs and are running during snapshot serialization, to the serialized snapshot. After restart or otherwise, when we restore from such a serialized snapshot, the corresponding list is restored in memory. Now, when decoding a COMMIT record, we check both the list and the ReorderBuffer to see if the transaction has modified catalogs. Since this adds additional information to the serialized snapshot, we cannot backpatch it. For back branches, we took another approach. We remember the last-running-xacts list of the decoded RUNNING_XACTS record after restoring the previously serialized snapshot. Then, we mark the transaction as containing catalog changes if it's in the list of initial running transactions and its commit record has XACT_XINFO_HAS_INVALS. This doesn't require any file format changes but the transaction will end up being added to the snapshot even if it has only relcache invalidations. But that won't be a problem since we use snapshot built during decoding only to read system catalogs. This commit bumps SNAPBUILD_VERSION because of a change in SnapBuild. Reported-by: Mike Oh Author: Masahiko Sawada Reviewed-by: Amit Kapila, Shi yu, Takamichi Osumi, Kyotaro Horiguchi, Bertrand Drouvot, Ahsan Hadi Backpatch-through: 10 Discussion: https://postgr.es/m/81D0D8B0-E7C4-4999-B616-1E5004DBDCD2%40amazon.com
* Optimize xid/subxid searches in XidInMVCCSnapshot().John Naylor2022-08-11
| | | | | | | | | | | | | | | | | As reported by Yura Sokolov, scanning the snapshot->xip array has noticeable impact on scalability when there are a large number of concurrent writers. Use the optimized (on x86-64) routine from b6ef16756 to speed up searches through the [sub]xip arrays. One benchmark showed a 5% increase in transaction throughput with 128 concurrent writers, and a 50% increase in a pathological case of 1024 writers. While a hash table would have scaled even better, it was ultimately rejected because of concerns around code complexity and memory allocation. Credit to Andres Freund for the idea to optimize linear search using SIMD instructions. Nathan Bossart Reviewed by: Andres Freund, John Naylor, Bharath Rupireddy, Masahiko Sawada Discussion: https://postgr.es/m/20220713170950.GA3116318%40nathanxps13
* Move basebackup code to new directory src/backend/backupRobert Haas2022-08-10
| | | | | | Reviewed by David Steele and Justin Pryzby Discussion: http://postgr.es/m/CA+TgmoafqboATDSoXHz8VLrSwK_MDhjthK4hEpYjqf9_1Fmczw%40mail.gmail.com
* Fix handling of R/W expanded datums that are passed to SQL functions.Tom Lane2022-08-10
| | | | | | | | | | | | | | | | | | | fmgr_sql must make expanded-datum arguments read-only, because it's possible that the function body will pass the argument to more than one callee function. If one of those functions takes the datum's R/W property as license to scribble on it, then later callees will see an unexpected value, leading to wrong answers. From a performance standpoint, it'd be nice to skip this in the common case that the argument value is passed to only one callee. However, detecting that seems fairly hard, and certainly not something that I care to attempt in a back-patched bug fix. Per report from Adam Mackler. This has been broken since we invented expanded datums, so back-patch to all supported branches. Discussion: https://postgr.es/m/WScDU5qfoZ7PB2gXwNqwGGgDPmWzz08VdydcPFLhOwUKZcdWbblbo-0Lku-qhuEiZoXJ82jpiQU4hOjOcrevYEDeoAvz6nR0IU4IHhXnaCA=@mackler.email Discussion: https://postgr.es/m/187436.1660143060@sss.pgh.pa.us
* Fix typo in test_oat_hooks READMEDaniel Gustafsson2022-08-10
| | | | Discussion: https://postgr.es/m/3F066AFE-19F9-4DF5-A498-B09643857A39@yesql.se
* Remove unused short option from getopt_long() callPeter Eisentraut2022-08-10
| | | | | The option was removed in 3ce7f72529 but the letter was left in the getopt_long() call.
* Introduce optimized routine for linear searches of arraysJohn Naylor2022-08-10
| | | | | | | | | | | | | Use SSE2 intrinsics to speed up the search, where available. Otherwise, use a simple 'for' loop. The motivation to add this now is to speed up XidInMVCCSnapshot(), which is the reason only unsigned 32-bit integer arrays are optimized. Other types are left for future work, as is the extension of this technique to non-x86 platforms. Nathan Bossart Reviewed by: Andres Freund, Bharath Rupireddy, Masahiko Sawada Discussion: https://postgr.es/m/20220713170950.GA3116318%40nathanxps13
* Fix some inconsistencies with GUC categoriesMichael Paquier2022-08-09
| | | | | | | | | | | | | | | | | | | | This commit addresses a few things around GUCs: - The TCP-related parameters (the four tcp_keepalives_* and client_connection_check_interval are listed in postgresql.conf.sample in a subsection called "TCP settings" of "CONNECTIONS AND AUTHENTICATION", but they did not have their own group name in guc.c. - enable_group_by_reordering, stats_fetch_consistency and recovery_prefetch had an inconsistent description, missing a dot at the end. - In postgresql.conf.sample, "Process title" should not have a section of its own, but it should be a subsection of "REPORTING AND LOGGING". This impacts the contents of pg_settings, which could be seen as a compatibility break, so no backpatch is done. This is similar to the cleanup done in a55a984. Author: Shinya Kato Discussion: https://postgr.es/m/5e0c9c608624eafbba910c344282cb14@oss.nttdata.com
* Fix mismatched file identificationsJohn Naylor2022-08-09
| | | | | Masahiko Sawada Discussion: https://www.postgresql.org/message-id/CAD21AoASq93KPiNxipPaTCzEdsnxT9665UesOnWcKhmX9Qfx6A@mail.gmail.com
* Fix obsolete comment in commit_ts.c.Thomas Munro2022-08-09
| | | | | | | | Commit 08aa89b removed COMMIT_TS_SETTS, but left a reference in a comment. Author: Nathan Bossart <nathandbossart@gmail.com> Discussion: https://postgr.es/m/20220726173343.GA154110%40nathanxps13
* Fix obsolete comments in instr_time.h.Thomas Munro2022-08-09
| | | | | | | | | Commit 623cc673 removed gettimeofday(), and commits 24c3ce8f and 495ed0ef removed support for very old Windows releases with low accuracy timers, but references to those things were left behind in comments. Reported-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/295419.1659918447%40sss.pgh.pa.us
* Fix MSVC build script's check for obsolete node support functions.Tom Lane2022-08-08
| | | | | | | | | | | | | | | | Commit 964d01ae9 was a few bricks shy of a load here: the script checked whether gen_node_support.pl itself had been updated since it was last run, but not whether any of its input files had been updated. Fix that. While here, scrape the list of input files from the Makefiles rather than having a duplicate copy, as we do for most other lists of source files. In passing, improve gen_node_support.pl's error report for an incorrect file list. Per gripe from Amit Kapila. Discussion: https://postgr.es/m/CAA4eK1KQk4vP-3mTAz26h-PRUZaGu8Fc=q-ZKSajsAthH0A15w@mail.gmail.com
* Stabilize output of new regression test.Tom Lane2022-08-08
| | | | | | | | | | Per buildfarm, the output order of \dx+ isn't consistent across locales. Apply NO_LOCALE to force C locale. There might be a more localized way, but I'm not seeing it offhand, and anyway there is nothing in this test module that particularly cares about locales. Security: CVE-2022-2625
* In extensions, don't replace objects not belonging to the extension.Tom Lane2022-08-08
| | | | | | | | | | | | | | | | | | | | | | | Previously, if an extension script did CREATE OR REPLACE and there was an existing object not belonging to the extension, it would overwrite the object and adopt it into the extension. This is problematic, first because the overwrite is probably unintentional, and second because we didn't change the object's ownership. Thus a hostile user could create an object in advance of an expected CREATE EXTENSION command, and would then have ownership rights on an extension object, which could be modified for trojan-horse-type attacks. Hence, forbid CREATE OR REPLACE of an existing object unless it already belongs to the extension. (Note that we've always forbidden replacing an object that belongs to some other extension; only the behavior for previously-free-standing objects changes here.) For the same reason, also fail CREATE IF NOT EXISTS when there is an existing object that doesn't belong to the extension. Our thanks to Sven Klemm for reporting this problem. Security: CVE-2022-2625
* aix: fix misreading of condition in 8f12a4e7addAndres Freund2022-08-07
| | | | | | | | | This lead to choosing the aix4.1 specific way of building the export file for the backend, rather than the modern one. Per buildfarm member hoverfly. Discussion: https://postgr.es/m/20220807182707.gi7pirwbz5etprfo@awork3.anarazel.de
* solaris: Remove unnecessary gcc / gnu ld vs sun studio differencesAndres Freund2022-08-07
| | | | | | | | Unfortunately one with_gnu_ld reference remains, otherwise we could remove the configure support for determining with_gnu_ld. Reviewed-By: Thomas Munro <thomas.munro@gmail.com> Discussion: https://postgr.es/m/20220807012914.ydz73yte6j3coulo@awork3.anarazel.de
* aix: Remove checks for very old OS versionsAndres Freund2022-08-07
| | | | | Reviewed-By: Thomas Munro <thomas.munro@gmail.com> Discussion: https://postgr.es/m/20220807012914.ydz73yte6j3coulo@awork3.anarazel.de
* windows: Remove HAVE_MINIDUMP_TYPE testAndres Freund2022-08-07
| | | | | | | We've relied on it being present for msvc for ages... Reviewed-By: Thomas Munro <thomas.munro@gmail.com> Discussion: https://postgr.es/m/20220807012914.ydz73yte6j3coulo@awork3.anarazel.de
* Rely on __func__ being supportedAndres Freund2022-08-07
| | | | | | | | | | | | Previously we fell back to __FUNCTION__ and then NULL. As __func__ is in C99 that shouldn't be necessary anymore. Solution.pm defined HAVE_FUNCNAME__FUNCTION instead of HAVE_FUNCNAME__FUNC (originating in 4164e6636e2), as at some point in the past MSVC only supported __FUNCTION__. Our minimum version supports __func__. Reviewed-By: Thomas Munro <thomas.munro@gmail.com> Discussion: https://postgr.es/m/20220807012914.ydz73yte6j3coulo@awork3.anarazel.de
* Remove unportable use of timezone in recent testAlvaro Herrera2022-08-07
| | | | | | Per buildfarm member snapper Discussion: https://postgr.es/m/129951.1659812518@sss.pgh.pa.us
* Simplify replacement code for strtof.Thomas Munro2022-08-07
| | | | | | | | | | strtof() is in C99 and all targeted systems have it. We can remove the configure probe and some dead code, but we still need replacement code for a couple of systems that have known buggy implementations selected via platform template. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/152683.1659830125%40sss.pgh.pa.us
* Simplify gettimeofday for Windows.Thomas Munro2022-08-07
| | | | | | | | | | | | | | | Previously we bothered to forward-declare struct timezone, following man pages on typical systems, but POSIX actually says the argument (which we ignore anyway) is void *. Drop a line. While here, add an assertion that nobody actually uses the tzp argument. Previously we did extra work to select between Windows APIs needed on older releases, but now we can just use the higher resolution function directly. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CA%2BhUKGKwRpvGfcfq2qNVAQS2Wg1B9eA9QRhAmVSyJt1zsCN2sQ%40mail.gmail.com
* Fix function-defined-but-not-used warning.Tom Lane2022-08-06
| | | | | | | | | | | | Buildfarm member jacana (MinGW) has been complaining that get_iso_localename is defined but not used. This is evidently fallout from the recent removal of VS2013 support in pg_locale.c. Rearrange the #ifs so that get_iso_localename and its subroutine search_locale_enum won't get built on MinGW. I also noticed that a comment in get_iso_localename cross- referenced a comment in IsoLocaleName that isn't there anymore. Put back what I think is the referenced material.
* Fix data-corruption hazard in WAL-logged CREATE DATABASE.Tom Lane2022-08-06
| | | | | | | | | | | | | | RelationCopyStorageUsingBuffer thought it could skip copying empty pages, but of course that does not work at all, because subsequent blocks will be out of place. Also fix it to acquire share lock on the source buffer. It *might* be safe to not do that, but it's not very certain, and I don't think this code deserves any benefit of the doubt. Dilip Kumar, per complaint from me Discussion: https://postgr.es/m/3679800.1659654066@sss.pgh.pa.us
* Simplify gettimeofday() fallback logic.Andres Freund2022-08-06
| | | | | | | | | | | | | | | | | | There's no known supported system needing 1 argument gettimeofday() support. The test for it was added a long time ago (92c6bf9775b). Remove. Until now we tested whether a gettimeofday() fallback is needed when targetting windows. Which lead to the odd result that HAVE_GETTIMEOFDAY only being defined when targetting MinGW (which has gettimeofday() since at least 2007). As the fallback is specific to msvc, remove the configure code and rename src/port/gettimeofday.c to src/port/win32gettimeofday.c. While at it, also remove the definition of struct timezone, a forward declaration of the struct is sufficient. Reviewed-By: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-By: Thomas Munro <thomas.munro@gmail.com> Discussion: https://postgr.es/m/20220806000311.ywx65iuchvj4qn2k@awork3.anarazel.de
* Improve recently-added test reliabilityAlvaro Herrera2022-08-06
| | | | | | | | | | | | | | Commit 59be1c942a47 already tried to make src/test/recovery/t/033_replay_tsp_drops more reliable, but it wasn't enough. Try to improve on that by making this use of a replication slot to be more like others. Also, don't drop the slot. Make a few other stylistic changes while at it. It's still quite slow, which is another thing that we need to fix in this script. Backpatch to all supported branches. Discussion: https://postgr.es/m/349302.1659191875@sss.pgh.pa.us
* Fix comment in copyfrom_internal.hMichael Paquier2022-08-06
| | | | | | | | COPY_NEW_FE has become COPY_FRONTEND in 3174d69, that has removed the frontend-backend protocol v2. Author: Zhang Mingli Discussion: https://postgr.es/m/aeec12a3-501e-449a-8d25-901c4ff706cf@Spark
* Replace pgwin32_is_junction() with lstat().Thomas Munro2022-08-06
| | | | | | | | | | | | | | | | | | | Now that lstat() reports junction points with S_IFLNK/S_ISLINK(), and unlink() can unlink them, there is no need for conditional code for Windows in a few places. That was expressed by testing for WIN32 or S_ISLNK, which we can now constant-fold. The coding around pgwin32_is_junction() was a bit suspect anyway, as we never checked for errors, and we also know that errors can be spuriously reported because of transient sharing violations on this OS. The lstat()-based code has handling for that. This also reverts 4fc6b6ee on master only. That was done because lstat() didn't previously work for symlinks (junction points), but now it does. Tested-by: Andrew Dunstan <andrew@dunslane.net> Discussion: https://postgr.es/m/CA%2BhUKGLfOOeyZpm5ByVcAt7x5Pn-%3DxGRNCvgiUPVVzjFLtnY0w%40mail.gmail.com