aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
* Fix variable initialization when using buffering build with GiSTMichael Paquier2019-07-10
| | | | | | | | | | | | | | | | This can cause valgrind to complain, as the flag marking a buffer as a temporary copy was not getting initialized. While on it, fill in with zeros newly-created buffer pages. This does not matter when loading a block from a temporary file, but it makes the push of an index tuple into a new buffer page safer. This has been introduced by 1d27dcf, so backpatch all the way down to 9.4. Author: Alexander Lakhin Discussion: https://postgr.es/m/15899-0d24fb273b3dd90c@postgresql.org Backpatch-through: 9.4
* Fix missing calls to table_finish_bulk_insert during COPY, take 2David Rowley2019-07-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 86b85044e abstracted calls to heap functions in COPY FROM to support a generic table AM. However, when performing a copy into a partitioned table, this commit neglected to call table_finish_bulk_insert for each partition. Before 86b85044e, when we always called the heap functions, there was no need to call heapam_finish_bulk_insert for partitions since it only did any work when performing a copy without WAL. For partitioned tables, this was unsupported anyway, so there was no issue. With pluggable storage, we can't make any assumptions about what the table AM might want to do in its equivalent function, so we'd better ensure we always call table_finish_bulk_insert each partition that's received a row. For now, we make the table_finish_bulk_insert call whenever we evict a CopyMultiInsertBuffer out of the CopyMultiInsertInfo. This does mean that it's possible that we call table_finish_bulk_insert multiple times per partition, which is not a problem other than being an inefficiency. Improving this requires a more invasive patch, so let's leave that for another day. This also changes things so that we no longer needlessly call table_finish_bulk_insert when performing a COPY FROM for a non-partitioned table when not using multi-inserts. Reported-by: Robert Haas Backpatch-through: 12 Discussion: https://postgr.es/m/CA+TgmoYK=6BpxiJ0tN-p9wtH0BTAfbdxzHhwou0mdud4+BkYuQ@mail.gmail.com
* Fix few typos and minor wordsmithing in tableam comments.Amit Kapila2019-07-10
| | | | | | | | Reported-by: Ashwin Agrawal Author: Ashwin Agrawal Reviewed-by: Amit Kapila Backpatch-through: 12, where it was introduced Discussion: https://postgr.es/m/CALfoeisgdZhYDrJOukaBzvXfJOK2FQ0szVMK7dzmcy6w93iDUA@mail.gmail.com
* Pass QueryEnvironment down to EvalPlanQual's EState.Thomas Munro2019-07-10
| | | | | | | | | | | Otherwise the executor can't see trigger transition tables during EPQ evaluation. Fixes bug #15900 and almost certainly also #15720. Back-patch to 10, where trigger transition tables landed. Author: Alex Aktsipetrov Reviewed-by: Thomas Munro, Tom Lane Discussion: https://postgr.es/m/15900-bc482754fe8d7415%40postgresql.org Discussion: https://postgr.es/m/15720-38c2b29e5d720187%40postgresql.org
* Propagate trigger arguments to partitionsAlvaro Herrera2019-07-09
| | | | | | | | | | | | | We were creating the cloned triggers with an empty list of arguments, losing the ones that had been specified by the user when creating the trigger in the partitioned table. Repair. This was forgotten in commit 86f575948c77. Author: Patrick McHardy Reviewed-by: Tomas Vondra Discussion: https://postgr.es/m/20190709130027.amr2cavjvo7rdvac@access1.trash.net Discussion: https://postgr.es/m/15752-123bc90287986de4@postgresql.org
* Message style improvementsPeter Eisentraut2019-07-09
|
* Force hash joins to be enabled in the hash join regression tests.Thomas Munro2019-07-09
| | | | | | | | Otherwise the regressplans.sh tests generate extremely slow nested loop joins. Back-patch to 11 where the hash join tests came in. Reported-by: Michael Paquier Discussion: https://postgr.es/m/20190708055256.GB2709%40paquier.xyz
* Adjust ssl_ciphers to be specific to OpenSSLBruce Momjian2019-07-08
| | | | | | | | | | Syntax is OpenSSL-specific, so only use it for OpenSSL. Discussion: https://postgr.es/m/8232E273-7B25-47F4-B0E7-3D4264106F82@yesql.se Author: Daniel Gustafsson Backpatch-through: head
* Remove unused C structure memberBruce Momjian2019-07-08
| | | | | | | | | | Remove quote_all_identifiers from struct _dumpOptions. Discussion: https://postgr.es/m/d3d92ce9-78a4-8adb-0393-d3deeec29f7e@postgrespro.ru Author: Arthur Zakirov Backpatch-through: head
* tableam: Provide helper functions for relation sizing.Robert Haas2019-07-08
| | | | | | | | | | | | | Most block-based table AMs will need the exact same implementation of the relation_size callback as the heap, and if they use a standard page layout, they will likely need an implementation of the relation_estimate_size callback that is very similar to that of the heap. Rearrange to facilitate code reuse. Patch by me, reviewed by Michael Paquier, Daniel Gustafsson, and Álvaro Herrera. Discussion: http://postgr.es/m/CA+TgmoZ6DBPnP1E-vRpQZUJQijJFD54F+SR_pxGiAAS-MyrigA@mail.gmail.com
* Fix inconsistencies in the codeMichael Paquier2019-07-08
| | | | | | | | | | | This addresses a couple of issues in the code: - Typos and inconsistencies in comments and function declarations. - Removal of unreferenced function declarations. - Removal of unnecessary compile flags. - A cleanup error in regressplans.sh. Author: Alexander Lakhin Discussion: https://postgr.es/m/0c991fdf-2670-1997-c027-772a420c4604@gmail.com
* Use consistent style for checking return from system callsPeter Eisentraut2019-07-07
| | | | | | | | | | | | | | | | | Use if (something() != 0) error ... instead of just if (something) error ... The latter is not incorrect, but it's a bit confusing and not the common style. Discussion: https://www.postgresql.org/message-id/flat/5de61b6b-8be9-7771-0048-860328efe027%402ndquadrant.com
* Remove more unreferenced function declarationsMichael Paquier2019-07-07
| | | | | Author: Masahiko Sawada Discussion: https://postgr.es/m/CAD21AoDuAYsRb3Q9aobkFZ6DZMWxsyg4HOmgkwgeWNfSkTwGxw@mail.gmail.com
* In pg_log_generic(), be more paranoid about preserving errno.Tom Lane2019-07-06
| | | | | | | | | | This code failed to account for the possibility that malloc() would change errno, resulting in wrong output for %m, not to mention the possibility of message truncation. Such a change is obviously expected when malloc fails, but there's reason to fear that on some platforms even a successful malloc call can modify errno. Discussion: https://postgr.es/m/2576.1527382833@sss.pgh.pa.us
* Add missing source files to nls.mkPeter Eisentraut2019-07-06
|
* psql: Fix logging output formatPeter Eisentraut2019-07-06
| | | | | | | | | | In normal interactive mode, psql's log messages accidentally got a "psql:" prefix that was not supposed to be there. This only happened if there was no .psqlrc file being read, so it wasn't discovered for a while. Fix this by adding the appropriate logging format configuration call in the right code path. Discussion: https://www.postgresql.org/message-id/7586.1560540361@sss.pgh.pa.us
* Add missing assertions for required table am callbacks.Amit Kapila2019-07-06
| | | | | | | | Reported-by: Ashwin Agrawal Author: Ashwin Agrawal Reviewed-by: Amit Kapila Backpatch-through: 12, where it was introduced Discussion: https://postgr.es/m/CALfoeisgdZhYDrJOukaBzvXfJOK2FQ0szVMK7dzmcy6w93iDUA@mail.gmail.com
* Add some test cases to improve test coverage of parse_expr.c.Tom Lane2019-07-05
| | | | | | | | | | | I chanced to notice while thumbing through lcov reports that we had exactly no coverage of BETWEEN SYMMETRIC, nor of current_time(N) and localtime(N). Improve that. parse_expr.c still has a pretty awful coverage number, but a large part of that is due to lack of coverage of the operator_precedence_warning logic. I have zero desire to write tests for that; I think ripping it out would be more sensible at this point.
* Remove unreferenced function declarations.Tom Lane2019-07-05
| | | | | | | | These seem to be leftovers from old patches, perhaps. Masahiko Sawada Discussion: https://postgr.es/m/CAD21AoDuAYsRb3Q9aobkFZ6DZMWxsyg4HOmgkwgeWNfSkTwGxw@mail.gmail.com
* Remove dead encoding-conversion functions.Tom Lane2019-07-05
| | | | | | | | | | | | | | | | | | | | | The code for conversions SQL_ASCII <-> MULE_INTERNAL and SQL_ASCII <-> UTF8 was unreachable, because we long ago changed the wrapper functions pg_do_encoding_conversion() et al so that they have hard-wired behaviors for conversions involving SQL_ASCII. (At least some of those fast paths date back to 2002, though it looks like we may not have been totally consistent about this until later.) Given the lack of complaints, nobody is dissatisfied with this state of affairs. Hence, let's just remove the unreachable code. Also, change CREATE CONVERSION so that it rejects attempts to define such conversions. Since we consider that SQL_ASCII represents lack of knowledge about the encoding in use, such a conversion would be semantically dubious even if it were reachable. Adjust a couple of regression test cases that had randomly decided to rely on these conversion functions rather than any other ones. Discussion: https://postgr.es/m/41163.1559156593@sss.pgh.pa.us
* Remove unused variable in statext_mcv_serialize()Tomas Vondra2019-07-05
| | | | | | | | | | | The itemlen variable used to be referenced in multiple places, but since reworking the serialization code it's used only in one assert. Fixed by removing the variable and calling the macro from the assert directly. Backpatch to 12, where this code was introduced. Reported-by: Jeff Janes Discussion: https://postgr.es/m/CAMkU=1zc_ovH9NZd_9ovuiEWkF9yX06URUDdXCmgDydf-bqB5A@mail.gmail.com
* Add \warn command to psql.Tom Lane2019-07-05
| | | | | | | | | | | | | This is like \echo except that the text is sent to stderr not stdout. In passing, fix a pre-existing bug in \echo and \qecho: per documentation the -n switch should only be recognized when it is the first argument, but actually any argument matching "-n" was treated as a switch. (Should we back-patch that?) David Fetter (bug fix by me), reviewed by Fabien Coelho Discussion: https://postgr.es/m/20190421183115.GA4311@fetter.org
* Improve comment in postgresql.conf.sample.Thomas Munro2019-07-05
| | | | | The Unix manual section that "man tcp" appears in varies, so let's just leave it out of the command to run.
* Add min() and max() aggregates for pg_lsnMichael Paquier2019-07-05
| | | | | | | | | | | | This is useful for monitoring, when it comes for example to calculations of WAL retention with replication slots and delays with a set of standbys. Bump catalog version. Author: Fabrízio de Royes Mello Reviewed-by: Surafel Temesgen Discussion: https://postgr.es/m/CAFcNs+oc8ZoHhowA4rR1GGCgG8QNgK_TOwPRVYQo5rYy8_PXzA@mail.gmail.com
* Update hardcoded DH parameters to IANA standardsMichael Paquier2019-07-05
| | | | | | | | | | The source defining the current fallback and hardcoded DH parameters has disappeared from the web a long time ago, and RFC 3526 defines the most current Diffie-Hellman MODP groups, so update to those new values. Author: Daniel Gustafsson Reviewed-by: Peter Eisentraut, Michael Paquier Discussion: https://postgr.es/m/5E60AC9A-CB10-4851-9EF2-7209490A164C@yesql.se
* Simplify pg_mcv_list (de)serializationTomas Vondra2019-07-05
| | | | | | | | | | | | | | | | | | | | The serialization format of multivariate MCV lists included alignment in order to allow direct access to part of the serialized data, but despite multiple fixes (see for example commits d85e0f366a and ea4e1c0e8f) this proved to be problematic. This commit abandons alignment in the serialized format, and just copies everything during deserialization. We now also track amount of memory needed after deserialization (including alignment), which allows us to deserialize the MCV list in a single pass. Bump catversion, as this affects contents of pg_statistic_ext_data. Backpatch to 12, where multi-column MCV lists were introduced. Author: Tomas Vondra Reviewed-by: Tom Lane Discussion: https://postgr.es/m/2201.1561521148@sss.pgh.pa.us
* Fix pg_mcv_list_items() to produce text[]Tomas Vondra2019-07-05
| | | | | | | | | | | | | | | | | | The function pg_mcv_list_items() returns values stored in MCV items. The items may contain columns with different data types, so the function was generating text array-like representation, but in an ad-hoc way without properly escaping various characters etc. Fixed by simply building a text[] array, which also makes it easier to use from queries etc. Requires changes to pg_proc entry, so bump catversion. Backpatch to 12, where multi-column MCV lists were introduced. Author: Tomas Vondra Reviewed-by: Dean Rasheed Discussion: https://postgr.es/m/20190618205920.qtlzcu73whfpfqne@development
* Speed-up build of MCV lists with many distinct valuesTomas Vondra2019-07-05
| | | | | | | | | | | | | | | | | When building multi-column MCV lists, we compute base frequency for each item, i.e. a product of per-column frequencies for values from the item. As a value may be in multiple groups, the code was scanning the whole array of groups while adding items to the MCV list. This works fine as long as the number of distinct groups is small, but it's easy to trigger trigger O(N^2) behavior, especially after increasing statistics target. This commit precomputes frequencies for values in all columns, so that when computing the base frequency it's enough to make a simple bsearch lookup in the array. Backpatch to 12, where multi-column MCV lists were introduced. Discussion: https://postgr.es/m/20190618205920.qtlzcu73whfpfqne@development
* Remove unnecessary casts from size_t to intPeter Eisentraut2019-07-04
| | | | We can use the %zu format specifier directly, no need to cast to int.
* Unwind some workarounds for lack of portable int64 format specifierPeter Eisentraut2019-07-04
| | | | | | | | | | | | | | Because there is no portable int64/uint64 format specifier and we can't stick macros like INT64_FORMAT into the middle of a translatable string, we have been using various workarounds that put the number to be printed into a string buffer first. Now that we always use our own sprintf(), we can rely on %lld and %llu to work, so we can use those. This patch undoes this workaround in a few places where it was egregiously verbose. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/CAH2-Wz%3DWbNxc5ob5NJ9yqo2RMJ0q4HXDS30GVCobeCvC9A1L9A%40mail.gmail.com
* Sync our Snowball stemmer dictionaries with current upstreamPeter Eisentraut2019-07-04
| | | | | | | The main change is a new stemmer for Greek. There are minor changes in the Danish and French stemmers. Author: Panagiotis Mavrogiorgos <pmav99@gmail.com>
* Clean up whitespace a bitPeter Eisentraut2019-07-04
|
* Introduce safer encoding and decoding routines for base64.cMichael Paquier2019-07-04
| | | | | | | | | | | | | | | | | | | This is a follow-up refactoring after 09ec55b and b674211, which has proved that the encoding and decoding routines used by SCRAM have a poor interface when it comes to check after buffer overflows. This adds an extra argument in the shape of the length of the result buffer for each routine, which is used for overflow checks when encoding or decoding an input string. The original idea comes from Tom Lane. As a result of that, the encoding routine can now fail, so all its callers are adjusted to generate proper error messages in case of problems. On failure, the result buffer gets zeroed. Author: Michael Paquier Reviewed-by: Daniel Gustafsson Discussion: https://postgr.es/m/20190623132535.GB1628@paquier.xyz
* Simplify TAP tests of pg_dump for connection stringsMichael Paquier2019-07-04
| | | | | | | | | | | | | | | | | | | The last set of scenarios did an initialization of nodes followed by an extra command to set up the authentication policy with pg_regress --config-auth. This configuration step can be integrated directly using the option auth_extra from PostgresNode::init when initializing the node, saving from one extra command. On Windows, this also restricts more pg_ident.conf for the SSPI user mapping by removing the entry of the OS user running the test, which is not needed anyway. Note that IPC::Run mishandles double quotes, hence the restore user name is changed to map with that. This was already done in the test as a later step, but not in a consistent way, causing the switch to use auth_extra to fail. Found while reviewing ca129e5. Discussion: https://postgr.es/m/20190703062024.GD3084@paquier.xyz
* Use appendStringInfoString and appendPQExpBufferStr where possibleDavid Rowley2019-07-04
| | | | | | | | | | This changes various places where appendPQExpBuffer was used in places where it was possible to use appendPQExpBufferStr, and likewise for appendStringInfo and appendStringInfoString. This is really just a stylistic improvement, but there are also small performance gains to be had from doing this. Discussion: http://postgr.es/m/CAKJS1f9P=M-3ULmPvr8iCno8yvfDViHibJjpriHU8+SXUgeZ=w@mail.gmail.com
* Ensure plpgsql result tuples have the right composite type marking.Tom Lane2019-07-03
| | | | | | | | | | | | | | | | | | | | | | | A function that is declared to return a named composite type must return tuple datums that are physically marked as having that type. The plpgsql code path that allowed directly returning an expanded-record datum forgot to check that, so that an expanded record marked as type RECORDOID could be returned if it had a physically-compatible tupdesc. This'd be harmless, I think, if the record value never escaped the current session --- but it's possible for it to get stored into a table, and then subsequent sessions can't interpret the anonymous record type. Fix by flattening the record into a tuple datum and overwriting its type/typmod fields, if its declared type doesn't match the function's declared type. (In principle it might be possible to just change the expanded record's stored type ID info, but there are enough tricky consequences that I didn't want to mess with that, especially not in a back-patched bug fix.) Per bug report from Steve Rogerson. Back-patch to v11 where the bug was introduced. Discussion: https://postgr.es/m/cbaecae6-7b87-584e-45f6-4d047b92ca2a@yewtc.demon.co.uk
* Show table persistence in psql's \dt+ and related commands.Tom Lane2019-07-03
| | | | | | | | | | In verbose mode, listTables() now emits a "Persistence" column showing whether the table/index/view/etc is permanent, temporary, or unlogged. David Fetter, reviewed by Fabien Coelho and Rafia Sabih Discussion: https://postgr.es/m/20190423005642.GZ28936@fetter.org
* Don't remove surplus columns from GROUP BY for inheritance parentsDavid Rowley2019-07-03
| | | | | | | | | | | | | | | | | | | d4c3a156c added code to remove columns that were not part of a table's PRIMARY KEY constraint from the GROUP BY clause when all the primary key columns were present in the group by. This is fine to do since we know that there will only be one row per group coming from this relation. However, the logic failed to consider inheritance parent relations. These can have child relations without a primary key, but even if they did, they could duplicate one of the parent's rows or one from another child relation. In this case, those additional GROUP BY columns are required. Fix this by disabling the optimization for inheritance parent tables. In v11 and beyond, partitioned tables are fine since partitions cannot overlap and before v11 partitioned tables could not have a primary key. Reported-by: Manuel Rigger Discussion: http://postgr.es/m/CA+u7OA7VLKf_vEr6kLF3MnWSA9LToJYncgpNX2tQ-oWzYCBQAw@mail.gmail.com Backpatch-through: 9.6
* Fix small memory leak in ecpglib ecpg_update_declare_statement() is called theMichael Meskes2019-07-03
| | | | | | second time. Author: "Zhang, Jie" <zhangjie2@cn.fujitsu.com>
* Use strtoint() instead of strtol() in pgtypeslib where the result is stored inMichael Meskes2019-07-03
| | | | | | an int variable. Author: Yang Xiao <YangX92@hotmail.com>
* Made ecpg compatibility mode and run-time behaviour options case insensitive.Michael Meskes2019-07-03
|
* Fix accidentally swapped error message argumentsPeter Eisentraut2019-07-02
| | | | Author: Alexey Kondratov <a.kondratov@postgrespro.ru>
* Remove redundant newlines from error messagesPeter Eisentraut2019-07-02
| | | | These are no longer needed/allowed with the new logging API.
* Don't treat complete_from_const as equivalent to complete_from_list.Tom Lane2019-07-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 4f3b38fe2 supposed that complete_from_const() is equivalent to the one-element-list case of complete_from_list(), but that's not really true at all. complete_from_const() supposes that the completion is certain enough to justify wiping out whatever the user typed, while complete_from_list() will only provide completions that match the word-so-far. In practice, given the lame parsing technology used by tab-complete.c, it's fairly hard to believe that we're *ever* certain enough about a completion to justify auto-correcting user input that doesn't match. Hence, remove the inappropriate unification of the two cases. As things now stand, complete_from_const() is used only for the situation where we have no matches and we need to keep readline from applying its default complete-with-file-names behavior. This (mis?) behavior actually exists much further back, but I'm hesitant to change it in released branches. It's not too late for v12, though, especially seeing that the aforesaid commit is new in v12. Per gripe from Ken Tanzer. Discussion: https://postgr.es/m/CAD3a31XpXzrZA9TT3BqLSHghdTK+=cXjNCE+oL2Zn4+oWoc=qA@mail.gmail.com
* Fix tab completion of "SET variable TO|=" to not offer bogus completions.Tom Lane2019-07-02
| | | | | | | | | | | | | | | | Don't think that the context "UPDATE tab SET var =" is a GUC-setting command. If we have "SET var =" but the "var" is not a known GUC variable, don't offer any completions. The most likely explanation is that we've misparsed the context and it's not really a GUC-setting command. Per gripe from Ken Tanzer. Back-patch to 9.6. The issue exists further back, but before 9.6 the code looks very different and it doesn't actually know whether the "var" name matches anything, so I desisted from trying to fix it. Discussion: https://postgr.es/m/CAD3a31XpXzrZA9TT3BqLSHghdTK+=cXjNCE+oL2Zn4+oWoc=qA@mail.gmail.com
* Simplify psql \d's rule for ordering the indexes of a table.Tom Lane2019-07-02
| | | | | | | | | | | | | | | | | | | | The previous rule was "primary key (if any) first, then other unique indexes in name order, then all other indexes in name order". But the preference for unique indexes seems a bit obsolete since the introduction of exclusion constraints. It's no longer the case that unique indexes are the only ones that constrain what data can be in the table, and it's hard to see what other rationale there is for separating out unique indexes. Other new features like the possibility for some indexes to be INVALID (hence, not constraining anything) make this even shakier. Hence, simplify the sort order to be "primary key (if any) first, then all other indexes in name order". No documentation change, since this was never documented anyway. A couple of existing regression test cases change output, though. Discussion: https://postgr.es/m/14422.1561474929@sss.pgh.pa.us
* Remove obsolete nbtree "get root" comment.Peter Geoghegan2019-07-01
| | | | | | | | Remove a very old Berkeley era comment that doesn't seem to have anything to do with the current locking considerations within _bt_getroot(). Discussion: https://postgr.es/m/CAH2-WzmA2H+rL-xxF5o6QhMD+9x6cJTnz2Mr3Li_pbPBmqoTBQ@mail.gmail.com
* Add support for Visual Studio 2019 in build scriptsMichael Paquier2019-07-02
| | | | | | | | | | | This fixes at the same time a set of inconsistencies in the documentation and the scripts related to the versions of Windows SDK supported. Author: Haribabu Kommi Reviewed-by: Andrew Dunstan, Juan José Santamaría Flecha, Michael Paquier Discussion: https://postgr.es/m/CAJrrPGcfqXhfPyMrny9apoDU7M1t59dzVAvoJ9AeAh5BJi+UzA@mail.gmail.com
* Refactor code of reindexdb for query generationMichael Paquier2019-07-02
| | | | | | | | | | | | | | This merges the portion related to REINDEX SYSTEM into the routine already available for all the other reindex types, making the query generation cleaner. While on it, change the handling of the reindex types using an enum, which allows to get rid of the hardcoded strings used directly in the query generation present for the same purpose (aka "TABLE", "DATABASE", etc.). Per discussion with Julien Rouhaud, Tom Lane, Alvaro Herrera and me. Author: Julien Rouhaud Discussion: https://postgr.es/m/CAOBaU_bSmSik_WRK9niDnm-3NkNZky6+uKxkmQwvthZvMWpS5A@mail.gmail.com
* Remove support for non-ELF BSD systemsPeter Eisentraut2019-07-01
| | | | | | This is long obsolete. Discussion: https://www.postgresql.org/message-id/8eacdc0d-123f-dbca-bacf-0a68766a4889@2ndquadrant.com