Commit Graph

36126 Commits

Author SHA1 Message Date
Tom Lane 47aaebaac9 Switch in psql_scan() must cover all lexer states (except backslash cases).
Oversight in commit f7559c0101, which changed
UESCAPE lexing in psql.  Per bug #9068 from Manuel Gómez.
2014-02-02 18:59:34 -05:00
Fujii Masao c087e8cf34 Add <indexterm> for functions pg_sleep_for and pg_sleep_until. 2014-02-03 03:40:36 +09:00
Tom Lane 46825d4978 Clean up some sloppy coding in repl_gram.y.
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.
2014-02-02 12:51:14 -05:00
Fujii Masao 0753bdb352 Add primary_slotname to recovery.conf.sample. 2014-02-03 00:41:50 +09:00
Fujii Masao 63be3b78f6 Fix typos in docs and comments.
Thom Brown
2014-02-02 10:28:18 +09:00
Andrew Dunstan 9abed7d1cb Fix makefile syntax. 2014-02-01 19:52:39 -05:00
Tom Lane 082c0dfa14 Fix some wide-character bugs in the text-search parser.
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-01 18:27:34 -05:00
Andrew Dunstan c8158a2eed fix whitespace 2014-02-01 16:30:26 -05:00
Tom Lane 214c7a4f0b Fix some more bugs in signal handlers and process shutdown logic.
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-01 16:21:23 -05:00
Andrew Dunstan 7e1531a450 Don't use deprecated dllwrap on Cygwin.
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-01 16:08:33 -05:00
Andrew Dunstan d587298b80 Copy the libpq DLL to the bin directory on Mingw and Cygwin.
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-01 15:11:13 -05:00
Bruce Momjian d0ee93797d arrays: tighten checks for multi-dimensional input
Previously an input array string that started with a single-element
array dimension would then later accept a multi-dimensional segment.

BACKWARD INCOMPATIBILITY
2014-02-01 10:49:17 -05:00
Robert Haas 858ec11858 Introduce replication slots.
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-31 22:45:36 -05:00
Bruce Momjian 5bdef38b89 docs: mention 'g' is not in the regex embedded options table
Mentioned in substring() and regexp_replace() sections.
2014-01-31 22:40:08 -05:00
Bruce Momjian 5168c76964 pg_restore: make help output plural for multi-enabled options
per report from Josh Kupershmidt
2014-01-31 22:29:01 -05:00
Robert Haas d1981719ad Clear MyProc and MyProcSignalState before they become invalid.
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-31 21:31:08 -05:00
Bruce Momjian 637fab6e57 doc: mention statistics reset during crash recovery
Takayuki Tsunakawa
2014-01-31 21:28:15 -05:00
Bruce Momjian 6afe200cee chkpass: check for NULL return value from crypt()
Report from Jozef Mlich using Coverity
2014-01-31 20:19:53 -05:00
Bruce Momjian 85317e88cc doc: mention data page checksums in WAL section
Backpatch to 9.3

Adjusted patch from Ian Lawrence Barwick
2014-01-31 19:05:00 -05:00
Tom Lane 326e1d73c4 Disallow use of SSL v3 protocol in the server as well as in libpq.
Commit 820f08cabd 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-31 17:51:18 -05:00
Bruce Momjian 3fd3e34914 docs: mention tgconstrindid supports exclusion constraints
Dean Rasheed
2014-01-31 17:44:18 -05:00
Tom Lane e93ca1618b Add some examples to the postgres_fdw documentation.
Michael Paquier
2014-01-31 17:28:02 -05:00
Bruce Momjian 384fbd1a5d doc: authentication wording improvements
Suggested by David Tonhofer
2014-01-31 17:08:27 -05:00
Bruce Momjian 8824b38909 docs: specify FOR UPDATE/SHARE incompatibilities
Document that FOR UPDATE/SHARE are incompatible with GROUP BY, DISTINCT,
HAVING and window functions.

Michael Paquier
2014-01-31 16:37:25 -05:00
Bruce Momjian fc4ffba968 system catalogs: reorder pg_amproc entries into proper sections
Report form Antonin Houska
2014-01-31 16:04:18 -05:00
Bruce Momjian 290d2cb500 pgindent: add Perl comment 2014-01-31 14:46:00 -05:00
Bruce Momjian cad1e022b2 pgindent: add --list-of-typedefs option
Allows typedefs to be specified on the command line, per request from
Andrew.
2014-01-31 13:35:50 -05:00
Fujii Masao a87ae38be8 Add tab completion for ALTER TABLESPACE MOVE in psql. 2014-02-01 01:45:48 +09:00
Bruce Momjian 5ff47acf8f entab: add new options
Add new entab options to process only C comment whitespace after
periods, and to protect leading whitespace.
2014-01-31 11:05:21 -05:00
Andrew Dunstan e9afdf2f4b Fix documented return type of json_array_elements_text.
Per gripe from hubert depesz lubaczewski.

Also improve examples for this and json_array_elements so they match the
example results.
2014-01-31 09:31:58 -05:00
Tom Lane cd3e0071b8 Allow unrecognized encoding names in locales, as long as they're the same.
The buildfarm says commit 58274728fb doesn't
work so well on Windows.  This is because the encoding part of Windows
locale names can be just a code page number, eg "1252", which we don't
consider to be a valid encoding name.  Add a check to accept encoding
parts that are case-insensitively string equal; this at least ensures
that the new code doesn't reject any cases that the old code allowed.
2014-01-31 02:03:52 -05:00
Bruce Momjian db98b31329 pgindent: preserve blank lines around #else/#endif
This requires a new version of pg_bsd_indent, version 1.3, to be
downloaded.
2014-01-30 22:40:05 -05:00
Tom Lane 58274728fb Be forgiving of variant spellings of locale names in pg_upgrade.
Even though the server tries to canonicalize stored locale names, the
platform often doesn't cooperate, so it's entirely possible that one DB
thinks its locale is, say, "en_US.UTF-8" while the other has "en_US.utf8".
Rather than failing, we should try to allow this where it's clearly OK.

There is already pretty robust encoding lookup in encnames.c, so make
use of that to compare the encoding parts of the names.  The locale
identifier parts are just compared case-insensitively, which we were
already doing.  The major problem known to exist in the field is variant
encoding-name spellings, so hopefully this will be Good Enough.  If not,
we can try being even laxer.

Pavel Raiskup, reviewed by Rushabh Lathia
2014-01-30 19:07:06 -05:00
Tom Lane 41e364ec67 Fix potential coredump on bad locale value in pg_upgrade.
Thinko in error report (and a typo in the message text, too).  We're
failing anyway, but it would be good to print something useful first.
Noted while reviewing a patch to make pg_upgrade's locale code laxer.
2014-01-30 18:10:24 -05:00
Robert Haas 760c770ff6 Add convenience functions pg_sleep_for and pg_sleep_until.
Vik Fearing, reviewed by Pavel Stehule and myself
2014-01-30 15:47:56 -05:00
Tom Lane 043f6ff05d Fix bogus handling of "postponed" lateral quals.
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-30 14:51:16 -05:00
Bruce Momjian c29a6dd548 docs: improve xref description for xreflabel and refentry links 2014-01-30 12:26:18 -05:00
Bruce Momjian 7aba24e971 docs: mention SGML refentry also pulls text from the link 2014-01-30 12:21:48 -05:00
Bruce Momjian b1cbd2b573 docs: add mention of index swapping
Backpatch to 9.3

Greg Smith
2014-01-30 12:14:24 -05:00
Bruce Momjian 146604ec43 Add checks for interval overflow/underflow
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-30 09:41:43 -05:00
Tom Lane 571addd729 Fix unsafe references to errno within error messaging logic.
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-29 20:04:43 -05:00
Andrew Dunstan 120c5cc761 Silence compiler warnings about possibly unset variables.
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-29 18:54:14 -05:00
Andrew Dunstan 5e52e9d6d4 Forgot to bump catalog version for json_array_elements_text. 2014-01-29 16:38:31 -05:00
Robert Haas 9347baa5bb Include planning time in EXPLAIN ANALYZE output.
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-29 16:09:15 -05:00
Andrew Dunstan 5264d91541 Add json_array_elements_text function.
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-29 15:39:01 -05:00
Heikki Linnakangas 699b1f40da Fix thinko in huge_tlb_pages patch.
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-29 21:33:56 +02:00
Heikki Linnakangas 626a120656 Further optimize GIN multi-key searches.
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-29 21:24:38 +02:00
Bruce Momjian 8440897b38 Fix pointer processing in new entab.c function 2014-01-29 13:31:11 -05:00
Bruce Momjian e93f7253a7 Add C functions to centralize entab processing 2014-01-29 12:48:07 -05:00
Bruce Momjian db90bcf8df Add more C comments to entab.c. 2014-01-29 12:22:22 -05:00