aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
* Update collate.linux.utf8.out for ruleutils.c line-wrapping changes.Tom Lane2013-05-08
| | | | Missed in commit 62e666400dddf605b9b6d9a7ac2918711b5c5629.
* Better fix for permissions tests in excluded subqueries.Tom Lane2013-05-08
| | | | | | | | | | | | | | | | | | | | | | This reverts the code changes in 50c137487c96e629e0e5372bb3d1b5f1a2f71a88, which turned out to induce crashes and not completely fix the problem anyway. That commit only considered single subqueries that were excluded by constraint-exclusion logic, but actually the problem also exists for subqueries that are appendrel members (ie part of a UNION ALL list). In such cases we can't add a dummy subpath to the appendrel's AppendPath list without defeating the logic that recognizes when an appendrel is completely excluded. Instead, fix the problem by having setrefs.c scan the rangetable an extra time looking for subqueries that didn't get into the plan tree. (This approach depends on the 9.2 change that made set_subquery_pathlist generate dummy paths for excluded single subqueries, so that the exclusion behavior is the same for single subqueries and appendrel members.) Note: it turns out that the appendrel form of the missed-permissions-checks bug exists as far back as 8.4. However, since the practical effect of that bug seems pretty minimal, consensus is to not attempt to fix it in the back branches, at least not yet. Possibly we could back-port this patch once it's gotten a reasonable amount of testing in HEAD. For the moment I'm just going to revert the previous patch in 9.2.
* Fix walsender failure at promotion.Heikki Linnakangas2013-05-08
| | | | | | | | | | | | | | | | | | | | | | | | If a standby server has a cascading standby server connected to it, it's possible that WAL has already been sent up to the next WAL page boundary, splitting a WAL record in the middle, when the first standby server is promoted. Don't throw an assertion failure or error in walsender if that happens. Also, fix a variant of the same bug in pg_receivexlog: if it had already received WAL on previous timeline up to a segment boundary, when the upstream standby server is promoted so that the timeline switch record falls on the previous segment, pg_receivexlog would miss the segment containing the timeline switch. To fix that, have walsender send the position of the timeline switch at end-of-streaming, in addition to the next timeline's ID. It was previously assumed that the switch happened exactly where the streaming stopped. Note: this is an incompatible change in the streaming protocol. You might get an error if you try to stream over timeline switches, if the client is running 9.3beta1 and the server is more recent. It should be fine after a reconnect, however. Reported by Fujii Masao.
* Use the term "radix tree" instead of "suffix tree" for SP-GiST text opclass.Heikki Linnakangas2013-05-08
| | | | | | | What we have implemented is a radix tree (or a radix trie or a patricia trie), but the docs and code comments incorrectly called it a "suffix tree". Alexander Korotkov
* Stamp 9.3beta1.REL9_3_BETA1Tom Lane2013-05-06
|
* Move materialized views' is-populated status into their pg_class entries.Tom Lane2013-05-06
| | | | | | | | | | | | Previously this state was represented by whether the view's disk file had zero or nonzero size, which is problematic for numerous reasons, since it's breaking a fundamental assumption about heap storage. This was done to allow unlogged matviews to revert to unpopulated status after a crash despite our lack of any ability to update catalog entries post-crash. However, this poses enough risk of future problems that it seems better to not support unlogged matviews until we can find another way. Accordingly, revert that choice as well as a number of existing kluges forced by it in favor of creating a pg_class.relispopulated flag column.
* Back out some recent translation updates.Tom Lane2013-05-06
| | | | | | | | Very old versions of msgfmt choke on these specific messages, for reasons that are unclear at the moment. Remove them so that we can ship a beta release and not get complaints from testers (these messages will just go untranslated, instead, and we're hardly at 100% coverage anyway). Peter Eisentraut will look for a better fix later.
* Disallow unlogged materialized views.Tom Lane2013-05-06
| | | | | | | | | | | | | | | | | The initial implementation of this feature was really unsupportable, because it's relying on the physical size of an on-disk file to carry the relation's populated/unpopulated state, which is at least a modularity violation and could have serious long-term consequences. We could say that an unlogged matview goes to empty on crash, but not everybody likes that definition, so let's just remove the feature for 9.3. We can add it back when we have a less klugy implementation. I left the grammar and tab-completion support for CREATE UNLOGGED MATERIALIZED VIEW in place, since it's harmless and allows delivering a more specific error message about the unsupported feature. I'm committing this separately to ease identification of what should be reverted when/if we are able to re-enable the feature.
* Execute SET TRANSACTION SNAPSHOT during pg_dumpSimon Riggs2013-05-06
| | | | | | Previous coding set the SQL buffer but never executed Bug noted by me during beta testing
* Revert idea of zer-padding padding session id in log_line_prefixBruce Momjian2013-05-06
| | | | Removal of doc adjustment and release note mention as well.
* Translation updatesPeter Eisentraut2013-05-05
|
* Improve behavior of \watch with non-tuple-returning commands.Tom Lane2013-05-04
| | | | | | | | Print the command tag if we get PGRES_COMMAND_OK, and throw an error for other cases. Per gripe from Michael Paquier. In passing, add an fflush(), just to be real sure the output appears before we sleep.
* Prevent (auto)vacuum from truncating first page of populated matview.Kevin Grittner2013-05-02
| | | | Per report from Fujii Masao, with regression test using his example.
* Use correct length to convert json unicode escapes.Andrew Dunstan2013-05-01
| | | | Bug reported on IRC - fix due to Andrew Gierth.
* Fix permission tests for views/tables proven empty by constraint exclusion.Tom Lane2013-05-01
| | | | | | | | | | | | | | | | | | A view defined as "select <something> where false" had the curious property that the system wouldn't check whether users had the privileges necessary to select from it. More generally, permissions checks could be skipped for tables referenced in sub-selects or views that were proven empty by constraint exclusion (although some quick testing suggests this seldom happens in cases of practical interest). This happened because the planner failed to include rangetable entries for such tables in the finished plan. This was noticed in connection with erroneous handling of materialized views, but actually the issue is quite unrelated to matviews. Therefore, revert commit 200ba1667b3a8d7a9d559d2f05f83d209c9d8267 in favor of a more direct test for the real problem. Back-patch to 9.2 where the bug was introduced (by commit 7741dd6590073719688891898e85f0cb73453159).
* Add regression test for bug fixed by recent refactoring.Kevin Grittner2013-04-30
| | | | | Test case by Andres Freund for bug fixed by Tom Lane's refactoring in commit 5194024d72f33fb209e10f9ab0ada7cc67df45b7
* Bump PG_CONTROL_VERSION to 937Simon Riggs2013-04-30
|
* Record data_checksum_version in control file.Simon Riggs2013-04-30
| | | | | | The value is not used anywhere in code, but will allow future changes to the checksum version should that become necessary in the future.
* Ensure we MarkBufferDirty before visibilitymap_set()Simon Riggs2013-04-30
| | | | | | | | logs the heap page and sets the LSN. Otherwise a checkpoint could occur between those actions and leave us in an inconsistent state. Jeff Davis
* Compiler optimizations for page checksum code.Simon Riggs2013-04-30
| | | | Ants Aasma and Jeff Davis
* Revert "pg_ctl: Add idempotent option"Peter Eisentraut2013-04-29
| | | | | | This reverts commit 87306184580c9c49717b00d48a2f9e717f21e0a8. The behavior in certain cases is still being debated, and it's too late to solve this before beta.
* Postpone creation of pathkeys lists to fix bug #8049.Tom Lane2013-04-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch gets rid of the concept of, and infrastructure for, non-canonical PathKeys; we now only ever create canonical pathkey lists. The need for non-canonical pathkeys came from the desire to have grouping_planner initialize query_pathkeys and related pathkey lists before calling query_planner. However, since query_planner didn't actually *do* anything with those lists before they'd been made canonical, we can get rid of the whole mess by just not creating the lists at all until the point where we formerly canonicalized them. There are several ways in which we could implement that without making query_planner itself deal with grouping/sorting features (which are supposed to be the province of grouping_planner). I chose to add a callback function to query_planner's API; other alternatives would have required adding more fields to PlannerInfo, which while not bad in itself would create an ABI break for planner-related plugins in the 9.2 release series. This still breaks ABI for anything that calls query_planner directly, but it seems somewhat unlikely that there are any such plugins. I had originally conceived of this change as merely a step on the way to fixing bug #8049 from Teun Hoogendoorn; but it turns out that this fixes that bug all by itself, as per the added regression test. The reason is that now get_eclass_for_sort_expr is adding the ORDER BY expression at the end of EquivalenceClass creation not the start, and so anything that is in a multi-member EquivalenceClass has already been created with correct em_nullable_relids. I am suspicious that there are related scenarios in which we still need to teach get_eclass_for_sort_expr to compute correct nullable_relids, but am not eager to risk destabilizing either 9.2 or 9.3 to fix bugs that are only hypothetical. So for the moment, do this and stop here. Back-patch to 9.2 but not to earlier branches, since they don't exhibit this bug for lack of join-clause-movement logic that depends on em_nullable_relids being correct. (We might have to revisit that choice if any related bugs turn up.) In 9.2, don't change the signature of make_pathkeys_for_sortclauses nor remove canonicalize_pathkeys, so as not to risk more plugin breakage than we have to.
* Ensure ANALYZE phase is not skipped because of canceled truncate.Kevin Grittner2013-04-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | Patch b19e4250b45e91c9cbdd18d35ea6391ab5961c8d attempted to preserve existing behavior regarding statistics generation in the case that a truncation attempt was canceled due to lock conflicts. It failed to do this accurately in two regards: (1) autovacuum had previously generated statistics if the truncate attempt failed to initially get the lock rather than having started the attempt, and (2) the VACUUM ANALYZE command had always generated statistics. Both of these changes were unintended, and are reverted by this patch. On review, there seems to be consensus that the previous failure to generate statistics when the truncate was terminated was more an unfortunate consequence of how that effort was previously terminated than a feature we want to keep; so this patch generates statistics even when an autovacuum truncation attempt terminates early. Another unintended change which is kept on the basis that it is an improvement is that when a VACUUM command is truncating, it will the new heuristic for avoiding blocking other processes, rather than keeping an AccessExclusiveLock on the table for however long the truncation takes. Per multiple reports, with some renaming per patch by Jeff Janes. Backpatch to 9.0, where problem was created.
* Attempt to fix error recovery in COPY BOTH mode.Robert Haas2013-04-29
| | | | | | | | | | | | | | | | | | | | | | Previously, libpq and the backend had opposite ideas about whether it was necessary for the client to send a CopyDone message after receiving an ErrorResponse, making it impossible to cleanly exit COPY BOTH mode. Fix libpq so that works correctly, adopting the backend's notion that an ErrorResponse kills the copy in both directions. Adjust receivelog.c to avoid a degradation in the quality of the resulting error messages. libpqwalreceiver.c is already doing the right thing, so no adjustment needed there. Add an explicit statement to the documentation explaining how this part of the protocol is supposed to work, in the hopes of avoiding future confusion in this area. Since the consequences of all this confusion are very limited, especially in the back-branches where no client ever attempts to exit COPY BOTH mode without closing the connection entirely, no back-patch.
* Introduce new page checksum algorithm and module.Simon Riggs2013-04-29
| | | | | | | | | | | | | | | Isolate checksum calculation to its own module, so that bufpage knows little if anything about the details of the calculation. This implementation is a modified FNV-1a hash checksum, details of which are given in the new checksum.c header comments. Basic implementation only, so we fix the output value. Later related commits will add version numbers to pg_control, compiler optimization flags and memory barriers. Ants Aasma, reviewed by Jeff Davis and Simon Riggs
* Editorialize a bit on new ProcessUtility() API.Tom Lane2013-04-28
| | | | | | | | Choose a saner ordering of parameters (adding a new input param after the output params seemed a bit random), update the function's header comment to match reality (cmon folks, is this really that hard?), get rid of useless and sloppily-defined distinction between PROCESS_UTILITY_SUBCOMMAND and PROCESS_UTILITY_GENERATED.
* Fix unsafe event-trigger coding in ProcessUtility().Tom Lane2013-04-27
| | | | | | | | | | | | | | | | | | | | | We mustn't run any of the event-trigger support code when handling utility statements like START TRANSACTION or ABORT, because that code may need to refresh event-trigger cache data, which requires being inside a valid transaction. (This mistake explains the consistent build failures exhibited by the CLOBBER_CACHE_ALWAYS buildfarm members, as well as some irreproducible failures on other members.) The least messy fix seems to be to break standard_ProcessUtility into two functions, one that handles all the statements not supported by event triggers, and one that contains the event-trigger support code and handles the statements that are supported by event triggers. This change also fixes several inconsistencies, such as four cases where support had been installed for "ddl_event_start" but not "ddl_event_end" triggers, plus the fact that InvokeDDLCommandEventTriggersIfSupported() paid no mind to isCompleteQuery. Dimitri Fontaine and Tom Lane
* pg_dump: Improve message formattingPeter Eisentraut2013-04-27
|
* Incidental cleanup of matviews code.Tom Lane2013-04-27
| | | | | | | | | | | | | | | | | Move checking for unscannable matviews into ExecOpenScanRelation, which is a better place for it first because the open relation is already available (saving a relcache lookup cycle), and second because this eliminates the problem of telling the difference between rangetable entries that will or will not be scanned by the query. In particular we can get rid of the not-terribly-well-thought-out-or-implemented isResultRel field that the initial matviews patch added to RangeTblEntry. Also get rid of entirely unnecessary scannability check in the rewriter, and a bogus decision about whether RefreshMatViewStmt requires a parse-time snapshot. catversion bump due to removal of a RangeTblEntry field, which changes stored rules.
* Improve message about failed transaction log archivingPeter Eisentraut2013-04-26
| | | | | The old phrasing appeared to imply that the failure was terminal. Improve that by indicating that archiving will be tried again later.
* Fix collation assignment for aggregates with ORDER BY.Tom Lane2013-04-26
| | | | | | | | | | | | | | | | | | | | | | ORDER BY expressions were being treated the same as regular aggregate arguments for purposes of collation determination, but really they should not affect the aggregate's collation at all; only collations of the aggregate's regular arguments should affect it. In many cases this mistake would lead to incorrectly throwing a "collation conflict" error; but in some cases the corrected code will silently assign a different collation to the aggregate than before, for example agg(foo ORDER BY bar COLLATE "x") which will now use foo's collation rather than "x" for the aggregate. Given this risk and the lack of field complaints about the issue, it doesn't seem prudent to back-patch. In passing, rearrange code in assign_collations_walker so that we don't need multiple copies of the standard logic for computing collation of a node with children. (Previously, CaseExpr duplicated the standard logic, and we would have needed a third copy for Aggref without this change.) Andrew Gierth and David Fetter
* Ensure that user created rows in extension tables get dumped if the table is ↵Joe Conway2013-04-26
| | | | | | explicitly requested, either with a -t/--table switch of the table itself, or by -n/--schema switch of the schema containing the extension table. Patch reviewed by Vibhor Kumar and Dimitri Fontaine. Backpatched to 9.1 when the extension management facility was added.
* libpq: Fix a few bits that didn't get the memo about COPY BOTH.Robert Haas2013-04-26
| | | | | | | | There's probably no real bug here at present, so not backpatching. But it seems good to make these bits consistent with the rest of libpq, so as to avoid future surprises. Patch by me. Review by Tom Lane.
* Avoid deadlock between concurrent CREATE INDEX CONCURRENTLY commands.Tom Lane2013-04-25
| | | | | | | | | There was a high probability of two or more concurrent C.I.C. commands deadlocking just before completion, because each would wait for the others to release their reference snapshots. Fix by releasing the snapshot before waiting for other snapshots to go away. Per report from Paul Hinze. Back-patch to all active branches.
* Fix typo in comment.Heikki Linnakangas2013-04-25
| | | | Peter Geoghegan
* pg_basebackup: Add missing newlines at end of linesPeter Eisentraut2013-04-24
|
* initdb: Improve some messagesPeter Eisentraut2013-04-24
|
* Add missing #include.Heikki Linnakangas2013-04-24
| | | | | | | | | On non-Windows systems, sys/time.h was pulled in by portability/instr_time.h, which pulled in time.h. We certainly should include time.h directly, since we're using time(2), but the indirect include masked the problem on most platforms. Andres Freund
* Fix assertion failure for REFRESH MATERIALIZED VIEW in PL.Kevin Grittner2013-04-24
| | | | | | | | | | | This was due to incomplete implementation of rowcount reporting for RMV, which was due to initial waffling on whether it should be provided. It seems unlikely to be a useful or universally available number as more sophisticated techniques for maintaining matviews are added, so remove the partial support rather than completing it. Per report of Jeevan Chalke, but with a different fix
* Make fast promotion the default promotion mode.Simon Riggs2013-04-24
| | | | | Continue to allow a request for synchronous checkpoints as a mechanism in case of problems.
* Fix longstanding race condition in plancache.c.Tom Lane2013-04-20
| | | | | | | | | | | | | | | | | | | When creating or manipulating a cached plan for a transaction control command (particularly ROLLBACK), we must not perform any catalog accesses, since we might be in an aborted transaction. However, plancache.c busily saved or examined the search_path for every cached plan. If we were unlucky enough to do this at a moment where the path's expansion into schema OIDs wasn't already cached, we'd do some catalog accesses; and with some more bad luck such as an ill-timed signal arrival, that could lead to crashes or Assert failures, as exhibited in bug #8095 from Nachiket Vaidya. Fortunately, there's no real need to consider the search path for such commands, so we can just skip the relevant steps when the subject statement is a TransactionStmt. This is somewhat related to bug #5269, though the failure happens during initial cached-plan creation rather than revalidation. This bug has been there since the plan cache was invented, so back-patch to all supported branches.
* Clean up references to SQL92Peter Eisentraut2013-04-20
| | | | | | In most cases, these were just references to the SQL standard in general. In a few cases, a contrast was made between SQL92 and later standards -- those have been kept unchanged.
* Improve error message when an FDW doesn't support WHERE CURRENT OF.Tom Lane2013-04-19
| | | | | | | If an FDW fails to take special measures with a CurrentOfExpr, we will end up trying to execute it as an ordinary qual, which was being treated as a purely internal failure condition. Provide a more user-oriented error message for such cases.
* Standardize spelling of "nonblocking"Peter Eisentraut2013-04-18
| | | | | Only adjusted the user-exposed messages and documentation, not all source code comments.
* pgindent: add newline to die() so script line number is not reported on ↵Bruce Momjian2013-04-16
| | | | failure.
* Remove some unused and seldom used fields from RelationAmInfo.Heikki Linnakangas2013-04-16
| | | | | | | This saves some memory from each index relcache entry. At least on a 64-bit machine, it saves just enough to shrink a typical relcache entry's memory usage from 2k to 1k. That's nice if you have a lot of backends and a lot of indexes.
* Fix function return type confusionPeter Eisentraut2013-04-15
| | | | | When parse_hba_line's return type was changed from bool to a pointer, the MANDATORY_AUTH_ARG macro wasn't adjusted.
* Mark json IO and extraction functions immutable.Andrew Dunstan2013-04-15
| | | | | | Per complaint from Hubert Depesz Lubaczewski. Catalog version bumped.
* Correct handling of NULL arguments in json funcs.Andrew Dunstan2013-04-15
| | | | Per gripe from Tom Lane.
* Add serial commaPeter Eisentraut2013-04-14
|