summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2013-03-26Get rid of obsolete parse_version helper function.Heikki Linnakangas
For getting the server's version in numeric form, use PQserverVersion(). It does the exact same parsing as dumputils.c's parse_version(), and has been around in libpq for a long time. For the client's version, just use the PG_VERSION_NUM constant.
2013-03-25Fix a small logic bug in adjusted parallel restore code.Andrew Dunstan
2013-03-25In base backup, only include our own tablespace version directory.Heikki Linnakangas
If you have clusters of different versions pointing to the same tablespace location, we would incorrectly include all the data belonging to the other versions, too. Fixes bug #7986, reported by Sergey Burladyan.
2013-03-25Make pg_basebackup work with pre-9.3 servers, and add server version check.Heikki Linnakangas
A new 'starttli' field was added to the response of BASE_BACKUP command. Make pg_basebackup tolerate the case that it's missing, so that it still works with older servers. Add an explicit check for the server version, so that you get a nicer error message if you try to use it with a pre-9.1 server. The streaming protocol message format changed in 9.3, so -X stream still won't work with pre-9.3 servers. I added a version check to ReceiveXLogStream() earlier, but write that slightly differently, so that in 9.4, it will still work with a 9.3 server. (In 9.4, the error message needs to be adjusted to "9.3 or above", though). Also, if the version check fails, don't retry.
2013-03-25Add PF_PRINTF_ATTRIBUTE to on_exit_msg_fmt.Heikki Linnakangas
Per warning from -Wmissing-format-attribute.
2013-03-25Add missing #include.Heikki Linnakangas
time(2) requires time.h.
2013-03-24Fix some unportable constructs in parallel pg_dump code.Tom Lane
Didn't compile on semi-obsolete gcc, and probably not on not-gcc-at-all either.
2013-03-24Add parallel pg_dump option.Andrew Dunstan
New infrastructure is added which creates a set number of workers (threads on Windows, forked processes on Unix). Jobs are then handed out to these workers by the master process as needed. pg_restore is adjusted to use this new infrastructure in place of the old setup which created a new worker for each step on the fly. Parallel dumps acquire a snapshot clone in order to stay consistent, if available. The parallel option is selected by the -j / --jobs command line parameter of pg_dump. Joachim Wieland, lightly editorialized by Andrew Dunstan.
2013-03-23Update time zone abbreviation lists for changes missed since 2006.Tom Lane
Most (all?) of Russia has moved to what's effectively year-round daylight savings time, so that the "standard" zone names now mean an hour later than they used to. Update that, notably changing MSK as per recent complaint from Sergey Konoplev, but also CHOT, GET, IRKT, KGT, KRAT, MAGT, NOVT, OMST, VLAT, YAKT, YEKT. The corresponding DST abbreviations are presumably now obsolete, but I left them in place with their old definitions, just to reduce any possible breakage from this change. Also add VOLT (Europe/Volgograd), which for some reason we never had before, as well as MIST (Antarctica/Macquarie), and fix obsolete definitions of MAWT, TKT, and WST.
2013-03-23Semi-automatically detect changes in timezone abbreviations.Tom Lane
Add an option to zic.c to dump out all non-obsolete timezone abbreviations defined in the Olson database. Comparing this list to its previous state will clue us in when something happens that we may need to account for in the tznames/ time zone abbreviation lists. The README file's previous exhortation to "just grep for differences" was completely useless advice, in my now-considerable experience; but maybe this will be a bit more useful. As a starting point I built the same list from the tzdata files as they existed in 2006, which is committed here as known_abbrevs.txt. Comparison indeed turned up quite a few changes we had neglected to account for, which I will commit separately.
2013-03-23Avoid renaming data directory during MSVC upgrade testing.Andrew Dunstan
This appears to cause some intermittent file system problems on Windows 8. Instead, set up the old data directory in its intended final location to start with.
2013-03-22Fix problems with incomplete attempt to prohibit OIDS with MVs.Kevin Grittner
Problem with assertion failure in restoring from pg_dump output reported by Joachim Wieland. Review and suggestions by Tom Lane and Robert Haas.
2013-03-22Suppress uninitialized-variable warning in new checksum code.Tom Lane
Some compilers understand that this coding is safe, and some don't.
2013-03-22Add new README file for pages/checksumsSimon Riggs
2013-03-22Allow I/O reliability checks using 16-bit checksumsSimon Riggs
Checksums are set immediately prior to flush out of shared buffers and checked when pages are read in again. Hint bit setting will require full page write when block is dirtied, which causes various infrastructure changes. Extensive comments, docs and README. WARNING message thrown if checksum fails on non-all zeroes page; ERROR thrown but can be disabled with ignore_checksum_failure = on. Feature enabled by an initdb option, since transition from option off to option on is long and complex and has not yet been implemented. Default is not to use checksums. Checksum used is WAL CRC-32 truncated to 16-bits. Simon Riggs, Jeff Davis, Greg Smith Wide input and assistance from many community members. Thank you.
2013-03-22Change commit_delay to be SUSET for 9.3+Simon Riggs
Prior to 9.3 the commit_delay affected only the current user, whereas now only the group leader waits while holding the WALWriteLock. Deliberate or accidental settings to a poor value could seriously degrade performance for all users. Privileges may be delegated by SECURITY DEFINER functions for anyone that needs per-user settings in real situations. Request for change from Peter Geoghegan
2013-03-21Redo postgres_fdw's planner code so it can handle parameterized paths.Tom Lane
I wasn't going to ship this without having at least some example of how to do that. This version isn't terribly bright; in particular it won't consider any combinations of multiple join clauses. Given the cost of executing a remote EXPLAIN, I'm not sure we want to be very aggressive about doing that, anyway. In support of this, refactor generate_implied_equalities_for_indexcol so that it can be used to extract equivalence clauses that aren't necessarily tied to an index.
2013-03-21Fix "element <@ range" cost estimation.Heikki Linnakangas
The statistics-based cost estimation patch for range types broke that, by incorrectly assuming that the left operand of all range oeprators is a range. That lead to a "type x is not a range type" error. Because it took so long for anyone to notice, add a regression test for that case. We still don't do proper statistics-based cost estimation for that, so you just get a default constant estimate. We should look into implementing that, but this patch at least fixes the regression. Spotted by Tom Lane, when testing query from Josh Berkus.
2013-03-20Allow extracting machine-readable object identityAlvaro Herrera
Introduce pg_identify_object(oid,oid,int4), which is similar in spirit to pg_describe_object but instead produces a row of machine-readable information to uniquely identify the given object, without resorting to OIDs or other internal representation. This is intended to be used in the event trigger implementation, to report objects being operated on; but it has usefulness of its own. Catalog version bumped because of the new function.
2013-03-20Bump up timeout delays some more in timeouts isolation test.Tom Lane
The buildfarm members using -DCLOBBER_CACHE_ALWAYS still don't like this test. Some experimentation shows that on my machine, isolationtester's query to check for "waiting" state takes 2 to 2.5 seconds to bind+execute under -DCLOBBER_CACHE_ALWAYS. Set the timeouts to 5 seconds to leave some headroom for possibly-slower buildfarm critters. Really we ought to fix the "waiting" query, which is not only horridly slow but outright wrong in detail; and then maybe we can back off these timeouts. But right now I'm just trying to get the buildfarm green again.
2013-03-19Use ORDER BY on matview definitions were needed for stable plans.Kevin Grittner
Per report from Hadi Moshayedi of matview regression test failure with optimization of aggregates. A few ORDER BY clauses improve code coverage for matviews while solving that problem.
2013-03-18Remove PageSetTLI and rename pd_tli to pd_checksumSimon Riggs
Remove use of PageSetTLI() from all page manipulation functions and adjust README to indicate change in the way we make changes to pages. Repurpose those bytes into the pd_checksum field and explain how that works in comments about page header. Refactoring ahead of actual feature patch which would make use of the checksum field, arriving later. Jeff Davis, with comments and doc changes by Simon Riggs Direction suggested by Robert Haas; many others providing review comments.
2013-03-17Increase timeout delays in new timeouts isolation test.Tom Lane
Buildfarm member friarbird doesn't like this test as-committed, evidently because it's so slow that the test framework doesn't reliably notice that the backend is waiting before the timeout goes off. (This is not totally surprising, since friarbird builds with -DCLOBBER_CACHE_ALWAYS.) Increase the timeout delay from 1 second to 2 in hopes of resolving that problem.
2013-03-17Extend object-access hook machinery to support post-alter events.Robert Haas
This also slightly widens the scope of what we support in terms of post-create events. KaiGai Kohei, with a few changes, mostly to the comments, by me
2013-03-17Improve signal-handler lockout mechanism in timeout.c.Tom Lane
Rather than doing a fairly-expensive setitimer() call to prevent interrupts from happening, let's just invent a simple boolean flag that the signal handler is required to check. This is not only faster but considerably more robust than before, since the previous code effectively assumed that only ITIMER_REAL events would ever fire the SIGALRM handler, which is obviously something that can be broken easily by third-party code. Zoltán Böszörményi and Tom Lane
2013-03-17Re-include pqsignal() in libpq.Tom Lane
We need this in non-ENABLE_THREAD_SAFETY builds, and also to satisfy the exports.txt entry; while it might be a good idea to remove the latter, I'm hesitant to do so except in the context of an intentional ABI break. At least we don't have a separately maintained source file for it anymore.
2013-03-17initdb needs pqsignal() even on Windows.Tom Lane
I had thought we weren't using this version of pqsignal() at all on Windows, but that's wrong --- initdb is using it (and coping with the POSIX-ish semantics of bare signal() :-(). So allow the file to be built in WIN32+FRONTEND case, and add it to the MSVC build logic.
2013-03-17Fix inclusions in pg_receivexlog.c.Tom Lane
Apparently this was depending on pqsignal.h for <signal.h>. Not sure why I didn't see the failure on my other machine.
2013-03-17Move pqsignal() to libpgport.Tom Lane
We had two copies of this function in the backend and libpq, which was already pretty bogus, but it turns out that we need it in some other programs that don't use libpq (such as pg_test_fsync). So put it where it probably should have been all along. The signal-mask-initialization support in src/backend/libpq/pqsignal.c stays where it is, though, since we only need that in the backend.
2013-03-16Add lock_timeout configuration parameter.Tom Lane
This GUC allows limiting the time spent waiting to acquire any one heavyweight lock. In support of this, improve the recently-added timeout infrastructure to permit efficiently enabling or disabling multiple timeouts at once. That reduces the performance hit from turning on lock_timeout, though it's still not zero. Zoltán Böszörményi, reviewed by Tom Lane, Stephen Frost, and Hari Babu
2013-03-16pg_resetxlog: Capitalize placeholder in --help outputPeter Eisentraut
2013-03-16pg_controldata: Undo message spelling changePeter Eisentraut
2013-03-15Improve error reporting in code that checks for buffer refcount leaks.Tom Lane
Formerly we just Assert'ed that each refcount was zero, which was quick and easy but failed to provide a good overview of what was wrong. Change the code so that we'll call PrintBufferLeakWarning() for each buffer with a nonzero refcount, and then Assert at the end of the loop. This costs nothing in runtime and might ease diagnosis of some bugs. Greg Smith, reviewed by Satoshi Nagayasu, further tweaked by me
2013-03-14Extend format() to handle field width and left/right alignment.Tom Lane
This change adds some more standard sprintf() functionality to format(). Pavel Stehule, reviewed by Dean Rasheed and Kyotaro Horiguchi
2013-03-14Avoid inserting no-op Limit plan nodes.Tom Lane
This was discussed in connection with the patch to avoid inserting no-op Result nodes, but not actually implemented therein.
2013-03-14Revert unnecessary change in MV call to checkRuleResultList().Kevin Grittner
Due to a misreading of the function's comment block, there was an unneeded change to a call in rewriteDefine.c. There is, in fact no reason to pass false for a MV; it should be true just like a view. Fixes issue pointed out by Tom Lane
2013-03-14Add regression test for MV join to view.Kevin Grittner
This would have caught a bug in the initial patch, and seems like a good thing to test going forward. Per bug report by Erik Rijkers and fix by Tom Lane
2013-03-14Also update psqlscan.l with the UESCAPE error rule changes.Heikki Linnakangas
Even though this patch had no user-visible difference, better keep the code in psqlscan.l sync with the backend lexer. And of course it's nice to shrink the psql binary, too. Ecpg's version of the lexer doesn't have the error rule, it doesn't try to avoid backing up, so it doesn't need to be modified. As reminded by Tom Lane
2013-03-14Avoid inserting Result nodes that only compute identity projections.Tom Lane
The planner sometimes inserts Result nodes to perform column projections (ie, arbitrary scalar calculations) above plan nodes that lack projection logic of their own. However, we did that even if the lower plan node was in fact producing the required column set already; which is a pretty common case given the popularity of "SELECT * FROM ...". Measurements show that the useless plan node adds non-negligible overhead, especially when there are many columns in the result. So add a check to avoid inserting a Result node unless there's something useful for it to do. There are a couple of remaining places where unnecessary Result nodes could get inserted, but they are (a) much less performance-critical, and (b) coded in such a way that it's hard to avoid inserting a Result, because the desired tlist is changed on-the-fly in subsequent logic. We'll leave those alone for now. Kyotaro Horiguchi; reviewed and further hacked on by Amit Kapila and Tom Lane.
2013-03-14Change the way UESCAPE is lexed, to reduce the size of the flex tables.Heikki Linnakangas
The error rule used to avoid backtracking with the U&'...' UESCAPE 'x' syntax bloated the flex tables, so refactor that. This patch makes the error rule shorter, by introducing a new exclusive flex state that's entered after parsing U&'...'. This shrinks the postgres binary by about 220kB.
2013-03-14Add cost estimation of range @> and <@ operators.Heikki Linnakangas
The estimates are based on the existing lower bound histogram, and a new histogram of range lengths. Bump catversion, because the range length histogram now needs to be present in statistic slot kind 6, or you get an error on @> and <@ queries. (A re-ANALYZE would be enough to fix that, though) Alexander Korotkov, with some refactoring by me.
2013-03-13Add regression tests for XML mapping of domainsPeter Eisentraut
Pavel Stěhule
2013-03-13Fix bug in dumping prior releases due to MV REFRESH dependency checking.Kevin Grittner
Reports and suggested patches from Fujii Masao and Andrew Dunstan. Andrew Dunstan
2013-03-12Allow default expressions to be attached to columns of foreign tables.Tom Lane
There's still some discussion about exactly how postgres_fdw ought to handle this case, but there seems no debate that we want to allow defaults to be used for inserts into foreign tables. So remove the core-code restrictions that prevented it. While at it, get rid of the special grammar productions for CREATE FOREIGN TABLE, and instead add explicit FEATURE_NOT_SUPPORTED error checks for the disallowed cases. This makes the grammar a shade smaller, and more importantly results in much more intelligible error messages for unsupported cases. It's also one less thing to fix if we ever start supporting constraints on foreign tables.
2013-03-11Fix thinko in matview patch.Tom Lane
"break" instead of "continue" suppressed view expansion for views appearing later in the range table. Per report from Erikjan Rijkers. While at it, improve the associated comment a bit.
2013-03-10JSON generation improvements.Andrew Dunstan
This adds the following: json_agg(anyrecord) -> json to_json(any) -> json hstore_to_json(hstore) -> json (also used as a cast) hstore_to_json_loose(hstore) -> json The last provides heuristic treatment of numbers and booleans. Also, in json generation, if any non-builtin type has a cast to json, that function is used instead of the type's output function. Andrew Dunstan, reviewed by Steve Singer. Catalog version bumped.
2013-03-10pg_ctl: Adjust nls.mk for split out of wait_error.cPeter Eisentraut
2013-03-10pg_basebackup: Add missing newlines to several error messagesPeter Eisentraut
2013-03-10Support writable foreign tables.Tom Lane
This patch adds the core-system infrastructure needed to support updates on foreign tables, and extends contrib/postgres_fdw to allow updates against remote Postgres servers. There's still a great deal of room for improvement in optimization of remote updates, but at least there's basic functionality there now. KaiGai Kohei, reviewed by Alexander Korotkov and Laurenz Albe, and rather heavily revised by Tom Lane.
2013-03-10Report pg_hba line number and contents when users fail to log inMagnus Hagander
Instead of just reporting which user failed to log in, log both the line number in the active pg_hba.conf file (which may not match reality in case the file has been edited and not reloaded) and the contents of the matching line (which will always be correct), to make it easier to debug incorrect pg_hba.conf files. The message to the client remains unchanged and does not include this information, to prevent leaking security sensitive information. Reviewed by Tom Lane and Dean Rasheed