summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-06-14Use DEFACLOBJ_ macros in error message instead of hardcodingPeter Eisentraut
2017-06-14Add missing serial commaPeter Eisentraut
2017-06-14doc: Whitespace fixes in man pagesPeter Eisentraut
2017-06-14Teach predtest.c about CHECK clauses to fix partitioning bugs.Robert Haas
In a CHECK clause, a null result means true, whereas in a WHERE clause it means false. predtest.c provided different functions depending on which set of semantics applied to the predicate being proved, but had no option to control what a null meant in the clauses provided as axioms. Add one. Use that in the partitioning code when figuring out whether the validation scan on a new partition can be skipped. Rip out the old logic that attempted (not very successfully) to compensate for the absence of the necessary support in predtest.c. Ashutosh Bapat and Robert Haas, reviewed by Amit Langote and incorporating feedback from Tom Lane. Discussion: http://postgr.es/m/CAFjFpReT_kq_uwU_B8aWDxR7jNGE=P0iELycdq5oupi=xSQTOw@mail.gmail.com
2017-06-14Improve release note text about set-returning-function changes.Tom Lane
Paul Ramsey griped about this awhile ago, but I'd been holding fire on changing it until we settled what to do about the CASE/COALESCE issue. Discussion: https://postgr.es/m/CACowWR0AMyUt5fwtvuDqWyYNdp-hQJj9XqSxJR6YM9sKWov=_w@mail.gmail.com
2017-06-14Avoid bogus TwoPhaseState locking sequencesAlvaro Herrera
The optimized code in 728bd991c3c4 contains a few invalid locking sequences. To wit, the original code would try to acquire an lwlock that it already holds. Avoid this by moving lock acquisitions to higher-level code, and install appropriate assertions in low-level that the correct mode is held. Authors: Michael Paquier, Álvaro Herrera Reported-By: chuanting wang Bug: #14680 Discussion: https://postgr.es/m/20170531033228.1487.10124@wrigleys.postgresql.org
2017-06-14Put documentation of options and commands in more alphabetical orderPeter Eisentraut
2017-06-14Fix no-longer-valid shortcuts in expression_returns_set().Tom Lane
expression_returns_set() used to short-circuit its recursion upon seeing certain node types, such as DistinctExpr, that it knew the executor did not support set-valued arguments for. That was never inherent, though, just a reflection of laziness in execQual.c. With the new implementation of SRFs there is no reason to think that any scalar-valued expression node could not have a set-valued subexpression, except for AggRefs and WindowFuncs where we know there is a parser check rejecting it. And indeed, the shortcut causes unexpected failures for cases such as a SRF underneath DistinctExpr, because the planner stops looking for SRFs too soon. Discussion: https://postgr.es/m/5259.1497044025@sss.pgh.pa.us
2017-06-14Fix violations of CatalogTupleInsert/Update/Delete abstraction.Tom Lane
In commits 2f5c9d9c9 and ab0289651 we invented an abstraction layer to insulate catalog manipulations from direct heap update calls. But evidently some patches that hadn't landed in-tree at that point didn't get the memo completely. Fix a couple of direct calls to simple_heap_delete to use CatalogTupleDelete instead; these appear to have been added in commits 7c4f52409 and 7b504eb28. This change is purely cosmetic ATM, but there's no point in having an abstraction layer if we allow random code to break it. Masahiko Sawada and Tom Lane Discussion: https://postgr.es/m/CAD21AoDOPRSVcwbnCN3Y1n_68ATyTspsU6=ygtHz_uY0VcdZ8A@mail.gmail.com
2017-06-14Teach PL/pgSQL about partitioned tables.Dean Rasheed
Table partitioning, introduced in commit f0e44751d7, added a new relkind - RELKIND_PARTITIONED_TABLE. Update a couple of places in PL/pgSQL to handle it. Specifically plpgsql_parse_cwordtype() and build_row_from_class() needed updating in order to make table%ROWTYPE and table.col%TYPE work for partitioned tables. Dean Rasheed, reviewed by Amit Langote. Discussion: https://postgr.es/m/CAEZATCUnNOKN8sLML9jUzxecALWpEXK3a3W7y0PgFR4%2Buhgc%3Dg%40mail.gmail.com
2017-06-14Teach RemoveRoleFromObjectPolicy() about partitioned tables.Dean Rasheed
Table partitioning, introduced in commit f0e44751d7, added a new relkind - RELKIND_PARTITIONED_TABLE. Update RemoveRoleFromObjectPolicy() to handle it, otherwise DROP OWNED BY will fail if the role has any RLS policies referring to partitioned tables. Dean Rasheed, reviewed by Amit Langote. Discussion: https://postgr.es/m/CAEZATCUnNOKN8sLML9jUzxecALWpEXK3a3W7y0PgFR4%2Buhgc%3Dg%40mail.gmail.com
2017-06-14Ensure slab allocator is initialised correctly.Pavan Deolasee
XL uses tuplesort facilities to merge incoming tuples from the datanode connections. We'd missed out a few things during the merge and this patch attempts to fix that. It's not clear if we have addressed all problems in this area, since the code has been heavily modified in PG10. But this patch at the very least allows further testing.
2017-06-14Ensure that pgstat knowns about XL background processes.Pavan Deolasee
XL has two background processes of its own, the cluster monitor process and the pooler process. This patch ensures that pgstat is aware of these additional built-in background processes.
2017-06-14Revert "Handle multi-command queries correctly inside SQL as well as plpgsql ↵Pavan Deolasee
functions." This reverts commit 9ddddcb8d51fd640f59401ea9bc335d08bf5a23c. This commit uses the facilities created by 455ff923454e78d80b77639a381db9b05c776577, which itself has been now reverted.
2017-06-14Revert "Handle multi-command SQL strings correctly even when there are ↵Pavan Deolasee
'null' sql" This reverts commit df13f58003d119162d9a1450ced06048e5992b67. This commit uses the facilities created by 455ff923454e78d80b77639a381db9b05c776577, which itself has been now reverted.
2017-06-14Revert "Collect and return query substrings corresponding to each SQL statement"Pavan Deolasee
This reverts commit 455ff923454e78d80b77639a381db9b05c776577. Core Postgres has now added support for extracting query string for each command in a multi-command SQL. So we can use that facility instead of cooking up something on our own.
2017-06-14Merge from PG master upto d5cb3bab564e0927ffac7c8729eacf181a12dd40Pavan Deolasee
This is the result of the "git merge remotes/PGSQL/master" upto the said commit point. We have done some basic analysis, fixed compilation problems etc, but bulk of the logical problems in conflict resolution etc will be handled by subsequent commits.
2017-06-14Disallow set-returning functions inside CASE or COALESCE.Tom Lane
When we reimplemented SRFs in commit 69f4b9c85, our initial choice was to allow the behavior to vary from historical practice in cases where a SRF call appeared within a conditional-execution construct (currently, only CASE or COALESCE). But that was controversial to begin with, and subsequent discussion has resulted in a consensus that it's better to throw an error instead of executing the query differently from before, so long as we can provide a reasonably clear error message and a way to rewrite the query. Hence, add a parser mechanism to allow detection of such cases during parse analysis. The mechanism just requires storing, in the ParseState, a pointer to the set-returning FuncExpr or OpExpr most recently emitted by parse analysis. Then the parsing functions for CASE and COALESCE can detect the presence of a SRF in their arguments by noting whether this pointer changes while analyzing their arguments. Furthermore, if it does, it provides a suitable error cursor location for the complaint. (This means that if there's more than one SRF in the arguments, the error will point at the last one to be analyzed not the first. While connoisseurs of parsing behavior might find that odd, it's unlikely the average user would ever notice.) While at it, we can also provide more specific error messages than before about some pre-existing restrictions, such as no-SRFs-within-aggregates. Also, reject at parse time cases where a NULLIF or IS DISTINCT FROM construct would need to return a set. We've never supported that, but the restriction is depended on in more subtle ways now, so it seems wise to detect it at the start. Also, provide some documentation about how to rewrite a SRF-within-CASE query using a custom wrapper SRF. It turns out that the information_schema.user_mapping_options view contained an instance of exactly the behavior we're now forbidding; but rewriting it makes it more clear and safer too. initdb forced because of user_mapping_options change. Patch by me, with error message suggestions from Alvaro Herrera and Andres Freund, pursuant to a complaint from Regina Obe. Discussion: https://postgr.es/m/000001d2d5de$d8d66170$8a832450$@pcorp.us
2017-06-13doc: Update example version numbers in pg_upgrade documentationPeter Eisentraut
The exact numbers don't matter, since they are examples, but it was looking quite dated. For the target version, we now automatically substitute the current major version. The updated example source version should be good for a couple of years.
2017-06-13psql: Use more consistent capitalization of some output headingsPeter Eisentraut
2017-06-13Re-run pgindent.Tom Lane
This is just to have a clean base state for testing of Piotr Stefaniak's latest version of FreeBSD indent. I fixed up a couple of places where pgindent would have changed format not-nicely. perltidy not included. Discussion: https://postgr.es/m/VI1PR03MB119959F4B65F000CA7CD9F6BF2CC0@VI1PR03MB1199.eurprd03.prod.outlook.com
2017-06-13Always initialize PartitionBoundInfoData's null_index.Robert Haas
This doesn't actually matter at present, because the current code never consults null_index for range partitions. However, leaving it uninitialized is still a bad idea, so let's not do that. Amul Sul, reviewed by Ashutosh Bapat Discussion: http://postgr.es/m/CAAJ_b94AkEzcx+12ySCnbMDX7=UdF4BjnoBGfMQbB0RNSTo3Ng@mail.gmail.com
2017-06-13Teach relation_is_updatable() about partitioned tables.Dean Rasheed
Table partitioning, introduced in commit f0e44751d7, added a new relkind - RELKIND_PARTITIONED_TABLE. Update relation_is_updatable() to handle it. Specifically, partitioned tables and simple views built on top of them are updatable. This affects the SQL-callable functions pg_relation_is_updatable() and pg_column_is_updatable(), and the views information_schema.views and information_schema.columns. Dean Rasheed, reviewed by Ashutosh Bapat. Discussion: https://postgr.es/m/CAEZATCXnbiFkMXgF4Ez1pmM2c-tS1z33bSq7OGbw7QQhHov%2B6Q%40mail.gmail.com
2017-06-13libpq: Message style improvementsPeter Eisentraut
2017-06-13Fix failure to remove dependencies when a partition is detached.Robert Haas
Otherwise, dropping the partitioned table will automatically drop any previously-detached children, which would be unfortunate. Ashutosh Bapat and Rahila Syed, reviewed by Amit Langote and by me. Discussion: http://postgr.es/m/CAFjFpRdOwHuGj45i25iLQ4QituA0uH6RuLX1h5deD4KBZJ25yg@mail.gmail.com
2017-06-13doc: Fix typoPeter Eisentraut
Author: Julien Rouhaud <julien.rouhaud@dalibo.com>
2017-06-13In initdb, defend against assignment of NULL values to not-null columns.Tom Lane
Previously, you could write _null_ in a BKI DATA line for a column that's supposed to be NOT NULL and initdb would let it pass, probably breaking subsequent accesses to the row. No doubt the original coding overlooked this simple sanity check because in the beginning we didn't have any way to mark catalog columns NOT NULL at initdb time.
2017-06-13Fix typoPeter Eisentraut
Author: Masahiko Sawada <sawada.mshk@gmail.com>
2017-06-13Improve code commentsPeter Eisentraut
Author: Erik Rijkers <er@xs4all.nl>
2017-06-13Use correct ICU path for Windows 32 vs. 64 bitPeter Eisentraut
Author: Ashutosh Sharma <ashu.coek88@gmail.com>
2017-06-13Fix collprovider of predefined collationsPeter Eisentraut
An earlier version of the patch had collprovider as an integer and thus set these to 0, but the correct setting is now null.
2017-06-13pg_dump: Allow dumping default collationPeter Eisentraut
This will not work on restore, but it will allow dumping out pg_catalog for research and documentation. Reported-by: Neil Anderson <neil.t.anderson@gmail.com> Bug: #14701
2017-06-13Prevent copying default collationPeter Eisentraut
This will not have the desired effect and might lead to crashes when the copied collation is used. Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
2017-06-13Fix confusion about number of subplans in partitioned INSERT setup.Tom Lane
ExecInitModifyTable() thought there was a plan per partition, but no, there's only one. The problem had escaped detection so far because there would only be visible misbehavior if there were a SubPlan (not an InitPlan) in the quals being duplicated for each partition. However, valgrind detected a bogus memory access in test cases added by commit 4f7a95be2, and investigation of that led to discovery of the bug. The additional test case added here crashes without the patch. Patch by Amit Langote, test case by me. Discussion: https://postgr.es/m/10974.1497227727@sss.pgh.pa.us
2017-06-13pg_dump: Fix harmless type mixupPeter Eisentraut
2017-06-13doc: Update external PL listPeter Eisentraut
Add PL/Lua, PL/v8. Remove stale/unmaintained PL/PHP, PL/Py, PL/Ruby, PL/Scheme. Reported-by: Adam Sah <asah@midgard.net>
2017-06-13Assert that we don't invent relfilenodes or type OIDs in binary upgrade.Tom Lane
During pg_upgrade's restore run, all relfilenode choices should be overridden by commands in the dump script. If we ever find ourselves choosing a relfilenode in the ordinary way, someone blew it. Likewise for pg_type OIDs. Since pg_upgrade might well succeed anyway, if there happens not to be a conflict during the regression test run, we need assertions here to keep us on the straight and narrow. We might someday be able to remove the assertion in GetNewRelFileNode, if pg_upgrade is rewritten to remove its assumption that old and new relfilenodes always match. But it's hard to see how to get rid of the pg_type OID constraint, since those OIDs are embedded in user tables in some cases. Back-patch as far as 9.5, because of the risk of back-patches breaking something here even if it works in HEAD. I'd prefer to go back further, but 9.4 fails both assertions due to get_rel_infos()'s use of a temporary table. We can't use the later-branch solution of a CTE for compatibility reasons (cf commit 5d16332e9), and it doesn't seem worth inventing some other way to do the query. (I did check, by dint of changing the Asserts to elog(WARNING), that there are no other cases of unwanted OID assignments during 9.4's regression test run.) Discussion: https://postgr.es/m/19785.1497215827@sss.pgh.pa.us
2017-06-12Fix ALTER SEQUENCE OWNED BY to not rewrite the sequence relation.Tom Lane
It's not necessary for it to do that, since OWNED BY requires only ordinary catalog updates and doesn't affect future sequence values. And pg_upgrade needs to use OWNED BY without having it change the sequence's relfilenode. Commit 3d79013b9 broke this by making all forms of ALTER SEQUENCE change the relfilenode; that seems to be the explanation for the hard-to-reproduce buildfarm failures we've been seeing since then. Discussion: https://postgr.es/m/19785.1497215827@sss.pgh.pa.us
2017-06-12doc: Update information_schema documentation for identity columnsPeter Eisentraut
This was apparently forgotten in the original patch.
2017-06-12Add ICU_CFLAGS to global CPPFLAGSPeter Eisentraut
The original code only added ICU_CFLAGS to the backend build. But it is also needed for building external modules that include pg_locale.h. So add it to the global CPPFLAGS. (This is only relevant if ICU is not in a compiler default path, so it apparently hasn't bitten many.)
2017-06-12Remove "synchronized table states" notice messagePeter Eisentraut
It appears to be more confusing than useful. Reported-by: Jeff Janes <jeff.janes@gmail.com>
2017-06-12Add MSVC build system support for ICUPeter Eisentraut
Author: Ashutosh Sharma <ashu.coek88@gmail.com> Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
2017-06-12Fix build of ICU support in WindowsPeter Eisentraut
and also any platform that does not have locale_t but enabled ICU. Author: Ashutosh Sharma <ashu.coek88@gmail.com>
2017-06-12Trim trailing whitespacePeter Eisentraut
2017-06-12Stop table sync workers when subscription relation entry is removedPeter Eisentraut
When a table sync worker is in waiting state and the subscription table entry is removed because of a concurrent subscription refresh, the worker could be left orphaned. To avoid that, explicitly stop the worker when the pg_subscription_rel entry is removed. Reported-by: Masahiko Sawada <sawada.mshk@gmail.com>
2017-06-12Fix ALTER TABLE doc examples.Tatsuo Ishii
Patch by Yugo Nagata <nagata@sraoss.co.jp>. Confirmed by Amit Langote, who is the original author of the document part.
2017-06-11Handle unqualified SEQUENCE NAME options properly in parse_utilcmd.c.Tom Lane
generateSerialExtraStmts() was sloppy about handling the case where SEQUENCE NAME is given with a not-schema-qualified name. It was generating a CreateSeqStmt with an unqualified sequence name, and an AlterSeqStmt whose "owned_by" DefElem contained a T_String Value with a null string pointer in the schema-name position. The generated nextval() argument was also underqualified. This accidentally failed to fail at runtime, but only so long as the current default creation namespace at runtime is the right namespace. That's bogus; the parse-time transformation is supposed to be inserting the right schema name in all cases, so as to avoid any possible skew in that selection. I'm not sure this could fail in pg_dump's usage, but it's still wrong; we have had real bugs in this area before adopting the policy that parse_utilcmd.c should generate only fully-qualified auxiliary commands. A slightly lesser problem, which is what led me to notice this in the first place, is that pprint() dumped core on the AlterSeqStmt because of the bogus T_String. Noted while poking into the open problem with ALTER SEQUENCE breaking pg_upgrade.
2017-06-11Apply RLS policies to partitioned tables.Joe Conway
The new partitioned table capability added a new relkind, namely RELKIND_PARTITIONED_TABLE. Update fireRIRrules() to apply RLS policies on RELKIND_PARTITIONED_TABLE as it does RELKIND_RELATION. In addition, add RLS regression test coverage for partitioned tables. Issue raised by Fakhroutdinov Evgenievich and patch by Mike Palmiotto. Regression test editorializing by me. Discussion: https://postgr.es/m/flat/20170601065959.1486.69906@wrigleys.postgresql.org
2017-06-10Restrict subplan nodes even for equal distributionsTomas Vondra
Many regression tests were failing because the expected plan contains Remote Subquery Scan on all (datanode_1) but we were producing Remote Subquery Scan on any (datanode_1,datanode_2) Both those plans are in fact valid (at least on replicated tables). The difference is that in the first case the restriction was computed in adjust_subplan_distribution() while in the second case this did not happen (and instead will happen at execution time). The restriction is not applied because adjust_subplan_distribution() contains this condition if (subd && !equal(subd, pathd)) { ... restrict execution nodes ... } In Postgres-XL 9.6 the two distributions happen to be equal in some cases where where that was not the case in Postgres-XL 9.5. It's not entirely clear why this happens (it seems to be another consequence of the upper-planner pathification), but the consequence is that the restriction code is skipped. Removing the equal() call from the condition fixes all the regression failures caused by plans switching between any/all restrictions. In fact, this fixes all remaining regressions failures in five regression suites: create_view, subselect, aggregates, rangefuncs, xc_having. In the future, we will probably pathify adjust_subplan_distribution(), i.e. we'll probably get rid of it entirely and compute the restriction either when constructing the path or possibly defer it until execution time. Before the upper-planner pathification this was not possible.
2017-06-10Take PROVE_FLAGS from the command line but not the environmentAndrew Dunstan
This reverts commit 56b6ef893fee9e9bf47d927a02f4d1ea911f4d9c and instead makes vcregress.pl parse out PROVE_FLAGS from a command line argument when doing a TAP test, thus making it consistent with the makefile treatment. Discussion: https://postgr.es/m/c26a7416-2fb9-34ab-7991-618c922f896e%402ndquadrant.com Backpatch to 9.4 like previous patch.