summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2014-02-01Fix makefile syntax.Andrew Dunstan
2014-02-01Fix some wide-character bugs in the text-search parser.Tom Lane
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.
2014-02-01fix whitespaceAndrew Dunstan
2014-02-01Fix some more bugs in signal handlers and process shutdown logic.Tom Lane
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.
2014-02-01Don't use deprecated dllwrap on Cygwin.Andrew Dunstan
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.
2014-02-01Copy the libpq DLL to the bin directory on Mingw and Cygwin.Andrew Dunstan
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.
2014-02-01arrays: tighten checks for multi-dimensional inputBruce Momjian
Previously an input array string that started with a single-element array dimension would then later accept a multi-dimensional segment. BACKWARD INCOMPATIBILITY
2014-01-31Introduce replication slots.Robert Haas
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
2014-01-31pg_restore: make help output plural for multi-enabled optionsBruce Momjian
per report from Josh Kupershmidt
2014-01-31Clear MyProc and MyProcSignalState before they become invalid.Robert Haas
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.
2014-01-31Disallow use of SSL v3 protocol in the server as well as in libpq.Tom Lane
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
2014-01-31system catalogs: reorder pg_amproc entries into proper sectionsBruce Momjian
Report form Antonin Houska
2014-01-31pgindent: add Perl commentBruce Momjian
2014-01-31pgindent: add --list-of-typedefs optionBruce Momjian
Allows typedefs to be specified on the command line, per request from Andrew.
2014-02-01Add tab completion for ALTER TABLESPACE MOVE in psql.Fujii Masao
2014-01-31entab: add new optionsBruce Momjian
Add new entab options to process only C comment whitespace after periods, and to protect leading whitespace.
2014-01-30pgindent: preserve blank lines around #else/#endifBruce Momjian
This requires a new version of pg_bsd_indent, version 1.3, to be downloaded.
2014-01-30Add convenience functions pg_sleep_for and pg_sleep_until.Robert Haas
Vik Fearing, reviewed by Pavel Stehule and myself
2014-01-30Fix bogus handling of "postponed" lateral quals.Tom Lane
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.
2014-01-30Add checks for interval overflow/underflowBruce Momjian
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
2014-01-29Fix unsafe references to errno within error messaging logic.Tom Lane
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.
2014-01-29Silence compiler warnings about possibly unset variables.Andrew Dunstan
They are in fact set in every case where they are needed, but the compiler doesn't know that. Per gripe from Tom Lane.
2014-01-29Forgot to bump catalog version for json_array_elements_text.Andrew Dunstan
2014-01-29Include planning time in EXPLAIN ANALYZE output.Robert Haas
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.
2014-01-29Add json_array_elements_text function.Andrew Dunstan
This was a notable omission from the json functions added in 9.3 and there have been numerous complaints about its absence. Laurence Rowe.
2014-01-29Fix thinko in huge_tlb_pages patch.Heikki Linnakangas
We calculated the rounded-up size for the allocation, but then failed to use the rounded-up value in the mmap() call. Oops. Also, initialize allocsize, to silence warnings seen with some compilers, as pointed out by Jeff Janes.
2014-01-29Further optimize GIN multi-key searches.Heikki Linnakangas
When skipping over some items in a posting tree, re-find the new location by descending the tree from root, rather than walking the right links. This can save a lot of I/O. Heavily modified from Alexander Korotkov's fast scan patch.
2014-01-29Fix pointer processing in new entab.c functionBruce Momjian
2014-01-29Add C functions to centralize entab processingBruce Momjian
2014-01-29Add more C comments to entab.c.Bruce Momjian
2014-01-29Further optimize multi-key GIN searches.Heikki Linnakangas
If we're skipping past a certain TID, avoid decoding posting list segments that only contain smaller TIDs. Extracted from Alexander Korotkov's fast scan patch, heavily modified.
2014-01-29Allow skipping some items in a multi-key GIN search.Heikki Linnakangas
In a multi-key search, ie. something like "col @> 'foo' AND col @> 'bar'", as soon as we find the next item that matches the first criteria, we don't need to check the second criteria for TIDs smaller the first match. That saves a lot of effort, especially if one of the terms is rare, while the second occurs very frequently. Based on ideas from Alexander Korotkov's fast scan patch.
2014-01-29Allow using huge TLB pages on Linux (MAP_HUGETLB)Heikki Linnakangas
This patch adds an option, huge_tlb_pages, which allows requesting the shared memory segment to be allocated using huge pages, by using the MAP_HUGETLB flag in mmap(). This can improve performance. The default is 'try', which means that we will attempt using huge pages, and fall back to non-huge pages if it doesn't work. Currently, only Linux has MAP_HUGETLB. On other platforms, the default 'try' behaves the same as 'off'. In the passing, don't try to round the mmap() size to a multiple of pagesize. mmap() doesn't require that, and there's no particular reason for PostgreSQL to do that either. When using MAP_HUGETLB, however, round the request size up to nearest 2MB boundary. This is to work around a bug in some Linux kernel versions, but also to avoid wasting memory, because the kernel will round the size up anyway. Many people were involved in writing this patch, including Christian Kruse, Richard Poole, Abhijit Menon-Sen, reviewed by Peter Geoghegan, Andres Freund and me.
2014-01-28Fix compiler warning in EXEC_BACKEND builds.Robert Haas
Per a report by Rajeev Rastogi.
2014-01-28Add new make targets check-tests and installcheck-tests.Andrew Dunstan
These do not run any specific schedule of tests, but only those specified as part of the invocation, e.g.: make check-tests TESTS="json jsonb"
2014-01-28New json functions.Andrew Dunstan
json_build_array() and json_build_object allow for the construction of arbitrarily complex json trees. json_object() turns a one or two dimensional array, or two separate arrays, into a json_object of name/value pairs, similarly to the hstore() function. json_object_agg() aggregates its two arguments into a single json object as name value pairs. Catalog version bumped. Andrew Dunstan, reviewed by Marko Tiikkaja.
2014-01-29Add pg_stat_archiver statistics view.Fujii Masao
This view shows the statistics about the WAL archiver process's activity. Gabriele Bartolini, reviewed by Michael Paquier, refactored a bit by me.
2014-01-28Revert C comment change in slot_attisnull()Bruce Momjian
Revert 89774b58b0ea2874765cae10c094bb6aaf707feb
2014-01-28Remove orphaned prototypeBruce Momjian
Rajeev rastogi
2014-01-28Revert dup2() checking in syslogger.cStephen Frost
Per the expanded comment- As we're just trying to reset these to go to DEVNULL, there's not much point in checking for failure from the close/dup2 calls here, if they fail then presumably the file descriptors are closed and any writes will go into the bitbucket anyway. Pointed out by Tom.
2014-01-27Log a detail message for auth failures due to missing or expired password.Tom Lane
It's worth distinguishing these cases from run-of-the-mill wrong-password problems, since users have been known to waste lots of time pursuing the wrong theory about what's failing. Now, our longstanding policy about how to report authentication failures is that we don't really want to tell the *client* such things, since that might be giving information to a bad guy. But there's nothing wrong with reporting the details to the postmaster log, and indeed the comments in this area of the code contemplate that interesting details should be so reported. We just weren't handling these particular interesting cases usefully. To fix, add infrastructure allowing subroutines of ClientAuthentication() to return a string to be added to the errdetail_log field of the main authentication-failed error report. We might later want to use this to report other subcases of authentication failure the same way, but for the moment I just dealt with password cases. Per discussion of a patch from Josh Drake, though this is not what he proposed.
2014-01-27Relax the requirement that all lwlocks be stored in a single array.Robert Haas
This makes it possible to store lwlocks as part of some other data structure in the main shared memory segment, or in a dynamic shared memory segment. There is still a main LWLock array and this patch does not move anything out of it, but it provides necessary infrastructure for doing that in the future. This change is likely to increase the size of LWLockPadded on some platforms, especially 32-bit platforms where it was previously only 16 bytes. Patch by me. Review by Andres Freund and KaiGai Kohei.
2014-01-27Fix typo in READMEHeikki Linnakangas
Amit Langote
2014-01-27Code review for auto-tuned effective_cache_size.Tom Lane
Fix integer overflow issue noted by Magnus Hagander, as well as a bunch of other infelicities in commit ee1e5662d8d8330726eaef7d3110cb7add24d058 and its unreasonably large number of followups.
2014-01-27Change the suffix of auto conf temporary file from "temp" to "tmp".Fujii Masao
Michael Paquier
2014-01-27Fix typos in comments for ALTER SYSTEM.Fujii Masao
Michael Paquier
2014-01-26Fix minor leak in pg_dumpStephen Frost
Move allocation to after we check the remote server version, to avoid a possible, very minor, memory leak. This makes us more consistent throughout as most places in pg_dump are done in the same way (due, in part, to previous fixes like this). Spotted by the Coverity scanner.
2014-01-26Provide for client-only installs with MSVC.Andrew Dunstan
MauMau.
2014-01-26Check dup2() results in sysloggerStephen Frost
Consistently check the dup2() call results throughout syslogger.c. It's pretty unlikely that they'll error out, but if they do, ereport(FATAL) instead of blissfully continuing on. Spotted by the Coverity scanner.
2014-01-26Move the options column of \db+ before the descriptionMagnus Hagander
The convention is to have the description field at the end. Noted by Tom Lane