summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-08-24Accept regression differences in polymorphism test casePavan Deolasee
As with other test cases, accept the lack of NOTICEs in the test case. This issue needs to be investigated, but surely this is not the only test case that's suffering from this behavioural change. So accept for now and change later once (and when) we fix the NOTICE problem.
2017-08-24Fix identity test casePavan Deolasee
Accept some differences as the identity column is also used distribution column and hence updates are disallowed in XL. So accept those differences (we should later add XL-specific test cases by having identity in non-distribution column). Also add ORDER BY in some select queries to ensure consistent ordering of the result
2017-08-22Accept regression differences in largeobject test casePavan Deolasee
Since large objects are not supported by XL, these were mostly cosmetic differences without any possible bug.
2017-08-22Handle rescan of RemoteQuery node correctlyPavan Deolasee
We never had this support and we never felt the need because the use of FQS was limited for utility statements and simple queries which can be completed pushed down to the remote node. But in PG 10, we're seeing errors while using cursors for queries which are FQSed. So instead of forcing regular remote subplan on such queries, we are adding support for rescan of RemoteQuery node. Patch by Senhu <senhu@tencent.com>
2017-08-22Do not FQS NextValueExprPavan Deolasee
The target datanode must be determined after computing the next value. So let is go through regular planning. This fixes couple of regression failures.
2017-08-21Add missing sys/wait.h include to pgxc_monitorTomas Vondra
Without this include, the build on FreeBSD fails due to missing definition of WEXITSTATUS.
2017-08-21Make make_signature fail if any of the commands failsTomas Vondra
The make_signature executes a number of commands, but does not check return values. While the commands are simple and unlikely to fail, add 'set -e' to prevent strange failures if that ever happens.
2017-08-21Use sed instead of ex in make_signature scriptTomas Vondra
The make_signature script was using ex, which is part of vi editor and seems to be less portable than sed, particularly when considering BSD systems (e.g. FreeBSD). It lacks some of the GNU/Linux improvements, causing failures of the script. We also do not check existence of the command in configure, so it may be missing entirely. Switching to sed fixes both those issues - it seems more portable, and we already check it's availability in configure. Patch contributed by John Schneider <john.a.schneider@gmail.com>, additional comments and input by Jov <amutu@amutu.com>.
2017-08-21Fix portals test casePavan Deolasee
Accept expected output changes which were missed because we've an alternate expected output file which is not merged automatically. The changes simply include an additional Project node in the explain node.
2017-08-21Fix insert test casePavan Deolasee
Various things are done to ensure that the test case passes. Some of these changes are not truly correct because we might not be testing what the original test case was supposed to test, but given the limitations that we've imposed on partition table column positions etc, this is inevitable - accept some output changes because certain features (such as triggers) not supported. - make changes to column ordering so that partitions can be attached - avoid dropping/adding columns which will change column ordering - accept additional information displayed by \d+ command
2017-08-21Cast ExecRemoteQuery parameters to (PlanState *) in contribTomas Vondra
Commit d66ec8f444000f861fc3b35e0c65adbd74fd434c fixed ExecRemoteQuery calls by explicitly casting the parameter to (PlanState *). This commit does the same thing for calls in stormstats contrib module.
2017-08-21Make sure coordinator_lxid is formatted as %u and not %dTomas Vondra
As the coordinator_lxid is uin32, so make sure we use %u to format it (e.g. when sending it to remote nodes as string) and not just %d.
2017-08-21Define coordinator_lxid GUC as unsigned integerTomas Vondra
The coordinator_lxid GUC is internally stored as uint32, but was defined as plaint int32, triggering a compiler warning. It's also unclear what would happen for transaction IDs outside the signed range (possibly some strange issues). This adds a new GUC type (UInt), used only for this one GUC. The patch is fairly large, but most of it is boilerplate infrastructure to support the new GUC type. We have considered simpler workarounds (e.g. treating the GUC as string and converting it to/from uint32 using the GUC hooks, but this seems much cleaner and tidier.
2017-08-21Make sure ExecRemoteQuery is called with (PlanState *) parameterTomas Vondra
gcc 6.4.1 is complaining when ExecRemoteQuery(PlanState *) gets called with (RemoteSubqueryState*) parameter. This commit adds explicit cast on a few places to silence the warnings noise. An alternative fix might be to use (RemoteSubqueryState*), but that does not quite work as ResponseCombiner needs to keep a pointer to either ExecRemoteQuery or ExecRemoteSubplan. So the explicit cast seems better.
2017-08-21Handle params correctly within Subplan nodesPavan Deolasee
We were not dealing with the params in Subplan correctly, thus those params were not sent to the remote nodes correctly during RemoteSubplan exectution. This patch fixes that by traversing the Subplan node correctly. The regression failure in the 'join' test case is addressed too. Patch by senhu (senhu@tencent.com)
2017-08-18Generate a DEFAULT clause for identity columnsPavan Deolasee
Recent changes in PG 10 generates a nextval() expression (there was no support for NextValExpr in ruleutils before that). But that fails on the datanode side because only DEFAULT values are accepted for identity columns, unless overridden. This patch restores the XL behaviour, thus helping the regression.
2017-08-18Accept some trivial regression diffs after the last mergePavan Deolasee
2017-08-18Merge commit '21d304dfedb4f26d0d6587d9ac39b1b5c499bb55'Pavan Deolasee
This is the merge-base of PostgreSQL's master branch and REL_10_STABLE branch. This should be the last merge from PG's master branch into XL 10 branch. Subsequent merges must happen from REL_10_STABLE branch
2017-08-14Final pgindent + perltidy run for v10.Tom Lane
2017-08-14Handle elog(FATAL) during ROLLBACK more robustly.Tom Lane
Stress testing by Andreas Seltenreich disclosed longstanding problems that occur if a FATAL exit (e.g. due to receipt of SIGTERM) occurs while we are trying to execute a ROLLBACK of an already-failed transaction. In such a case, xact.c is in TBLOCK_ABORT state, so that AbortOutOfAnyTransaction would skip AbortTransaction and go straight to CleanupTransaction. This led to an assert failure in an assert-enabled build (due to the ROLLBACK's portal still having a cleanup hook) or without assertions, to a FATAL exit complaining about "cannot drop active portal". The latter's not disastrous, perhaps, but it's messy enough to want to improve it. We don't really want to run all of AbortTransaction in this code path. The minimum required to clean up the open portal safely is to do AtAbort_Memory and AtAbort_Portals. It seems like a good idea to do AtAbort_Memory unconditionally, to be entirely sure that we are starting with a safe CurrentMemoryContext. That means that if the main loop in AbortOutOfAnyTransaction does nothing, we need an extra step at the bottom to restore CurrentMemoryContext = TopMemoryContext, which I chose to do by invoking AtCleanup_Memory. This'll result in calling AtCleanup_Memory twice in many of the paths through this function, but that seems harmless and reasonably inexpensive. The original motivation for the assertion in AtCleanup_Portals was that we wanted to be sure that any user-defined code executed as a consequence of the cleanup hook runs during AbortTransaction not CleanupTransaction. That still seems like a valid concern, and now that we've seen one case of the assertion firing --- which means that exactly that would have happened in a production build --- let's replace the Assert with a runtime check. If we see the cleanup hook still set, we'll emit a WARNING and just drop the hook unexecuted. This has been like this a long time, so back-patch to all supported branches. Discussion: https://postgr.es/m/877ey7bmun.fsf@ansel.ydns.eu
2017-08-14Fix typoPeter Eisentraut
Author: Masahiko Sawada <sawada.mshk@gmail.com>
2017-08-14doc: Fix logical replication protocol doc detailPeter Eisentraut
Author: Masahiko Sawada <sawada.mshk@gmail.com> Reported-by: Kyle Conroy <kyle@kyleconroy.com> Bug: #14775
2017-08-14Absorb -D_USE_32BIT_TIME_T switch from Perl, if relevant.Tom Lane
Commit 3c163a7fc's original choice to ignore all #define symbols whose names begin with underscore turns out to be too simplistic. On Windows, some Perl installations are built with -D_USE_32BIT_TIME_T, and we must absorb that or we get the wrong result for sizeof(PerlInterpreter). This effectively re-reverts commit ef58b87df, which injected that symbol in a hacky way, making it apply to all of Postgres not just PL/Perl. More significantly, it did so on *all* 32-bit Windows builds, even when the Perl build to be used did not select this option; so that it fails to work properly with some newer Perl builds. By making this change, we would be introducing an ABI break in 32-bit Windows builds; but fortunately we have not used type time_t in any exported Postgres APIs in a long time. So it should be OK, both for PL/Perl itself and for third-party extensions, if an extension library is built with a different _USE_32BIT_TIME_T setting than the core code. Patch by me, based on research by Ashutosh Sharma and Robert Haas. Back-patch to all supported branches, as commit 3c163a7fc was. Discussion: https://postgr.es/m/CANFyU97OVQ3+Mzfmt3MhuUm5NwPU=-FtbNH5Eb7nZL9ua8=rcA@mail.gmail.com
2017-08-14Changed ecpg parser to allow RETURNING clauses without attached C variables.Michael Meskes
2017-08-13Remove AtEOXact_CatCache().Tom Lane
The sole useful effect of this function, to check that no catcache entries have positive refcounts at transaction end, has really been obsolete since we introduced ResourceOwners in PG 8.1. We reduced the checks to assertions years ago, so that the function was a complete no-op in production builds. There have been previous discussions about removing it entirely, but consensus up to now was that it had some small value as a cross-check for bugs in the ResourceOwner logic. However, it now emerges that it's possible to trigger these assertions if you hit an assert-enabled backend with SIGTERM during a call to SearchCatCacheList, because that function temporarily increases the refcounts of entries it's intending to add to a catcache list construct. In a normal ERROR scenario, the extra refcounts are cleaned up by SearchCatCacheList's PG_CATCH block; but in a FATAL exit we do a transaction abort and exit without ever executing PG_CATCH handlers. There's a case to be made that this is a generic hazard and we should consider restructuring elog(FATAL) handling so that pending PG_CATCH handlers do get run. That's pretty scary though: it could easily create more problems than it solves. Preliminary stress testing by Andreas Seltenreich suggests that there are not many live problems of this ilk, so we rejected that idea. There are more-localized ways to fix the problem; the most principled one would be to use PG_ENSURE_ERROR_CLEANUP instead of plain PG_TRY. But adding cycles to SearchCatCacheList isn't very appealing. We could also weaken the assertions in AtEOXact_CatCache in some more or less ad-hoc way, but that just makes its raison d'etre even less compelling. In the end, the most reasonable solution seems to be to just remove AtEOXact_CatCache altogether, on the grounds that it's not worth trying to fix it. It hasn't found any bugs for us in many years. Per report from Jeevan Chalke. Back-patch to all supported branches. Discussion: https://postgr.es/m/CAM2+6=VEE30YtRQCZX7_sCFsEpoUkFBV1gZazL70fqLn8rcvBA@mail.gmail.com
2017-08-13Reword comment for clarityAlvaro Herrera
Reported by Masahiko Sawada Discussion: https://postgr.es/m/CAD21AoB+ycZ2z-4Ye=6MfQ_r0aV5r6cvVPw4kOyPdp6bHqQoBQ@mail.gmail.com
2017-08-13Fix vertical spanning in table "wait_event Description".Noah Misch
Michael Paquier Discussion: https://postgr.es/m/CAB7nPqQr3KEQvXeuUNYcm7tDK2Fb9oLUQ8DU0+y0RZEoN_1_gg@mail.gmail.com
2017-08-12Simplify fetch-slot-xmins logic in recovery TAP tests.Tom Lane
Merge wait_slot_xmins() into get_slot_xmins(). At this point the only place that wasn't doing a wait was the initial-state test, and a wait there seems pretty harmless. Michael Paquier Discussion: https://postgr.es/m/CAB7nPqSp_SLQb2uU7am+sn4V3g1UKv8j3yZU385oAG1cG_BN9Q@mail.gmail.com
2017-08-11Be more thorough about cleaning out gcov litter.Tom Lane
At least on my machine, a run with code coverage enabled produces some ".gcov" files whose names begin with ".". "rm -f *.gcov" fails to match those, so they don't get cleaned up by "make clean". Fix it.
2017-08-11Add regression tests exercising more code paths in nodeLimit.c.Tom Lane
Perusal of the code coverage report shows that the existing regression test cases for LIMIT/OFFSET don't exercise the nodeLimit code paths involving backwards scan, empty results, or null values of LIMIT/OFFSET. Improve the coverage.
2017-08-11Add regression tests exercising the non-hashed code paths in nodeSetop.c.Tom Lane
Perusal of the code coverage report shows that the existing regression test cases for INTERSECT and EXCEPT seemingly all prefer the SETOP_HASHED implementation. Add some test cases in which we force use of the SETOP_SORTED mode.
2017-08-11doc: Add example for inet vs cidr differencePeter Eisentraut
Reported-by: kes-kes@yandex.ru
2017-08-11doc: Update description of rolreplication columnPeter Eisentraut
Since PostgreSQL 9.6, rolreplication no longer determines whether a role can run pg_start_backup() and pg_stop_backup(), so remove that. Add that this attribute determines whether a role can create and drop replication slots. Reported-by: Fujii Masao <masao.fujii@gmail.com>
2017-08-11doc: Small wording improvementPeter Eisentraut
Author: Jeff Janes <jeff.janes@gmail.com>
2017-08-11pg_upgrade: Clarify one messagePeter Eisentraut
Reported-by: Dennis Björklund <db@zigo.dhs.org>
2017-08-11Remove pgbench's restriction on placement of -M switch.Tom Lane
Previously the -M switch had to appear before any switch that directly or indirectly specified a benchmarking script. This was both confusing and inadequately documented, as per gripe from Tatsuo Ishii. We can remove the restriction at the cost of making an extra pass over the lists of SQL commands, which seems like a cheap price (the string scans themselves likely cost much more). The change is just to not extract parameters from the SQL commands until we have finished parsing the switches and know the final value of -M. Per discussion, we'll treat this as a low-grade bug fix and sneak it into v10, rather than holding it for v11. Tom Lane, reviewed by Tatsuo Ishii and Fabien Coelho Discussion: https://postgr.es/m/20170802.110328.1963639094551443169.t-ishii@sraoss.co.jp Discussion: https://postgr.es/m/10208.1502465077@sss.pgh.pa.us
2017-08-11Remove uses of "slave" in replication contextsPeter Eisentraut
This affects mostly code comments, some documentation, and tests. Official APIs already used "standby".
2017-08-11Reject use of ucol_strcollUTF8() before ICU 53Peter Eisentraut
Various bugs can cause crashes, so don't use that function before ICU 53. It will fall back to the code path used for other encodings. Since we now tie the function availability to an ICU version, we don't need the configure test anymore. That also resolves the issue that the test result was previously hardcoded for Windows. researched by Daniel Verite <daniel@manitou-mail.org>, Peter Geoghegan <pg@bowt.ie>, Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/f1438ec6-22aa-4029-9a3b-26f79d330e72%40manitou-mail.org
2017-08-11Fix order of ICU_CFLAGSPeter Eisentraut
It must be before CPPFLAGS so that an ICU installation in a nonstandard path can take precedence over one in the system path.
2017-08-10Improve the error message when creating an empty range partition.Robert Haas
The previous message didn't mention the name of the table or the bounds. Put the table name in the primary error message and the bounds in the detail message. Amit Langote, changed slightly by me. Suggestions on the exac phrasing from Tom Lane, David G. Johnston, and Dean Rasheed. Discussion: http://postgr.es/m/CA+Tgmoae6bpwVa-1BMaVcwvCCeOoJ5B9Q9-RHWo-1gJxfPBZ5Q@mail.gmail.com
2017-08-10Make some more improvements to parallel query documentation.Robert Haas
Many places that mentioned only Gather should also mention Gather Merge, or should be phrased in a more neutral way. Be more clear about the fact that max_parallel_workers_per_gather affects the number of workers the planner may want to use. Fix a typo. Explain how Gather Merge works. Adjust wording around parallel scans to be a bit more clear. Adjust wording around parallel-restricted operations for the fact that uncorrelated subplans are no longer restricted. Patch by me, reviewed by Erik Rijkers Discussion: http://postgr.es/m/CA+TgmoZsTjgVGn=ei5ht-1qGFKy_m1VgB3d8+Rg304hz91N5ww@mail.gmail.com
2017-08-10Fix typo in comment.Robert Haas
Etsuro Fujita Discussion: http://postgr.es/m/5f794b91-67df-1ac6-8a4f-069f8e8e169d@lab.ntt.co.jp
2017-08-10pgstatindex: Insert some casts to prevent overflow.Robert Haas
This could cause hash indexes to report greater than 100% free space. Ashutosh Sharma, reviewed by Amit Kapila Discussion: http://postgr.es/m/CAE9k0PnCKfg-ZK1CwGZJPF1yKcG2A=GUgC3BMdNMzLAXVOo4Eg@mail.gmail.com
2017-08-10Remove incorrect assertion in clog.cRobert Haas
We must advance the oldest XID that can be safely looked up in clog *before* truncating CLOG, and the oldest XID that can't be reused *after* truncating CLOG. This assertion, and the accompanying comment, are confused; remove them. Reported by Neha Sharma. Discussion: http://postgr.es/m/CANiYTQumC3T=UMBMd1Hor=5XWZYuCEQBioL3ug0YtNQCMMT5wQ@mail.gmail.com
2017-08-09Fix handling of container types in find_composite_type_dependencies.Tom Lane
find_composite_type_dependencies correctly found columns that are of the specified type, and columns that are of arrays of that type, but not columns that are domains or ranges over the given type, its array type, etc. The most general way to handle this seems to be to assume that any type that is directly dependent on the specified type can be treated as a container type, and processed recursively (allowing us to handle nested cases such as ranges over domains over arrays ...). Since a type's array type already has such a dependency, we can drop the existing special case for the array type. The very similar logic in get_rels_with_domain was likewise a few bricks shy of a load, as it supposed that a directly dependent type could *only* be a sub-domain. This is already wrong for ranges over domains, and it'll someday be wrong for arrays over domains. Add test cases illustrating the problems, and back-patch to all supported branches. Discussion: https://postgr.es/m/15268.1502309024@sss.pgh.pa.us
2017-08-09Prevent passing down MAKELEVEL/MAKEFLAGS from non-GNU make to GNU make.Tom Lane
FreeBSD's make, for one, sets the MAKELEVEL environment variable when invoking commands. In the special Makefile we provide to hand off control from a non-GNU make to GNU make, this causes GNU make to think it is a child make invocation rather than top-level. That interferes with the hack added in commit dcae5facc to cause the temp-install tree to be made only by the top-level invocation of gmake. Unset the variable to prevent that. Likewise unset MAKEFLAGS, which FreeBSD's make also sets, and which could easily confuse gmake. There are no reports of actual trouble from that, but it seems better to be proactive. Back-patch to 9.5 where dcae5facc came in. Thomas Munro, hacked a bit more by me Discussion: https://postgr.es/m/CAEepm=1ueww35AXTkt1A3gyzZUqv5XCzh8RUNvJZAQAW=eOhVw@mail.gmail.com
2017-08-08doc: Add missing pieces to logical replication protocol docPeter Eisentraut
Reported-by: Kyle Conroy <kyle@kyleconroy.com>
2017-08-08Fix datumSerialize infrastructure to not crash on non-varlena data.Tom Lane
Commit 1efc7e538 did a poor job of emulating existing logic for touching Datums that might be expanded-object pointers. It didn't check for typlen being -1 first, which meant it could crash on fixed-length pass-by-ref values, and probably on cstring values as well. It also didn't use DatumGetPointer before VARATT_IS_EXTERNAL_EXPANDED, which while currently harmless is not according to documentation nor prevailing style. I also think the lack of any explanation as to why datumSerialize makes these particular nonobvious choices is pretty awful, so fix that. Per report from Jarred Ward. Back-patch to 9.6 where this code came in. Discussion: https://postgr.es/m/6F61E6D2-2F5E-4794-9479-A429BE1CEA4B@simple.com
2017-08-08Reword some unclear commentsAlvaro Herrera
2017-08-08Fix typo in commentAlvaro Herrera