summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-06-06pg_waldump: Fix invalid option handlingHEADmasterPeter Eisentraut
Previously, running pg_waldump with an invalid option (pg_waldump --foo) would print the help output and exit successfully. This was because it tried to process the option letter '?' as a normal option, but that letter is used by getopt() to report an invalid option. To fix, process help and version options separately, like we do everywhere else. Also add a basic test suite for pg_waldump and run the basic option handling tests, which would have caught this.
2019-06-06Fix confusion on different kinds of slots in IndexOnlyScans.Heikki Linnakangas
We used the same slot to store a tuple from the index, and to store a tuple from the table. That's not OK. It worked with the heap, because heapam_getnextslot() stores a HeapTuple to the slot, and doesn't care how large the tts_values/nulls arrays are. But when I played with a toy table AM implementation that used a virtual tuple, it caused memory overruns. In the passing, tidy up comments on the ioss_PscanLen fields.
2019-06-06Docs: concurrent builds of partitioned indexes are not supportedDavid Rowley
Document that CREATE INDEX CONCURRENTLY is not currently supported for indexes on partitioned tables. Discussion: https://postgr.es/m/CAKJS1f_CErd2z9L21Q8OGLD4TgH7yw1z9MAtHTSO13sXVG-yow@mail.gmail.com Backpatch-through: 11
2019-06-05doc: Add links to tablesPeter Eisentraut
Formal tables should generally have an xref in the text that points to them. Add them here.
2019-06-05Fix confusing NOTICE text in REINDEX CONCURRENTLYDavid Rowley
When performing REINDEX TABLE CONCURRENTLY, if all of the table's indexes could not be reindexed, a NOTICE message claimed that the table had no indexes. This was confusing, so let's change the NOTICE text to something less confusing. In passing, also mention in the comment before ReindexRelationConcurrently that materialized views are supported too and also explain what the return value of the function means. Author: Ashwin Agrawal Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/CALfoeithHvi13p_VyR8kt9o6Pa7Z=Smi6Nfc2anHnQx5Lj8bTQ@mail.gmail.com
2019-06-05Fix incorrect index behavior in COPY FROM with partitioned tablesDavid Rowley
86b85044e rewrote how COPY FROM works to allow multiple tuple buffers to exist to once thus allowing multi-inserts to be used in more cases with partitioned tables. That commit neglected to update the estate's es_result_relation_info when flushing the insert buffer to the partition making it possible for the index tuples to be added into an index on the wrong partition. Fix this and also add an Assert in ExecInsertIndexTuples to help ensure that we never make this mistake again. Reported-by: Haruka Takatsuka Author: Ashutosh Sharma Discussion: https://postgr.es/m/[email protected]
2019-06-05Rework code using list_delete_cell() in MergeAttributesMichael Paquier
When merging two attributes, we are sure that at least one remains. However, when deleting one element in the attribute list we may finish with an empty list returned as NIL by list_delete_cell(), but the code failed to track that, which is not project-like. Adjust the call so as we check for an empty list, and make use of it in an assertion. This has been introduced by e7b3349, when adding support for CREATE TABLE OF. Author: Mark Dilger Reviewed-by: Álvaro Herrera, Michael Paquier Discussion: https://postgr.es/m/CAE-h2TpPDqSWgOvfvSziOaMngMPwW+QZcmPpY8hQ_KOJ2+3hXQ@mail.gmail.com
2019-06-04Document piecemeal construction of partitioned indexesAlvaro Herrera
Continuous operation cannot be achieved without applying this technique, so it needs to be properly described. Author: Álvaro Herrera Reported-by: Tom Lane Discussion: https://postgr.es/m/[email protected]
2019-06-04doc: Fix whitespacePeter Eisentraut
Verbatim environment tags should not be indented.
2019-06-04Add command column to pg_stat_progress_create_indexPeter Eisentraut
This allows determining which command is running, similar to pg_stat_progress_cluster. Discussion: https://www.postgresql.org/message-id/flat/f0e56b3b-74b7-6cbc-e207-a5ed6bee18dc%402ndquadrant.com
2019-06-04Fix some typos and inconsistencies in tableam.hMichael Paquier
The defined callback definitions have been using references to heap for a couple of variables and comments. This makes the whole interface more consistent by using "table" which is more generic. A variable storing index information was misspelled as well. Author: Michael Paquier Discussion: https://postgr.es/m/[email protected]
2019-06-03Fix contrib/auto_explain to not cause problems in parallel workers.Tom Lane
A parallel worker process should not be making any decisions of its own about whether to auto-explain. If the parent session process passed down flags asking for instrumentation data, do that, otherwise not. Trying to enable instrumentation anyway leads to bugs like the "could not find key N in shm TOC" failure reported in bug #15821 from Christian Hofstaedtler. We can implement this cheaply by piggybacking on the existing logic for not doing anything when we've chosen not to sample a statement. While at it, clean up some tin-eared coding related to the sampling feature, including an off-by-one error that meant that asking for 1.0 sampling rate didn't actually result in sampling every statement. Although the specific case reported here only manifested in >= v11, I believe that related misbehaviors can be demonstrated in any version that has parallel query; and the off-by-one error is certainly there back to 9.6 where that feature was added. So back-patch to 9.6. Discussion: https://postgr.es/m/[email protected]
2019-06-03Fix unsafe memory management in CloneRowTriggersToPartition().Tom Lane
It's not really supported to call systable_getnext() in a different memory context than systable_beginscan() was called in, and it's *definitely* not safe to do so and then reset that context between calls. I'm not very clear on how this code survived CLOBBER_CACHE_ALWAYS testing ... but Alexander Lakhin found a case that would crash it pretty reliably. Per bug #15828. Fix, and backpatch to v11 where this code came in. Discussion: https://postgr.es/m/[email protected]
2019-06-03Update SQL conformance information about JSON pathPeter Eisentraut
Reviewed-by: Oleg Bartunov <[email protected]>
2019-06-03Fix typos in various placesMichael Paquier
Author: Andrea Gelmini Reviewed-by: Michael Paquier, Justin Pryzby Discussion: https://postgr.es/m/20190528181718.GA39034@glet
2019-06-03Fix some issues and improve psql completion for access methodsMichael Paquier
The following issues have been spotted: - CREATE INDEX .. USING suggests both index and table AMs, but it should consider only index AMs. - CREATE TABLE .. USING has no completion support. USING was not being included in the completion list where it should, and follow-up suggestions for table AMs have been missing as well. - CREATE ACCESS METHOD .. TYPE suggests only INDEX, with TABLE missing. Author: Michael Paquier Discussion: https://postgr.es/m/[email protected]
2019-06-02Make cpluspluscheck more portable.Tom Lane
Teach it to scrape -I and -D switches from CPPFLAGS in Makefile.global. This is useful for testing on, eg, FreeBSD, where you won't get far without "-I/usr/local/include". Also, expand the set of blacklisted-for-unportability atomics headers, based on noting that arch-x86.h fails to compile on an ARM box. The other ones I'd omitted seem to compile all right on architectures they don't belong to, but that's surely too shaky to rely on. Let's do like we did for the src/include/port/ headers, and ignore all except the variant that's pulled in by the arch-independent header.
2019-06-02Clean up PL/Perl's handling of the _() macro.Tom Lane
Perl likes to redefine the _() macro: #ifdef CAN_PROTOTYPE #define _(args) args #else ... There was lots not to like about the way we dealt with this before: 1. Instead of taking care of the conflict centrally in plperl.h, we expected every one of its ever-growing number of includers to do so. This is duplicative and error-prone in itself, plus it means that plperl.h fails to meet the expectation of being compilable standalone, resulting in macro-redefinition warnings in cpluspluscheck. 2. We left _() with its Perl definition, meaning that if someone tried to use it in any Perl-related extension, it would silently fail to provide run-time translation. I don't see any live bugs of this ilk, but it's clearly a hard-to-notice bug waiting to happen. So fix that by centralizing the cleanup logic, making it match what we're already doing for other macro conflicts with Perl. Since we only expect plperl.h to be included by extensions not core code, we should redefine _() as dgettext() not gettext().
2019-06-02worker_spi needs a .gitignore file now.Tom Lane
2019-06-02Un-break ecpg tests for Windows.Tom Lane
Declaring a function "inline" still doesn't work with Windows compilers (C99? what's that?), unless the macro provided by pg_config.h is in-scope, which it is not in our ECPG test programs. So the workaround I tried to use in commit 7640f9312 doesn't work for Windows. Revert the change in printf_hack.h, and instead just blacklist that file in cpluspluscheck --- since it's a not-installed test file, we don't really need to verify its C++ cleanliness anyway.
2019-06-02Increase test coverage for worker_spi by ∞%Alvaro Herrera
This test module was not getting invoked, other than at compile time, limiting its usefulness -- and keeping its coverage at 0%. Add a minimal regression test to ensure it runs on make check-world; this makes it 92% covered (line-wise), which seems sufficient. Author: Álvaro Herrera <[email protected]> Reviewed-by: Tom Lane <[email protected]> Discussion: https://postgr.es/m/[email protected]
2019-06-01Fix documentation of check_option in information_schema.viewsMichael Paquier
Support of CHECK OPTION for updatable views has been added in 9.4, but the documentation of information_schema never got the call even if the information displayed is correct. Author: Gilles Darold Discussion: https://postgr.es/m/[email protected] Backpatch-through: 9.4
2019-05-31Improve coverage of cpluspluscheck.Tom Lane
Formerly, cpluspluscheck was only meant to examine headers that we thought of as exported --- but its notion of what we export was well behind the times. Let's just make it check *all* .h files, except for a well-defined blacklist, instead. While at it, improve its ability to use a C++ compiler other than g++, by scraping the CXX setting from Makefile.global and making it possible to override the warning options used (per suggestion from Andres Freund). Discussion: https://postgr.es/m/[email protected]
2019-05-31Integrate cpluspluscheck into build system.Andres Freund
Previously cpluspluscheck wouldn't work in vpath builds, this commit fixes that. To make it easier to invoke, there's a top-level cpluspluscheck target. Discussion: https://postgr.es/[email protected]
2019-05-31Fix incorrect parameter name in commentDavid Rowley
Author: Antonin Houska Discussion: https://postgr.es/m/22370.1559293357@localhost
2019-05-31Adjust ecpg expected-results files for commit 7640f9312.Tom Lane
Mea culpa for not rechecking check-world at the last step :-( Per buildfarm.
2019-05-31Fix C++ incompatibilities in ecpg/preproc/ header files.Tom Lane
There's probably no need to back-patch this, since it seems unlikely that anybody would be inserting C++ code into ecpg's preprocessor. Discussion: https://postgr.es/m/[email protected]
2019-05-31Fix C++ incompatibilities in plpgsql's header files.Tom Lane
Rename some exposed parameters so that they don't conflict with C++ reserved words. Back-patch to all supported versions. George Tarasov Discussion: https://postgr.es/m/[email protected]
2019-05-31Fix assorted header files that failed to compile standalone.Tom Lane
We have a longstanding project convention that all .h files should be includable with no prerequisites other than postgres.h. This is tested/relied-on by cpluspluscheck. However, cpluspluscheck has not historically been applied to most headers outside the src/include tree, with the predictable consequence that some of them don't work. Fix that, usually by adding missing #include dependencies. The change in printf_hack.h might require some explanation: without it, my C++ compiler whines that the function is unused. There's not so many call sites that "inline" is going to cost much, and besides all the callers are in test code that we really don't care about the size of. There's no actual bugs being fixed here, so I see no need to back-patch. Discussion: https://postgr.es/m/[email protected]
2019-05-31Make our perfect hash functions be valid C++.Tom Lane
While C is happy to cast "const void *" to "const unsigned char *" silently, C++ insists on an explicit cast. Since we put these functions into header files, cpluspluscheck whines about that. Add the cast to pacify it. Discussion: https://postgr.es/m/[email protected]
2019-05-31Fix double-phrase typo in messageAlvaro Herrera
New in 147e3722f7e5.
2019-05-30Rework options of pg_checksums options for filenode handlingMichael Paquier
This makes the tool consistent with the option set of oid2name, which has been historically using -f for filenodes, and has more recently gained long options and --filenode via 1aaf532. Reported-by: Peter Eisentraut Author: Fabien Coelho Discussion: https://postgr.es/m/[email protected]
2019-05-30Remove unnecessary (and wrong) forward declaration.Andres Freund
Interestingly only C++ compilers have, so far, complained about this odd forward declaration. This originated when IndexBuildCallback was defined in another file, but now is completely unnecessary (but was wrong before too, cpluspluscheck just wouldn't have noticed). Reported-By: Tom Lane Discussion: https://postgr.es/m/[email protected]
2019-05-30Make error logging in extended statistics more consistentTomas Vondra
Most errors reported in extended statistics are internal issues, and so should use elog(). The MCV list code was already following this rule, but the functional dependencies and ndistinct coefficients were using a mix of elog() and ereport(). Fix this by changing most places to elog(), with the exception of input functions. This is a mostly cosmetic change, it makes the life a little bit easier for translators, as elog() messages are not translated. So backpatch to PostgreSQL 10, where extended statistics were introduced. Author: Tomas Vondra Backpatch-through: 10 where extended statistics were added Discussion: https://postgr.es/m/[email protected]
2019-05-29Fix some documentation about access methodsMichael Paquier
Author: Guillaume Lelarge Discussion: https://postgr.es/m/CAECtzeWPz4JikzUqZdMjqPTe8dAP3nZxPD-58Y-Hhvirg0fF+A@mail.gmail.com
2019-05-29Fix some documentation about FKs and partitioned tablesMichael Paquier
This got forgotten in f56f8f which has added foreign key support for partitioned tables. In passing, add a mention about caveats applying to tables partitioned using inheritance regarding indexes and foreign keys. Author: Paul A Jungwirth Reviewed-by: Amit Langote, Michael Paquier Discussion: https://postgr.es/m/CA+renyUuSmYgmZjKc_DfUNVZ0uttF91-FwhDVW3F7WEPj0jL5w@mail.gmail.com
2019-05-29Make one message just like all its siblings.Alvaro Herrera
2019-05-28Fix typo in messageAlvaro Herrera
I introduced the typo in source code in the course of 75445c1515ff. Repair.
2019-05-28In the pg_upgrade test suite, don't write to src/test/regress.Noah Misch
When this suite runs installcheck, redirect file creations from src/test/regress to src/bin/pg_upgrade/tmp_check/regress. This closes a race condition in "make -j check-world". If the pg_upgrade suite wrote to a given src/test/regress/results file in parallel with the regular src/test/regress invocation writing it, a test failed spuriously. Even without parallelism, in "make -k check-world", the suite finishing second overwrote the other's regression.diffs. This revealed test "largeobject" assuming @abs_builddir@ is getcwd(), so fix that, too. Buildfarm client REL_10, released fifty-four days ago, supports saving regression.diffs from its new location. When an older client reports a pg_upgradeCheck failure, it will no longer include regression.diffs. Back-patch to 9.5, where pg_upgrade moved to src/bin. Reviewed (in earlier versions) by Andrew Dunstan. Discussion: https://postgr.es/m/[email protected]
2019-05-28In the pg_upgrade test suite, remove and recreate "tmp_check".Noah Misch
This allows "vcregress upgradecheck" to pass twice in immediate succession, and it's more like how $(prove_check) works. Back-patch to 9.5, where pg_upgrade moved to src/bin. Discussion: https://postgr.es/m/[email protected]
2019-05-28v12 release notes: Correct contributor name.Andres Freund
Mea culpa.
2019-05-28Fix commentPeter Eisentraut
This code block was copied/adapted from other similar places but somehow the comment placement was changed so that it makes less sense.
2019-05-28docs: PG 12 relnote wording fixBruce Momjian
Reported-by: Gaby Schilders
2019-05-28Fix typos in SQL scripts of pgcryptoMichael Paquier
Author: Gurjeet Singh Discussion: https://postgr.es/m/CABwTF4U_5kEnH93PXZEuEsZHuoSSuBEOqC6pian8vDfLZSQJNA@mail.gmail.com
2019-05-27doc: Fix generated column documentationPeter Eisentraut
The old text still had an implicit reference to the virtual behavior, which was not in the final patch. Author: Tobias Bussmann <[email protected]>
2019-05-26Fix more thinkos in new ECPG "PREPARE AS" code.Tom Lane
ecpg_build_params() failed to check for ecpg_alloc failure in one newly-added code path, and leaked a temporary string in another path. Errors in commit a1dc6ab46, spotted by Coverity.
2019-05-26Fix thinko in new ECPG "PREPARE AS" code.Tom Lane
ecpg_register_prepared_stmt() is pretty obviously checking the wrong variable while trying to detect malloc failure. Error in commit a1dc6ab46, spotted by Coverity.
2019-05-26Fix typos.Amit Kapila
Reported-by: Alexander Lakhin Author: Alexander Lakhin Reviewed-by: Amit Kapila and Tom Lane Discussion: https://postgr.es/m/[email protected]
2019-05-26Change Graphviz file extensionPeter Eisentraut
Change extension for Graphviz files from .dot to .gv. The latter appears to be the generally preferred one nowadays. Discussion: https://www.postgresql.org/message-id/flat/71fe76d2-c7d7-2acc-6762-bbf9e61c566e%402ndquadrant.com
2019-05-25Doc: fix incorrect references in PG 12 release notes.Amit Kapila
Reported-by: Euler Taveira Author: Euler Taveira Discussion: https://postgr.es/m/CAHE3wgjiA8DdnUzH9WqBLxdrUVvjDkKNdHx-MkEg9uV+HtpMfg@mail.gmail.com