aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
...
* Further pg_dump / ftello improvementsStephen Frost2014-02-09
| | | | | | | | | Make ftello error-checking consistent to all calls and remove a bit of ftello-related code which has been #if 0'd out since 2001. Note that we are not concerned with the ftello() call under snprintf() failing as it is just building a string to call exit_horribly() with; printing -1 in such a case is fine.
* Focus on ftello result < 0 instead of errnoStephen Frost2014-02-09
| | | | | | | | Rather than reset errno (or just hope that its cleared already), check just the result of the ftello for < 0 to determine if there was an issue. Oversight by me, pointed out by Tom.
* Limit pg_basebackup progress output to 1/secondMagnus Hagander2014-02-09
| | | | | | | | | This prevents pg_basebackup from generating excessive output when dumping large clusters. The status is now updated once / second, still making it possible to see that there is progress happening, but limiting the total bandwidth. Mika Eloranta, reviewed by Sawada Masahiko and Oskari Saarenmaa
* Avoid printing uninitialized filename variable in verbose modeMagnus Hagander2014-02-09
| | | | | | | When using verbose mode for pg_basebackup, in tar format sent to stdout, we'd print an unitialized buffer as the filename. Reported by Pontus Lundkvist
* Minor pg_dump improvementsStephen Frost2014-02-08
| | | | | | | | | Improve pg_dump by checking results on various fgetc() calls which previously were unchecked, ditto for ftello. Also clean up a couple of very minor memory leaks by waiting to allocate structures until after the initial check(s). Issues spotted by Coverity.
* Mark some more variables as static or include the appropriate headerPeter Eisentraut2014-02-08
| | | | | | Detected by clang's -Wmissing-variable-declarations. From: Andres Freund <andres@anarazel.de>
* Initialize the entryRes array between each call to triConsistent.Heikki Linnakangas2014-02-07
| | | | | | | | | | | | | | | | | | | | | | The shimTriConstistentFn, which calls the opclass's consistent function with all combinations of TRUE/FALSE for any MAYBE argument, modifies the entryRes array passed by the caller. Change startScanKey to re-initialize it between each call to accommodate that. It's actually a bad habit by shimTriConsistentFn to modify its argument. But the only caller that doesn't already re-initialize the entryRes array was startScanKey, and it's easy for startScanKey to do so. Add a comment to shimTriConsistentFn about that. Note: this does not give a free pass to opclass-provided consistent functions to modify the entryRes argument; shimTriConsistent assumes that they don't, even though it does it itself. While at it, refactor startScanKey to allocate the requiredEntries and additionalEntries after it knows exactly how large they need to be. Saves a little bit of memory, and looks nicer anyway. Per complaint by Tom Lane, buildfarm and the pg_trgm regression test.
* Speed up "rare & frequent" type GIN queries.Heikki Linnakangas2014-02-07
| | | | | | | | | | | | | | | | | | | | | | | | | | If you have a GIN query like "rare & frequent", we currently fetch all the items that match either rare or frequent, call the consistent function for each item, and let the consistent function filter out items that only match one of the terms. However, if we can deduce that "rare" must be present for the overall qual to be true, we can scan all the rare items, and for each rare item, skip over to the next frequent item with the same or greater TID. That greatly speeds up "rare & frequent" type queries. To implement that, introduce the concept of a tri-state consistent function, where the 3rd value is MAYBE, indicating that we don't know if that term is present. Operator classes only provide a boolean consistent function, so we simulate the tri-state consistent function by calling the boolean function several times, with the MAYBE arguments set to all combinations of TRUE and FALSE. Testing all combinations is only feasible for a small number of MAYBE arguments, but it is envisioned that we'll provide a way for operator classes to provide a native tri-state consistent function, which can be much more efficient. But that is not included in this patch. We were already using that trick to for lossy pages, calling the consistent function with the lossy entry set to TRUE and FALSE. Now that we have the tri-state consistent function, use it for lossy pages too. Alexander Korotkov, with fair amount of refactoring by me.
* Fix thinko in comment.Heikki Linnakangas2014-02-07
| | | | Amit Langote
* In RelationClearRelation, postpone cache reload if !IsTransactionState().Tom Lane2014-02-06
| | | | | | | | | | | | | | | | | | We may process relcache flush requests during transaction startup or shutdown. In general it's not terribly safe to do catalog access at those times, so the code's habit of trying to immediately revalidate unflushable relcache entries is risky. Although there are no field trouble reports that are positively traceable to this, we have been able to demonstrate failure of the assertions recently added in RelationIdGetRelation() and SearchCatCache(). On the other hand, it seems safe to just postpone revalidation of the cache entry until we're inside a valid transaction. The one case where this is questionable is where we're exiting a subtransaction and the outer transaction is holding the relcache entry open --- but if we made any significant changes to the rel inside such a subtransaction, we've got problems anyway. There are mechanisms in place to prevent that (to wit, locks for cross-session cases and CheckTableNotInUse() for intra-session cases), so let's trust to those mechanisms to keep us out of trouble.
* Alphabeticize list in OBJS definition in utils/adt Makefile.Andrew Dunstan2014-02-06
|
* Assert(IsTransactionState()) in RelationIdGetRelation().Tom Lane2014-02-06
| | | | | | | Commit 42c80c696e9c8323841180029cc62741c21bd356 added an Assert(IsTransactionState()) in SearchCatCache(), to catch any code that thought it could do a catcache lookup outside transactions. Extend the same idea to relcache lookups.
* Fix whitespacePeter Eisentraut2014-02-05
|
* Remove unnecessary relcache flushes after changing btree metapages.Tom Lane2014-02-05
| | | | | | | | | | | | | | | | | | | | | These flushes were added in my commit d2896a9ed, which added the btree logic that keeps a cached copy of the index metapage data in index relcache entries. The idea was to ensure that other backends would promptly update their cached copies after a change. However, this is not really necessary, since _bt_getroot() has adequate defenses against believing a stale root page link, and _bt_getrootheight() doesn't have to be 100% right. Moreover, if it were necessary, a relcache flush would be an unreliable way to do it, since the sinval mechanism believes that relcache flush requests represent transactional updates, and therefore discards them on transaction rollback. Therefore, we might as well drop these flush requests and save the time to rebuild the whole relcache entry after a metapage change. If we ever try to support in-place truncation of btree indexes, it might be necessary to revisit this issue so that _bt_getroot() can't get caught by trying to follow a metapage link to a page that no longer exists. A possible solution to that is to make use of an smgr, rather than relcache, inval request to force other backends to discard their cached metapages. But for the moment this is not worth pursuing.
* PL/Perl: Fix compiler warningPeter Eisentraut2014-02-04
| | | | | The code was assigning a (Datum) 0 to a void pointer. That creates a warning from clang 3.4. It was probably a thinko to begin with.
* Fix comparison of an array of characters with zero to compare with '\0' instead.Fujii Masao2014-02-04
| | | | Report from Andres Freund.
* Fix lexing of U& sequences just before EOF.Tom Lane2014-02-03
| | | | | | | Commit a5ff502fceadc7c203b0d7a11b45c73f1b421f69 was a brick shy of a load in the backend lexer too, not just psql. Per further testing of bug #9068. In passing, improve related comments.
* Fix *-qualification of named parameters in SQL-language functions.Tom Lane2014-02-03
| | | | | | | Given a composite-type parameter named x, "$1.*" worked fine, but "x.*" not so much. This has been broken since named parameter references were added in commit 9bff0780cf5be2193a5bad0d3df2dbe143085264, so patch back to 9.2. Per bug #9085 from Hardy Falk.
* Adjust pg_sleep_for/pg_sleep_until to use clock_timestamp.Robert Haas2014-02-03
| | | | | | | Otherwise, pg_sleep_until does the wrong thing in a multi-statement transaction. Julien Rouhaud
* In json code, clean up temp memory contexts after processing.Andrew Dunstan2014-02-03
| | | | Craig Ringer.
* Make pg_basebackup skip temporary statistics files.Fujii Masao2014-02-03
| | | | | | | | The temporary statistics files don't need to be included in the backup because they are always reset at the beginning of the archive recovery. This patch changes pg_basebackup so that it skips all files located in $PGDATA/pg_stat_tmp or the directory specified by stats_temp_directory parameter.
* Switch in psql_scan() must cover all lexer states (except backslash cases).Tom Lane2014-02-02
| | | | | Oversight in commit f7559c0101afa33bfb4e104036ca46adac900111, which changed UESCAPE lexing in psql. Per bug #9068 from Manuel Gómez.
* Clean up some sloppy coding in repl_gram.y.Tom Lane2014-02-02
| | | | | | | | | | | | Remove unused copy-and-pasted macro definitions, and improve formatting of recently-added productions. I got interested in this because buildfarm member protosciurus has been crashing in "bison repl_gram.y" since commit 858ec11. It's a long shot that this will fix that, though maybe the missing trailing semicolon has something to do with it? In any case, there's no need to approve of dead code, nor of code whose formatting isn't even self-consistent let alone consistent with what's around it.
* Add primary_slotname to recovery.conf.sample.Fujii Masao2014-02-03
|
* Fix typos in docs and comments.Fujii Masao2014-02-02
| | | | Thom Brown
* Fix makefile syntax.Andrew Dunstan2014-02-01
|
* Fix some wide-character bugs in the text-search parser.Tom Lane2014-02-01
| | | | | | | | | | | | | | | | | | | | | In p_isdigit and other character class test functions generated by the p_iswhat macro, the code path for non-C locales with multibyte encodings contained a bogus pointer cast that would accidentally fail to malfunction if types wchar_t and wint_t have the same width. Apparently that is true on most platforms, but not on recent Cygwin releases. Remove the cast, as it seems completely unnecessary (I think it arose from a false analogy to the need to cast to unsigned char when dealing with the <ctype.h> functions). Per bug #8970 from Marco Atzeri. In the same functions, the code path for C locale with a multibyte encoding simply ANDed each wide character with 0xFF before passing it to the corresponding <ctype.h> function. This could result in false positive answers for some non-ASCII characters, so use a range test instead. Noted by me while investigating Marco's complaint. Also, remove some useless though not actually buggy maskings and casts in the hand-coded p_isalnum and p_isalpha functions, which evidently got tested a bit more carefully than the macro-generated functions.
* fix whitespaceAndrew Dunstan2014-02-01
|
* Fix some more bugs in signal handlers and process shutdown logic.Tom Lane2014-02-01
| | | | | | | | | | | | | WalSndKill was doing things exactly backwards: it should first clear MyWalSnd (to stop signal handlers from touching MyWalSnd->latch), then disown the latch, and only then mark the WalSnd struct unused by clearing its pid field. Also, WalRcvSigUsr1Handler and worker_spi_sighup failed to preserve errno, which is surely a requirement for any signal handler. Per discussion of recent buildfarm failures. Back-patch as far as the relevant code exists.
* Don't use deprecated dllwrap on Cygwin.Andrew Dunstan2014-02-01
| | | | | | | | | | | | The preferred method is to use "cc -shared", and this allows binaries to be rebased if required, unlike dllwrap. Backpatch to 9.0 where we have buildfarm coverage. There are still some issues with Cygwin, especially modern Cygwin, but this helps us get closer to good support. Marco Atzeri.
* Copy the libpq DLL to the bin directory on Mingw and Cygwin.Andrew Dunstan2014-02-01
| | | | | | | | | This has long been done by the MSVC build system, and has caused confusion in the past when programs like psql have failed to start because they can't find the DLL. If it's in the same directory as it now will be they will find it. Backpatch to all live branches.
* arrays: tighten checks for multi-dimensional inputBruce Momjian2014-02-01
| | | | | | | Previously an input array string that started with a single-element array dimension would then later accept a multi-dimensional segment. BACKWARD INCOMPATIBILITY
* Introduce replication slots.Robert Haas2014-01-31
| | | | | | | | | | | | | | | | Replication slots are a crash-safe data structure which can be created on either a master or a standby to prevent premature removal of write-ahead log segments needed by a standby, as well as (with hot_standby_feedback=on) pruning of tuples whose removal would cause replication conflicts. Slots have some advantages over existing techniques, as explained in the documentation. In a few places, we refer to the type of replication slots introduced by this patch as "physical" slots, because forthcoming patches for logical decoding will also have slots, but with somewhat different properties. Andres Freund and Robert Haas
* pg_restore: make help output plural for multi-enabled optionsBruce Momjian2014-01-31
| | | | per report from Josh Kupershmidt
* Clear MyProc and MyProcSignalState before they become invalid.Robert Haas2014-01-31
| | | | | | | | | | | | | | | | | | Evidence from buildfarm member crake suggests that the new test_shm_mq module is routinely crashing the server due to the arrival of a SIGUSR1 after the shared memory segment has been unmapped. Although processes using the new dynamic background worker facilities are more likely to receive a SIGUSR1 around this time, the problem is also possible on older branches, so I'm back-patching the parts of this change that apply to older branches as far as they apply. It's already generally the case that code checks whether these pointers are NULL before deferencing them, so the important thing is mostly to make sure that they do get set to NULL before they become invalid. But in master, there's one case in procsignal_sigusr1_handler that lacks a NULL guard, so add that. Patch by me; review by Tom Lane.
* Disallow use of SSL v3 protocol in the server as well as in libpq.Tom Lane2014-01-31
| | | | | | | | | | | Commit 820f08cabdcbb8998050c3d4873e9619d6d8cba4 claimed to make the server and libpq handle SSL protocol versions identically, but actually the server was still accepting SSL v3 protocol while libpq wasn't. Per discussion, SSL v3 is obsolete, and there's no good reason to continue to accept it. So make the code really equivalent on both sides. The behavior now is that we use the highest mutually-supported TLS protocol version. Marko Kreen, some comment-smithing by me
* system catalogs: reorder pg_amproc entries into proper sectionsBruce Momjian2014-01-31
| | | | Report form Antonin Houska
* pgindent: add Perl commentBruce Momjian2014-01-31
|
* pgindent: add --list-of-typedefs optionBruce Momjian2014-01-31
| | | | | Allows typedefs to be specified on the command line, per request from Andrew.
* Add tab completion for ALTER TABLESPACE MOVE in psql.Fujii Masao2014-02-01
|
* entab: add new optionsBruce Momjian2014-01-31
| | | | | Add new entab options to process only C comment whitespace after periods, and to protect leading whitespace.
* pgindent: preserve blank lines around #else/#endifBruce Momjian2014-01-30
| | | | | This requires a new version of pg_bsd_indent, version 1.3, to be downloaded.
* Add convenience functions pg_sleep_for and pg_sleep_until.Robert Haas2014-01-30
| | | | Vik Fearing, reviewed by Pavel Stehule and myself
* Fix bogus handling of "postponed" lateral quals.Tom Lane2014-01-30
| | | | | | | | | | | | When pulling a "postponed" qual from a LATERAL subquery up into the quals of an outer join, we must make sure that the postponed qual is included in those seen by make_outerjoininfo(). Otherwise we might compute a too-small min_lefthand or min_righthand for the outer join, leading to "JOIN qualification cannot refer to other relations" failures from distribute_qual_to_rels. Subtler errors in the created plan seem possible, too, if the extra qual would only affect join ordering constraints. Per bug #9041 from David Leverton. Back-patch to 9.3.
* Add checks for interval overflow/underflowBruce Momjian2014-01-30
| | | | | | | | New checks include input, month/day/time internal adjustments, addition, subtraction, multiplication, and negation. Also adjust docs to correctly specify interval size in bytes. Report from Rok Kralj
* Fix unsafe references to errno within error messaging logic.Tom Lane2014-01-29
| | | | | | | | | | | | | | | Various places were supposing that errno could be expected to hold still within an ereport() nest or similar contexts. This isn't true necessarily, though in some cases it accidentally failed to fail depending on how the compiler chanced to order the subexpressions. This class of thinko explains recent reports of odd failures on clang-built versions, typically missing or inappropriate HINT fields in messages. Problem identified by Christian Kruse, who also submitted the patch this commit is based on. (I fixed a few issues in his patch and found a couple of additional places with the same disease.) Back-patch as appropriate to all supported branches.
* Silence compiler warnings about possibly unset variables.Andrew Dunstan2014-01-29
| | | | | | | They are in fact set in every case where they are needed, but the compiler doesn't know that. Per gripe from Tom Lane.
* Forgot to bump catalog version for json_array_elements_text.Andrew Dunstan2014-01-29
|
* Include planning time in EXPLAIN ANALYZE output.Robert Haas2014-01-29
| | | | | | | | This doesn't work for prepared queries, but it's not too easy to get the information in that case and there's some debate as to exactly what the right thing to measure is, so just do this for now. Andreas Karlsson, with slight doc changes by me.
* Add json_array_elements_text function.Andrew Dunstan2014-01-29
| | | | | | | This was a notable omission from the json functions added in 9.3 and there have been numerous complaints about its absence. Laurence Rowe.