aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
...
* Reorder COMPRESSION option in gram.y and parsenodes.h into alphabetical order.Fujii Masao2021-04-23
| | | | | | | | | | | Commit bbe0a81db6 introduced "INCLUDING COMPRESSION" option in CREATE TABLE command, but previously TableLikeOption in gram.y and parsenodes.h didn't classify this new option in alphabetical order with the rest. Author: Fujii Masao Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/YHerAixOhfR1ryXa@paquier.xyz
* pg_amcheck: Use logging functionsPeter Eisentraut2021-04-23
| | | | | This was already mostly done, but some error messages were printed the long way.
* Fix incorrect format placeholderPeter Eisentraut2021-04-23
|
* Fix some comments in fmgr.cMichael Paquier2021-04-23
| | | | | | | Oversight in 2a0faed. Author: Hou Zhijie Discussion: https://postgr.es/m/OS0PR01MB5716405E2464D85E6DB6DC0794469@OS0PR01MB5716.jpnprd01.prod.outlook.com
* Remove use of [U]INT64_FORMAT in some translatable stringsMichael Paquier2021-04-23
| | | | | | | | %lld with (long long), or %llu with (unsigned long long) are more adapted. This is similar to 3286065. Author: Kyotaro Horiguchi Discussion: https://postgr.es/m/20210421.200000.1462448394029407895.horikyota.ntt@gmail.com
* Minor code cleanup in asynchronous execution support.Etsuro Fujita2021-04-23
| | | | | | | | | | | | | | | This is cleanup for commit 27e1f1456: * ExecAppendAsyncEventWait(), which was modified a bit further by commit a8af856d3, duplicated the same nevents calculation. Simplify the code a little bit to avoid the duplication. Update comments there. * Add an assertion to ExecAppendAsyncRequest(). * Update a comment about merging the async_capable options from input relations in merge_fdw_options(), per complaint from Kyotaro Horiguchi. * Add a comment for fetch_more_data_begin(). Author: Etsuro Fujita Discussion: https://postgr.es/m/CAPmGK1637W30Wx3MnrReewhafn6F_0J76mrJGoFXFnpPq4QfvA%40mail.gmail.com
* Don't crash on reference to an un-available system column.Tom Lane2021-04-22
| | | | | | | | | | | | | | | | Adopt a more consistent policy about what slot-type-specific getsysattr functions should do when system attributes are not available. To wit, they should all throw the same user-oriented error, rather than variously crashing or emitting developer-oriented messages. This closes a identifiable problem in commits a71cfc56b and 3fb93103a (in v13 and v12), so back-patch into those branches, along with a test case to try to ensure we don't break it again. It is not known that any of the former crash cases are reachable in HEAD, but this seems like a good safety improvement in any case. Discussion: https://postgr.es/m/141051591267657@mail.yandex.ru
* Fix uninitialized memory bugAlvaro Herrera2021-04-22
| | | | | | | | | Have interested callers of find_inheritance_children set the detached_exist value to false prior to calling it, so that that routine only has to set it true in the rare cases where it is necessary. Don't touch it otherwise. Per buildfarm member thorntail (which reported a UBSan failure here).
* Make PostgresVersion code a bit more robust and simple.Andrew Dunstan2021-04-22
| | | | per gripe from Alvaro Herrera.
* Fix relcache inconsistency hazard in partition detachAlvaro Herrera2021-04-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During queries coming from ri_triggers.c, we need to omit partitions that are marked pending detach -- otherwise, the RI query is tricked into allowing a row into the referencing table whose corresponding row is in the detached partition. Which is bogus: once the detach operation completes, the row becomes an orphan. However, the code was not doing that in repeatable-read transactions, because relcache kept a copy of the partition descriptor that included the partition, and used it in the RI query. This commit changes the partdesc cache code to only keep descriptors that aren't dependent on a snapshot (namely: those where no detached partition exist, and those where detached partitions are included). When a partdesc-without- detached-partitions is requested, we create one afresh each time; also, those partdescs are stored in PortalContext instead of CacheMemoryContext. find_inheritance_children gets a new output *detached_exist boolean, which indicates whether any partition marked pending-detach is found. Its "include_detached" input flag is changed to "omit_detached", because that name captures desired the semantics more naturally. CreatePartitionDirectory() and RelationGetPartitionDesc() arguments are identically renamed. This was noticed because a buildfarm member that runs with relcache clobbering, which would not keep the improperly cached partdesc, broke one test, which led us to realize that the expected output of that test was bogus. This commit also corrects that expected output. Author: Amit Langote <amitlangote09@gmail.com> Author: Álvaro Herrera <alvherre@alvh.no-ip.org> Discussion: https://postgr.es/m/3269784.1617215412@sss.pgh.pa.us
* Make PostgresNode version awareAndrew Dunstan2021-04-22
| | | | | | | | | | | | | | | | | | | A new PostgresVersion object type is created and this is used in PostgresNode using the output of `pg_config --version` and the result stored in the PostgresNode object. This object can be compared to other PostgresVersion objects, or to a number or string. PostgresNode is currently believed to be compatible with versions down to release 12, so PostgresNode will issue a warning if used with a version prior to that. No attempt has been made to deal with incompatibilities in older versions - that remains work to be undertaken in a subsequent development cycle. Based on code from Mark Dilger and Jehan-Guillaume de Rorthais. Discussion: https://postgr.es/m/a80421c0-3d7e-def1-bcfe-24777f15e344@dunslane.net
* Fix relation leak for subscribers firing triggers in logical replicationMichael Paquier2021-04-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | Creating a trigger on a relation to which an apply operation is triggered would cause a relation leak once the change gets committed, as the executor would miss that the relation needs to be closed beforehand. This issue got introduced with the refactoring done in 1375422c, where it becomes necessary to track relations within es_opened_result_relations to make sure that they are closed. We have discussed using ExecInitResultRelation() coupled with ExecCloseResultRelations() for the relations in need of tracking by the apply operations in the subscribers, which would simplify greatly the opening and closing of indexes, but this requires a larger rework and reorganization of the worker code, particularly for the tuple routing part. And that's not really welcome post feature freeze. So, for now, settle down to the same solution as TRUNCATE which is to fill in es_opened_result_relations with the relation opened, to make sure that ExecGetTriggerResultRel() finds them and that they get closed. The code is lightly refactored so as a relation is not registered three times for each DML code path, making the whole a bit easier to follow. Reported-by: Tang Haiying, Shi Yu, Hou Zhijie Author: Amit Langote, Masahiko Sawada, Hou Zhijie Reviewed-by: Amit Kapila, Michael Paquier Discussion: https://postgr.es/m/OS0PR01MB611383FA0FE92EB9DE21946AFB769@OS0PR01MB6113.jpnprd01.prod.outlook.com
* Add comment about extract_autovac_opts not holding lockAlvaro Herrera2021-04-21
| | | | | | Per observation from Tom Lane. Discussion: https://postgr.es/m/1901125.1617904665@sss.pgh.pa.us
* Don't add a redundant constraint when detaching a partitionAlvaro Herrera2021-04-21
| | | | | | | | | | | | On ALTER TABLE .. DETACH CONCURRENTLY, we add a new table constraint that duplicates the partition constraint. But if the partition already has another constraint that implies that one, then that's unnecessary. We were already avoiding the addition of a duplicate constraint if there was an exact 'equal' match -- this just improves the quality of the check. Author: Justin Pryzby <pryzby@telsasoft.com> Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org> Discussion: https://postgr.es/m/20210410184226.GY6592@telsasoft.com
* fix silly perl error in commit d064afc720Andrew Dunstan2021-04-21
|
* Only ever test for non-127.0.0.1 addresses on Windows in PostgresNodeAndrew Dunstan2021-04-21
| | | | | | | | | | This has been found to cause hangs where tcp usage is forced. Alexey Kodratov Discussion: https://postgr.es/m/82e271a9a11928337fcb5b5e57b423c0@postgrespro.ru Backpatch to all live branches
* Add DISTINCT to information schema usage viewsPeter Eisentraut2021-04-21
| | | | | | | | | | Since pg_depend can contain duplicate entries, we need to eliminate those in information schema views that build on pg_depend, using DISTINCT. Some of the older views already did that correctly, but some of the more recently added ones didn't. (In some of these views, it might not be possible to reproduce the issue because of how the implementation happens to deduplicate dependencies while recording them, but it seems better to keep this consistent in all cases.)
* Use correct format placeholder for timeline IDsPeter Eisentraut2021-04-21
| | | | Should be %u rather than %d.
* doc: Improve hyphenation consistencyPeter Eisentraut2021-04-21
|
* Don't use INT64_FORMAT inside message stringsPeter Eisentraut2021-04-21
| | | | Use %lld and cast to long long int instead.
* Fix typoPeter Eisentraut2021-04-21
|
* Add CURRENT_ROLE to list of roles for tab completion of GRANT in psqlMichael Paquier2021-04-21
| | | | | | | | This compatibility has been added in 45b9805, but psql forgot the call. Author: Wei Wang Reviewed-by: Aleksander Alekseev Discussion: https://postgr.es/m/OS3PR01MB6275935F62E161BCD393D6559E489@OS3PR01MB6275.jpnprd01.prod.outlook.com
* Improve WAL record descriptions for SP-GiST records.Tom Lane2021-04-20
| | | | | | While tracking down the bug fixed in the preceding commit, I got quite annoyed by the low quality of spg_desc's output. Add missing fields, try to make the formatting consistent.
* Fix under-parenthesized XLogRecHasBlockRef() macro.Tom Lane2021-04-20
| | | | | | | | | | | | | Commit f003d9f87 left this macro with inadequate (or, one could say, too much) parenthesization. Which was catastrophic to the correctness of calls such as "if (!XLogRecHasBlockRef(record, 1)) ...". There are only a few of those, which perhaps explains why we didn't notice immediately (with our general weakness of WAL replay testing being another factor). I found it by debugging intermittent replay failures like 2021-04-08 14:33:30.191 EDT [29463] PANIC: failed to locate backup block with ID 1 2021-04-08 14:33:30.191 EDT [29463] CONTEXT: WAL redo at 0/95D3438 for SPGist/ADD_NODE: off 1; blkref #0: rel 1663/16384/25998, blk 1
* Fix interaction of log_line_prefix's query_id and log_statementBruce Momjian2021-04-20
| | | | | | | | | | | log_statement is issued before query_id can be computed, so properly clear the value, and document the interaction. Reported-by: Fujii Masao, Michael Paquier Discussion: https://postgr.es/m/YHPkU8hFi4no4NSw@paquier.xyz Author: Julien Rouhaud
* adjust query id feature to use pg_stat_activity.query_idBruce Momjian2021-04-20
| | | | | | | | | | | Previously, it was pg_stat_activity.queryid to match the pg_stat_statements queryid column. This is an adjustment to patch 4f0b0966c8. This also adjusts some of the internal function calls to match. Catversion bumped. Reported-by: Álvaro Herrera, Julien Rouhaud Discussion: https://postgr.es/m/20210408032704.GA7498@alvherre.pgsql
* Rename find_em_expr_usable_for_sorting_rel.Tom Lane2021-04-20
| | | | | | | | | | | I didn't particularly like this function name, as it fails to express what's going on. Also, returning the sort expression alone isn't too helpful --- typically, a caller would also need some other fields of the EquivalenceMember. But the sole caller really only needs a bool result, so let's make it "bool relation_can_be_sorted_early()". Discussion: https://postgr.es/m/91f3ec99-85a4-fa55-ea74-33f85a5c651f@swarm64.com
* Fix planner failure in some cases of sorting by an aggregate.Tom Lane2021-04-20
| | | | | | | | | | | | | | | | | | | | | | | An oversight introduced by the incremental-sort patches caused "could not find pathkey item to sort" errors in some situations where a sort key involves an aggregate or window function. The basic problem here is that find_em_expr_usable_for_sorting_rel isn't properly modeling what prepare_sort_from_pathkeys will do later. Rather than hoping we can keep those functions in sync, let's refactor so that they actually share the code for identifying a suitable sort expression. With this refactoring, tlist.c's tlist_member_ignore_relabel is unused. I removed it in HEAD but left it in place in v13, in case any extensions are using it. Per report from Luc Vlaming. Back-patch to v13 where the problem arose. James Coleman and Tom Lane Discussion: https://postgr.es/m/91f3ec99-85a4-fa55-ea74-33f85a5c651f@swarm64.com
* Avoid unfortunate IPC::Run path caching in PostgresNodeAndrew Dunstan2021-04-20
| | | | | | | | | | | | | | | Commit b34ca595ab provided for installation-aware instances of PostgresNode. However, it turns out that IPC::Run works against this by caching the path to a binary and not consulting the path again, even if it has changed. We work around this by calling Postgres binaries with the installed path rather than just a bare name to be looked up in the environment path, if there is an installed path. For the common case where there is no installed path we continue to use the bare command name. Diagnosis and solution from Mark Dilger Discussion: https://postgr.es/m/E8F512F8-B4D6-4514-BA8D-2E671439DA92@enterprisedb.com
* Fix typo in commentMagnus Hagander2021-04-20
| | | | | | Author: Julien Rouhaud Backpatch-through: 11 Discussion: https://postgr.es/m/20210420121659.odjueyd4rpilorn5@nol
* Document LP_DEAD accounting issues in VACUUM.Peter Geoghegan2021-04-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | Document VACUUM's soft assumption that any LP_DEAD items encountered during pruning will become LP_UNUSED items before VACUUM finishes up. This is integral to the accounting used by VACUUM to generate its final report on the table to the stats collector. It also affects how VACUUM determines which heap pages are truncatable. In both cases VACUUM is concerned with the likely contents of the page in the near future, not the current contents of the page. This state of affairs created the false impression that VACUUM's dead tuple accounting had significant difference with similar accounting used during ANALYZE. There were and are no substantive differences, at least when the soft assumption completely works out. This is far clearer now. Also document cases where things don't quite work out for VACUUM's dead tuple accounting. It's possible that a significant number of LP_DEAD items will be left behind by VACUUM, and won't be recorded as remaining dead tuples in VACUUM's statistics collector report. This behavior dates back to commit a96c41fe, which taught VACUUM to run without index and heap vacuuming at the user's request. The failsafe mechanism added to VACUUM more recently by commit 1e55e7d1 takes the same approach to dead tuple accounting. Reported-By: Masahiko Sawada <sawada.mshk@gmail.com> Discussion: https://postgr.es/m/CAH2-Wz=Jmtu18PrsYq3EvvZJGOmZqSO2u3bvKpx9xJa5uhNp=Q@mail.gmail.com
* Use correct format placeholder for pidsPeter Eisentraut2021-04-19
| | | | Should be signed, not unsigned.
* Fix test case added by commit f5fc2f5b23.Amit Kapila2021-04-19
| | | | | | | | | | | | | | | | | In the new test after resetting the stats, we were not waiting for the stats message to be delivered. Also, we need to decode the results for the new test, otherwise, it will show the old stats. In passing, a. Change docs added by commit f5fc2f5b23 as per suggestion by Justin Pryzby. b. Bump the PGSTAT_FILE_FORMAT_ID as commit f5fc2f5b23 changes the file format of stats. Reported-by: Tom Lane based on buildfarm reports Author: Vignesh C, Justin Pryzby Reviewed-by: Amit Kapila Discussion: https://postgr.es/m/20210319185247.ldebgpdaxsowiflw@alap3.anarazel.de
* Fix typos and grammar in comments and docsMichael Paquier2021-04-19
| | | | | Author: Justin Pryzby Discussion: https://postgr.es/m/20210416070310.GG3315@telsasoft.com
* Replace magic constants for seek() calls in perl scriptsMichael Paquier2021-04-19
| | | | | | | | | | A couple of tests have been using 0 as magic constant while SEEK_SET can be used instead. This makes the code easier to understand, and more consistent with the changes done in 3c5b068. Per discussion with Andrew Dunstan. Discussion: https://postgr.es/m/YHrc24AgJQ6tQ1q0@paquier.xyz
* Explain postmaster's treatment of SIGURG.Thomas Munro2021-04-19
| | | | | | | | Add a few words of comment to explain why SIGURG doesn't follow the dummy_handler pattern used for SIGUSR2, since that might otherwise appear to be a bug. Discussion: https://postgr.es/m/4006115.1618577212%40sss.pgh.pa.us
* Add missing source files to nls.mkPeter Eisentraut2021-04-18
|
* Use correct format placeholder for block numbersPeter Eisentraut2021-04-17
| | | | Should be %u rather than %d.
* Rethink extraction of collation dependencies.Tom Lane2021-04-16
| | | | | | | | | | | | | | | | | | | | | | | As it stands, find_expr_references_walker() pays attention to leaf-node collation fields while ignoring the input collations of actual function and operator nodes. That seems exactly backwards from a semantic standpoint, and it leads to reporting dependencies on collations that really have nothing to do with the expression's behavior. Hence, rewrite to look at function input collations instead. This isn't completely perfect either; it fails to account for the behavior of record_eq and its siblings. (The previous coding at least gave an approximation of that, though I think it could be fooled pretty easily into considering the columns of irrelevant composite types.) We may be able to improve on this later, but for now this should satisfy the buildfarm members that didn't like ef387bed8. In passing fix some oversights in GetTypeCollations(), and get rid of its duplicative de-duplications. (I'm worried that it's still potentially O(N^2) or worse, but this makes it a little better.) Discussion: https://postgr.es/m/3564817.1618420687@sss.pgh.pa.us
* Update dummy prosrc values.Tom Lane2021-04-16
| | | | | | | | | | Ooops, forgot to s/system_views.sql/system_functions.sql/g in this part of 767982e36. No need for an additional catversion bump, I think, since these strings are gone by the time initdb finishes. Discussion: https://postgr.es/m/3956760.1618529139@sss.pgh.pa.us
* Convert built-in SQL-language functions to SQL-standard-body style.Tom Lane2021-04-16
| | | | | | | | | | | | | | Adopt the new pre-parsed representation for all built-in and information_schema SQL-language functions, except for a small number that can't presently be converted because they have polymorphic arguments. This eliminates residual hazards around search-path safety of these functions, and might provide some small performance benefits by reducing parsing costs. It seems useful also to provide more test coverage for the SQL-standard-body feature. Discussion: https://postgr.es/m/3956760.1618529139@sss.pgh.pa.us
* Split function definitions out of system_views.sql into a new file.Tom Lane2021-04-16
| | | | | | | | | | | | Invent system_functions.sql to carry the function definitions that were formerly in system_views.sql. The function definitions were already a quarter of the file and are about to be more, so it seems appropriate to give them their own home. In passing, fix an oversight in dfb75e478: it neglected to call check_input() for system_constraints.sql. Discussion: https://postgr.es/m/3956760.1618529139@sss.pgh.pa.us
* Allow TestLib::slurp_file to skip contents, and use as neededAndrew Dunstan2021-04-16
| | | | | | | | | | | | | | | | | | | In order to avoid getting old logfile contents certain functions in PostgresNode were doing one of two things. On Windows it rotated the logfile and restarted the server, while elsewhere it truncated the log file. Both of these are unnecessary. We borrow from the buildfarm which does this instead: note the size of the logfile before we start, and then when fetching the logfile skip to that position before accumulating contents. This is spelled differently on Windows but the effect is the same. This is largely centralized in TestLib's slurp_file function, which has a new optional parameter, the offset to skip to before starting to reading the file. Code in the client becomes much neater. Backpatch to all live branches. Michael Paquier, slightly modified by me. Discussion: https://postgr.es/m/YHajnhcMAI3++pJL@paquier.xyz
* Fix bogus collation-version-recording logic.Tom Lane2021-04-16
| | | | | | | | | | | | | | | | | | | | | | | | | | recordMultipleDependencies had the wrong scope for its "version" variable, allowing a version label to leak from the collation entry it was meant for to subsequent non-collation entries. This is relatively hard to trigger because of the OID-descending order that the inputs will normally arrive in: subsequent non-collation items will tend to be pinned. But it can be exhibited easily with a custom collation. Also, don't special-case the default collation, but instead ignore pinned-ness of a collation when we've found a version for it. This avoids creating useless pg_depend entries, and removes a not-very- future-proof assumption that C, POSIX, and DEFAULT are the only pinned collations. A small problem is that, because the default collation may or may not have a version, the regression tests can't assume anything about whether dependency entries will be made for it. This seems OK though since it's now handled just the same as other collations, and we have test cases for both versioned and unversioned collations. Fixes oversights in commit 257836a75. Thanks to Julien Rouhaud for review. Discussion: https://postgr.es/m/3564817.1618420687@sss.pgh.pa.us
* Fix wrong units in two ExplainPropertyFloat calls.Tom Lane2021-04-16
| | | | | | | | | | This is only a latent bug, since these calls are only reached for non-text output formats, and currently none of those will print the units. Still, we should get it right in case that ever changes. Justin Pryzby Discussion: https://postgr.es/m/20210415163846.GA3315@telsasoft.com
* psql: Refine lexing of BEGIN...END blocks in CREATE FUNCTION statementsPeter Eisentraut2021-04-16
| | | | | | | | Only track BEGIN...END blocks if they are in a CREATE [OR REPLACE] {FUNCTION|PROCEDURE} statement. Ignore if in parentheses. Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at> Discussion: https://www.postgresql.org/message-id/cee01d26fe55bc086b3bcf10bfe4e8d450e2f608.camel@cybertec.at
* psql: Small fixes for better translatabilityPeter Eisentraut2021-04-16
|
* Add information of total data processed to replication slot stats.Amit Kapila2021-04-16
| | | | | | | | | | | | This adds the statistics about total transactions count and total transaction data logically sent to the decoding output plugin from ReorderBuffer. Users can query the pg_stat_replication_slots view to check these stats. Suggested-by: Andres Freund Author: Vignesh C and Amit Kapila Reviewed-by: Sawada Masahiko, Amit Kapila Discussion: https://postgr.es/m/20210319185247.ldebgpdaxsowiflw@alap3.anarazel.de
* Provide query source text when parsing a SQL-standard function body.Tom Lane2021-04-15
| | | | | | | Without this, we lose error cursor positions, as shown in the modified regression test result. Discussion: https://postgr.es/m/2197698.1617984583@sss.pgh.pa.us
* Revert "Cope with NULL query string in ExecInitParallelPlan()."Tom Lane2021-04-15
| | | | | | | | This reverts commit b3ee4c503872f3d0a5d6a7cbde48815f555af15b. We don't need it in the wake of the preceding commit, which added an upstream check that the querystring isn't null. Discussion: https://postgr.es/m/2197698.1617984583@sss.pgh.pa.us