aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
...
* Expand the allowed range of timezone offsets to +/-15:59:59 from Greenwich.Tom Lane2012-05-30
| | | | | | | | | | | | | | | We used to only allow offsets less than +/-13 hours, then it was +/14, then it was +/-15. That's still not good enough though, as per today's bug report from Patric Bechtel. This time I actually looked through the Olson timezone database to find the largest offsets used anywhere. The winners are Asia/Manila, at -15:56:00 until 1844, and America/Metlakatla, at +15:13:42 until 1867. So we'd better allow offsets less than +/-16 hours. Given the history, we are way overdue to have some greppable #define symbols controlling this, so make some ... and also remove an obsolete comment that didn't get fixed the last time. Back-patch to all supported branches.
* Fix two more bugs in fast-path relation locking.Robert Haas2012-05-30
| | | | | | | | | | | | | | | | First, the previous code failed to account for the fact that, during Hot Standby operation, the startup process takes AccessExclusiveLocks on relations without setting MyDatabaseId. This resulted in fast path strong lock counts failing to be incremented with the startup process took locks, which in turn allowed conflicting lock requests to succeed when they should not have. Report by Erik Rijkers, diagnosis by Heikki Linnakangas. Second, LockReleaseAll() failed to honor the allLocks and lockmethodid restrictions with respect to fast-path locks. It's not clear to me whether this produces any user-visible breakage at the moment, but it's certainly wrong. Rearrange order of operations in LockReleaseAll to fix. Noted by Tom Lane.
* Change the way parent pages are tracked during buffered GiST build.Heikki Linnakangas2012-05-30
| | | | | | | | | | | | | | | | | | We used to mimic the way a stack is constructed when descending the tree during normal GiST inserts, but that was quite complicated during a buffered build. It was also wrong: in GiST, the left-to-right relationships on different levels might not match each other, so that when you know the parent of a child page, you won't necessarily find the parent of the page to the right of the child page by following the rightlinks at the parent level. This sometimes led to "could not re-find parent" errors while building a GiST index. We now use a simple hash table to track the parent of every internal page. Whenever a page is split, and downlinks are moved from one page to another, we update the hash table accordingly. This is also better for performance than the old method, as we never need to move right to re-find the parent page, which could take a significant amount of time for buffers that were created much earlier in the index build.
* Delete the temporary file used in buffered GiST build, after the build.Heikki Linnakangas2012-05-30
| | | | | | There were two bugs here: We forgot to call gistFreeBuildBuffers() function at the end of build, and we passed interXact == true to BufFileCreateTemp, so the file wasn't automatically cleaned up at end-of-transaction either.
* Rewrite --section option to decouple it from --schema-only/--data-only.Tom Lane2012-05-29
| | | | | | | | | | | | | | | | | | | | | | | | | The initial implementation of pg_dump's --section option supposed that the existing --schema-only and --data-only options could be made equivalent to --section settings. This is wrong, though, due to dubious but long since set-in-stone decisions about where to dump SEQUENCE SET items, as seen in bug report from Martin Pitt. (And I'm not totally convinced there weren't other bugs, either.) Undo that coupling and instead drive --section filtering off current-section state tracked as we scan through the TOC list to call _tocEntryRequired(). To make sure those decisions don't shift around and hopefully save a few cycles, run _tocEntryRequired() only once per TOC entry and save the result in a new TOC field. This required minor rejiggering of ACL handling but also allows a far cleaner implementation of inhibit_data_for_failed_table. Also, to ensure that pg_dump and pg_restore have the same behavior with respect to the --section switches, add _tocEntryRequired() filtering to WriteToc() and WriteDataChunks(), rather than trying to implement section filtering in an entirely orthogonal way in dumpDumpableObject(). This required adjusting the handling of the special ENCODING and STDSTRINGS items, but they were pretty weird before anyway. Minor other code review for the patch, too.
* Fix integer overflow bug in GiST buffering build calculations.Heikki Linnakangas2012-05-29
| | | | | | | The result of (maintenance_work_mem * 1024) / BLCKSZ doesn't fit in a signed 32-bit integer, if maintenance_work_mem >= 2GB. Use double instead. And while we're at it, write the calculations in an easier to understand form, with the intermediary steps written out and commented.
* Teach AbortOutOfAnyTransaction to clean up partially-started transactions.Tom Lane2012-05-28
| | | | | | | | | | | | AbortOutOfAnyTransaction failed to do anything if the state it saw on entry corresponded to failing partway through StartTransaction. I fixed AbortCurrentTransaction to cope with that case way back in commit 60b2444cc3ba037630c9b940c3c9ef01b954b87b, but evidently overlooked that AbortOutOfAnyTransaction should do likewise. Back-patch to all supported branches. It's not clear that this omission has any more-than-cosmetic consequences, but it's also not clear that it doesn't, so back-patching seems the least risky choice.
* Eliminate some more O(N^2) behaviors in pg_dump/pg_restore.Tom Lane2012-05-28
| | | | | | | | | | | | | | | | | | | This patch fixes three places (which AFAICT is all of them) where runtime was O(N^2) in the number of TOC entries, by using an index array to replace linear searches of the TOC list. This performance issue is a bit less bad than those recently fixed, because it depends on the number of items dumped not the number in the source database, so the problem can be dodged by doing partial dumps. The previous coding already had an instance of one of the two index arrays needed, but it was only calculated in parallel-restore cases; now we need it all the time. I also chose to move the arrays into the ArchiveHandle data structure, to make this code a bit more ready for the day that we try to sling multiple ArchiveHandles around in pg_dump or pg_restore. Since we still need some server-side work before pg_dump can really cope nicely with tens of thousands of tables, there's probably little point in back-patching.
* libpq: URI parsing fixesPeter Eisentraut2012-05-28
| | | | | | | | | | | | | | | Drop special handling of host component with slashes to mean Unix-domain socket. Specify it as separate parameter or using percent-encoding now. Allow omitting username, password, and port even if the corresponding designators are present in URI. Handle percent-encoding in query parameter keywords. Alex Shulgin some documentation improvements by myself
* Update SQL features listPeter Eisentraut2012-05-27
| | | | | | Set E081 Basic Privileges to supported, since by the letter of it, we support it, even though not all possible forms of USAGE privileges are implemented.
* psql: Remove notice about readline from --version outputPeter Eisentraut2012-05-27
| | | | | This was from a time when readline support wasn't standard. And it doesn't help analyzing current line editing library problems.
* Suppress -Wunused-result warning about write()Peter Eisentraut2012-05-27
| | | | | | This is related to aa90e148ca70a235897b1227f1a7cd1c66bc5368, but this code is only used under -DLINUX_OOM_ADJ, so it was apparently overlooked then.
* PL/Perl: Avoid compiler warning from clangPeter Eisentraut2012-05-27
| | | | | Use SvREFCNT_inc_simple_void() instead of SvREFCNT_inc() to avoid warning about unused return value.
* Make pg_recievexlog by default loop on connection failuresMagnus Hagander2012-05-27
| | | | | | Avoids the need for an external script in the most common scenario. Behavior can be overridden using the -n/--noloop commandline parameter.
* Prevent synchronized scanning when systable_beginscan chooses a heapscan.Tom Lane2012-05-26
| | | | | | | | | | | | | | | The only interesting-for-performance case wherein we force heapscan here is when we're rebuilding the relcache init file, and the only such case that is likely to be examining a catalog big enough to be syncscanned is RelationBuildTupleDesc. But the early-exit optimization in that code gets broken if we start the scan at a random place within the catalog, so that allowing syncscan is actually a big deoptimization if pg_attribute is large (at least for the normal case where the rows for core system catalogs have never been changed since initdb). Hence, prevent syncscan here. Per my testing pursuant to complaints from Jeff Frost and Greg Sabino Mullane, though neither of them seem to have actually hit this specific problem. Back-patch to 8.3, where syncscan was introduced.
* Fix string truncation to be multibyte-aware in text_name and bpchar_name.Tom Lane2012-05-25
| | | | | | | | | | | Previously, casts to name could generate invalidly-encoded results. Also, make these functions match namein() more exactly, by consistently using palloc0() instead of ad-hoc zeroing code. Back-patch to all supported branches. Karl Schnaitter and Tom Lane
* Use binary search instead of brute-force scan in findNamespace().Tom Lane2012-05-25
| | | | | | | | | | | The previous coding presented a significant bottleneck when dumping databases containing many thousands of schemas, since the total time spent searching would increase roughly as O(N^2) in the number of objects. Noted by Jeff Janes, though I rewrote his proposed patch to use the existing findObjectByOid infrastructure. Since this is a longstanding performance bug, backpatch to all supported versions.
* Fix base backup streaming xlog from standbyMagnus Hagander2012-05-25
| | | | | | | | | | | | | | When backing up from a standby server, the backup process will not automatically switch xlog segment. So we must accept a partially transferred xlog file in this case, but rename it into position anyway. In passing, merge the two callbacks for segment end and stop stream into a single callback, since their implementations were close to identical, and rename this callback to reflect that it stops streaming rather than continues it. Patch by Magnus Hagander, review by Fujii Masao
* Fix array overrun in regex code.Tom Lane2012-05-24
| | | | | | | | | | | | | | | | | | | zaptreesubs() was coded to unconditionally reset a capture subre's corresponding pmatch[] entry. However, in regexes without backrefs, that array is caller-supplied and might not have as many entries as the regex has capturing parens. So check the array length and do nothing if there is no corresponding entry, much as subset() does. Failure to check this resulted in a stack clobber in the case reported by Marko Kreen. This bug appears to have been latent in the regex library from the beginning. It was not exposed because find() called dissect() not cdissect(), and the dissect() code path didn't ever call zaptreesubs() (formerly zapmem()). When I unified dissect() and cdissect() in commit 4dd78bf37aa29d04b3f358b08c4a2fa43cf828e7, the problem was exposed. Now that I've seen this, I'm rather suspicious that we might need to back-patch it; but will refrain for now, for lack of evidence that the case can be hit in the previous coding.
* Add missing PQfinish() callsMagnus Hagander2012-05-23
| | | | Fujii Masao
* Ensure that seqscans check for interrupts at least once per page.Tom Lane2012-05-22
| | | | | | | | | | | | | If a seqscan encounters many consecutive pages containing only dead tuples, it can remain in the loop in heapgettup for a long time, and there was no CHECK_FOR_INTERRUPTS anywhere in that loop. This meant there were real-world situations where a query would be effectively uncancelable for long stretches. Add a check placed to occur once per page, which should be enough to provide reasonable response time without adding any measurable overhead. Report and patch by Merlin Moncure (though I tweaked it a bit). Back-patch to all supported branches.
* Fix error message for COMMENT/SECURITY LABEL ON COLUMN xxx IS 'yyy'Robert Haas2012-05-22
| | | | | | | | When the column name is an unqualified name, rather than table.column, the error message complains about too many dotted names, which is wrong. Report by Peter Eisentraut based on examination of the sepgsql regression test output, but the problem also affects COMMENT. New wording as suggested by Tom Lane.
* Prevent pg_basebackup when integer_datetimes flag doesn't match.Robert Haas2012-05-22
| | | | | Magnus Hagander, reviewed by Fujii Masao, with slight wording changes by me.
* Repair out-of-date information in src/backend/storage/buffer/README.Robert Haas2012-05-22
| | | | | | | | In commit d526575f893c1a4e05ebd307e80203536b213a6d, we changed things so that buffer usage counts are incremented when the buffer is pinned, rather than when it is unpinned, but the README file didn't get the memo. Report by Amit Kapila.
* Move postmaster's RemovePgTempFiles call to a less randomly chosen place.Tom Lane2012-05-21
| | | | | | | | | | | | | | | | | | There is no reason to do this as early as possible in postmaster startup, and good reason not to do it until we have completely created the postmaster's lock file, namely that it might contribute to pg_ctl thinking that postmaster startup has timed out. (This would require a rather unusual amount of time to be spent scanning temp file directories, but we have at least one field report of it happening reproducibly.) Back-patch to 9.1. Before that, pg_ctl didn't wait for additional info to be added to the lock file, so it wasn't a problem. Note that this is not a complete fix to the slow-start issue in 9.1, because we still had identify_system_timezone being run during postmaster start in 9.1. But that's at least a reasonably well-defined delay, with an easy workaround if needed, whereas the temp-files scan is not so predictable and cannot be avoided.
* Update woefully-obsolete comment.Tom Lane2012-05-21
| | | | | | The accurate info about what's in a lock file has been in miscadmin.h for some time, so let's just make this comment point there instead of maintaining a duplicative copy.
* pg_ctl: Sort signal list in --help outputPeter Eisentraut2012-05-21
| | | | | The list was neither logical nor numerical nor alphabetical. Let's go with alphabetical.
* libpq: Add missing file to GETTEXT_FILES listPeter Eisentraut2012-05-21
| | | | | | For the record, fe-print.c is also missing, but it's sort of deprecated, and the string internationalization there has some issues, and it doesn't seem worth fixing that. So let's leave that out.
* Fix incorrect logic in JSON number lexerPeter Eisentraut2012-05-20
| | | | | | | Detectable by gcc -Wlogical-op. Add two regression test cases that would previously allow incorrect values to pass.
* Realign some --help output to have better spacing between columnsPeter Eisentraut2012-05-18
|
* Fix bug in gistRelocateBuildBuffersOnSplit().Heikki Linnakangas2012-05-18
| | | | | | | | | | | | | | | | | | | When we create a temporary copy of the old node buffer, in stack, we mustn't leak that into any of the long-lived data structures. Before this patch, when we called gistPopItupFromNodeBuffer(), it got added to the array of "loaded buffers". After gistRelocateBuildBuffersOnSplit() exits, the pointer added to the loaded buffers array points to garbage. Often that goes unnotied, because when we go through the array of loaded buffers to unload them, buffers with a NULL pageBuffer are ignored, which can often happen by accident even if the pointer points to garbage. This patch fixes that by marking the temporary copy in stack explicitly as temporary, and refrain from adding buffers marked as temporary to the array of loaded buffers. While we're at it, initialize nodeBuffer->pageBlocknum to InvalidBlockNumber and improve comments a bit. This isn't strictly necessary, but makes debugging easier.
* Update SQL features/conformance information to SQL:2011Peter Eisentraut2012-05-17
|
* Change COLLATION keyword categoryPeter Eisentraut2012-05-16
| | | | | | It was changed from unreserved to reserved as part of the COLLATION FOR syntax, but it turns out that type_func_name_keyword is sufficient.
* Improve error message for ALTER COLUMN TYPE coercion failure.Tom Lane2012-05-16
| | | | | | | Per recent discussion, the error message for this was actually a trifle inaccurate, since it said "cannot be cast" which might be incorrect. Adjust that wording, and add a HINT suggesting that a USING clause might be needed.
* Fix bug in freespace calculation in heap_multi_insert().Heikki Linnakangas2012-05-16
| | | | | | | If the amount of freespace on page was less than the amount reserved by fillfactor, the calculation would underflow. This fixes bug #6643 reported by Tomonari Katsumata.
* Remove whitespace from end of linesPeter Eisentraut2012-05-15
| | | | pgindent and perltidy should clean up the rest.
* Remove stray nbsp characterPeter Eisentraut2012-05-15
|
* Fix bug in to_tsquery().Heikki Linnakangas2012-05-15
| | | | | We were using memcpy() to copy to a possibly overlapping memory region, which is a no-no. Use memmove() instead.
* In pgstat.c, use a timeout in WaitLatchOrSocket only on Windows.Tom Lane2012-05-14
| | | | | | | We have no need for a timeout here really, but some broken products from Redmond seem to lose FD_READ events occasionally, and waking up and retrying the recv() is the only known way to work around that. Perhaps somebody will be motivated to figure out a better answer here; but not I.
* Revert "Add some temporary instrumentation to pgstat.c."Tom Lane2012-05-14
| | | | | This reverts commit 7d88bb73f755f7fb5d847ef2319c21076054fb0e. That instrumentation has served its purpose.
* Put back AC_REQUIRE([AC_STRUCT_TM]).Tom Lane2012-05-14
| | | | | | The BSD-ish members of the buildfarm all seem to think removing this was a bad idea. It looks to me like it resulted in omitting the system header inclusion necessary to detect the fields of struct tm correctly.
* Assert that WaitLatchOrSocket callers cannot wait only for writability.Tom Lane2012-05-14
| | | | | | | | | | | | | Since we have chosen to report socket EOF and error conditions via the WL_SOCKET_READABLE flag bit, it's unsafe to wait only for WL_SOCKET_WRITEABLE; the caller would never be notified of the socket condition, and in some of these implementations WaitLatchOrSocket would busy-wait until something else happens. Add this restriction to the API specification, and add Asserts to check that callers don't try to do that. At some point we might want to consider adjusting the API to relax this restriction, but until we have an actual use case for waiting on a write-only socket, it seems premature to design a solution.
* Remove unused AC_DEFINE symbolsPeter Eisentraut2012-05-14
| | | | | | | | | ENABLE_DTRACE unused as of a7b7b07af340c73adee9959edf260695591a9496 HAVE_ERR_SET_MARK unused as of 4ed4b6c54e5fab24ab2624d80e26f7546edc88ad HAVE_FCVT unused as of 4553e1d80f824291932cfde30aa24a76dd8f1941 HAVE_STRUCT_SOCKADDR_UN unused as of b4cea00a1fc9d2270bfe9aeeee44915378d5f733 HAVE_SYSCONF unused as of f83356c7f574bc69969f29dc7b430b286a0cd9f4 TM_IN_SYS_TIME never used, obsolescent per Autoconf documentation
* For testing purposes, reinsert a timeout in pgstat.c's wait call.Tom Lane2012-05-14
| | | | | | | | | | Test results from buildfarm members mastodon/narwhal (Windows Server 2003) make it look like that platform just plain loses FD_READ events occasionally, and the only reason our previous coding seemed to work was that it timed out every couple of seconds and retried the whole operation. Try to verify this by reinserting a finite timeout into the pgstat loop. This isn't meant to be a permanent patch either, just to confirm or disprove a theory.
* Force pgwin32_recv into nonblock mode when called from pgstat.c.Tom Lane2012-05-14
| | | | | | | | This should get rid of the usage of pgwin32_waitforsinglesocket entirely, and perhaps thereby remove the race condition that's evidently still present on some versions of Windows. The previous arrangement was a bit unsafe anyway, since waiting at the recv() would not allow pgstat to notice postmaster death.
* Remove unnecessary pg_verifymbstr() calls from tsvector/query in functions.Heikki Linnakangas2012-05-14
| | | | | The input should've been validated well before it hits the input function. Doing so again is a waste of cycles.
* Update comments that became out-of-date with the PGXACT struct.Heikki Linnakangas2012-05-14
| | | | | | | | | | | When the "hot" members of PGPROC were split off to separate PGXACT structs, many PGPROC fields referred to in comments were moved to PGXACT, but the comments were neglected in the commit. Mostly this is just a search/replace of PGPROC with PGXACT, but the way the dummy PGPROC entries are created for prepared transactions changed more, making some of the comments totally bogus. Noah Misch
* Remove leftovers of BeOS portPeter Eisentraut2012-05-14
| | | | | These should have been removed when the BeOS port was removed in 44f90212236bfb6fc1279e95dc8fa315104d964e.
* Small punctuation editing of postgresql.conf.samplePeter Eisentraut2012-05-14
|
* pg_ctl: Improve --help outputPeter Eisentraut2012-05-14
| | | | | All other --help output has = signs between long options and their arguments, so do it here as well.