Commit Graph

38597 Commits

Author SHA1 Message Date
Andres Freund 90231cd518 Add missing check for wal_debug GUC.
9a20a9b2 added a new elog(), enabled when WAL_DEBUG is defined. The
other WAL_DEBUG dependant messages check for the wal_debug GUC, but this
one did not. While at it replace 'upto' with 'up to'.

Discussion: 20150610110253.GF3832@alap3.anarazel.de

Backpatch to 9.4, the first release containing 9a20a9b2.
2015-06-21 18:37:09 +02:00
Peter Eisentraut 103382abf8 PL/Perl: Add alternative expected file for Perl 5.22 2015-06-21 10:37:24 -04:00
Noah Misch f0a264a362 Fix failure to copy setlocale() return value.
POSIX permits setlocale() calls to invalidate any previous setlocale()
return values, but commit 5f538ad004
neglected to account for setlocale(LC_CTYPE, NULL) doing so.  The effect
was to set the LC_CTYPE environment variable to an unintended value.
pg_perm_setlocale() sets this variable to assist PL/Perl; without it,
Perl would undo PostgreSQL's locale settings.  The known-affected
configurations are 32-bit, release builds using Visual Studio 2012 or
Visual Studio 2013.  Visual Studio 2010 is unaffected, as were all
buildfarm-attested configurations.  In principle, this bug could leave
the wrong LC_CTYPE in effect after PL/Perl use, which could in turn
facilitate problems like corrupt tsvector datums.  No known platform
experiences that consequence, because PL/Perl on Windows does not use
this environment variable.

The bug has been user-visible, as early postmaster failure, on systems
with Windows ANSI code page set to CP936 for "Chinese (Simplified, PRC)"
and probably on systems using other multibyte code pages.
(SetEnvironmentVariable() rejects values containing character data not
valid under the Windows ANSI code page.)  Back-patch to 9.4, where the
faulty commit first appeared.

Reported by Didi Hu and 林鹏程.  Reviewed by Tom Lane, though this fix
strategy was not his first choice.
2015-06-20 12:09:29 -04:00
Noah Misch 1f2a378de4 Revert "Detect setlocale(LC_CTYPE, NULL) clobbering previous return values."
This reverts commit b76e76be46.  The
buildfarm yielded no related failures.
2015-06-20 12:08:48 -04:00
Alvaro Herrera 1443a165db Fix BRIN supported operators table
Some of the entries in the inclusion opclasses where missing operators,
and we had an entry for inet_inclusion_ops instead of
network_inclusion_ops.  Sort the operators within each opclass by
strategy number, just to make it easier to spot mistakes.

Also sort the rows by data type name, rather than OID.
2015-06-20 12:26:36 -03:00
Alvaro Herrera 3c400a3f2b Fix thinko in comment (launcher -> worker) 2015-06-20 11:45:59 -03:00
Tom Lane 48913db887 In immediate shutdown, postmaster should not exit till children are gone.
This adjusts commit 82233ce7ea so that the
postmaster does not exit until all its child processes have exited, even
if the 5-second timeout elapses and we have to send SIGKILL.  There is no
great value in having the postmaster process quit sooner, and doing so can
mislead onlookers into thinking that the cluster is fully terminated when
actually some child processes still survive.

This effect might explain recent test failures on buildfarm member hamster,
wherein we failed to restart a cluster just after shutting it down with
"pg_ctl stop -m immediate".

I also did a bit of code review/beautification, including fixing a faulty
use of the Max() macro on a volatile expression.

Back-patch to 9.4.  In older branches, the postmaster never waited for
children to exit during immediate shutdowns, and changing that would be
too much of a behavioral change.
2015-06-19 14:23:39 -04:00
Alvaro Herrera da1a9d0f5b Clamp autovacuum launcher sleep time to 5 minutes
This avoids the problem that it might go to sleep for an unreasonable
amount of time in unusual conditions like the server clock moving
backwards an unreasonable amount of time.

(Simply moving the server clock forward again doesn't solve the problem
unless you wake up the autovacuum launcher manually, say by sending it
SIGHUP).

Per trouble report from Prakash Itnal in
https://www.postgresql.org/message-id/CAHC5u79-UqbapAABH2t4Rh2eYdyge0Zid-X=Xz-ZWZCBK42S0Q@mail.gmail.com

Analyzed independently by Haribabu Kommi and Tom Lane.
2015-06-19 12:44:36 -03:00
Tom Lane be87143fe9 Fix bogus range_table_mutator() logic for RangeTblEntry.tablesample.
Must make a copy of the TableSampleClause node; the previous coding
modified the input data structure in-place.

Petr Jelinek
2015-06-19 11:41:56 -04:00
Robert Haas ed16f73c57 Fix corner case in autovacuum-forcing logic for multixact wraparound.
Since find_multixact_start() relies on SimpleLruDoesPhysicalPageExist(),
and that function looks only at the on-disk state, it's possible for it
to fail to find a page that exists in the in-memory SLRU that has not
been written yet.  If that happens, SetOffsetVacuumLimit() will
erroneously decide to force emergency autovacuuming immediately.

We should probably fix find_multixact_start() to consider the data
cached in memory as well as on the on-disk state, but that's no excuse
for SetOffsetVacuumLimit() to be stupid about the case where it can
no longer read the value after having previously succeeded in doing so.

Report by Andres Freund.
2015-06-19 11:28:30 -04:00
Robert Haas 86e4751786 Add PASSWORD to tab completions for CREATE/ALTER ROLE/USER/GROUP.
Jeevan Chalke
2015-06-19 11:11:22 -04:00
Robert Haas ca3f43aa48 Change TAP test framework to not rely on having a chmod executable.
This might not work at all on Windows, and is not ever efficient.

Michael Paquier
2015-06-19 10:52:00 -04:00
Noah Misch b76e76be46 Detect setlocale(LC_CTYPE, NULL) clobbering previous return values.
POSIX permits setlocale() calls to invalidate any previous setlocale()
return values.  Commit 5f538ad004
neglected to account for that.  In advance of fixing that bug, switch to
failing hard on affected configurations.  This is a planned temporary
commit to assay buildfarm-represented configurations.
2015-06-17 08:13:33 -04:00
Andrew Dunstan 41d798a139 Fix comment in fmgr.h to refer to actual function used.
FunctionLookup() is long gone if it ever existed, and fmgr_info() is
what's now used, so the comments now reflect that.
2015-06-15 23:21:03 -04:00
Michael Meskes 94a484222c Check for out of memory when allocating sqlca.
Patch by Michael Paquier
2015-06-15 14:21:03 +02:00
Michael Meskes af0b49fc98 Fix memory leak in ecpglib's connect function.
Patch by Michael Paquier
2015-06-15 14:20:09 +02:00
Bruce Momjian 2bed1cd751 release notes: fix Petr's name typos
Report by Alvaro Herrera
2015-06-14 13:41:37 -04:00
Peter Eisentraut a85054181b doc: Add note to pg_dump man page about pg_dumpall
suggested by Joshua Drake
2015-06-13 21:45:56 -04:00
Peter Eisentraut 340c74dfdf Remove stray character 2015-06-13 21:41:34 -04:00
Bruce Momjian 74cb688525 release notes: consistently name "Alexander Shulgin"
Report by Alvaro Herrera
2015-06-13 21:10:48 -04:00
Bruce Momjian 62331ef3f6 release notes: move/remove/adjust items
Report by Alvaro Herrera
2015-06-13 21:07:24 -04:00
Bruce Momjian 305f815ccd release notes: add accent to Petr Jelínek last name
Report by Alvaro Herrera
2015-06-13 21:00:30 -04:00
Bruce Momjian 31cda8bf3c release notes: remove mention of pg_basebackup non-compat
Report by Amit Kapila
2015-06-13 20:56:30 -04:00
Bruce Momjian 29d80d5fa8 release notes: add Petr Jelinek to JSON function item
Report by Petr Jelinek
2015-06-12 22:34:31 -04:00
Bruce Momjian 230ff9383c release notes: fixes from Fujii Masao
Report by Fujii Masao
2015-06-12 22:31:17 -04:00
Bruce Momjian 644ac3e678 release notes: reorder hash performance authors, again
Report by Robert Haas
2015-06-12 22:25:30 -04:00
Bruce Momjian 51b47c5c09 release notes: reorder sort performance authors
Report by Peter Geoghegan
2015-06-12 22:23:40 -04:00
Bruce Momjian 8bf51ad0cc release notes: split apart hash items
Report by Tom Lane, Robert Haas
2015-06-12 22:16:08 -04:00
Bruce Momjian 89fe9bfc4e release notes: add two optimizer items
Report by Tom Lane
2015-06-12 21:47:49 -04:00
Andrew Dunstan 2271d002d5 Fix "path" infrastructure bug affecting jsonb_set()
jsonb_set() and other clients of the setPathArray() utility function
could get spurious results when an array integer subscript is provided
that is not within the range of int.

To fix, ensure that the value returned by strtol() within setPathArray()
is within the range of int;  when it isn't, assume an invalid input in
line with existing, similar cases.  The path-orientated operators that
appeared in PostgreSQL 9.3 and 9.4 do not call setPathArray(), and
already independently take this precaution, so no change there.

Peter Geoghegan
2015-06-12 19:26:03 -04:00
Tom Lane ae58f1430a Fix failure to cover scalar-vs-rowtype cases in exec_stmt_return().
In commit 9e3ad1aac5 I modified plpgsql
to use exec_stmt_return's simple-variables fast path in more cases.
However, I overlooked that there are really two different return
conventions in use here, depending on whether estate->retistuple is true,
and the existing fast-path code had only bothered to handle one of them.
So trying to return a scalar in a function returning composite, or vice
versa, could lead to unexpected error messages (typically "cache lookup
failed for type 0") or to a null-pointer-dereference crash.

In the DTYPE_VAR case, we can just throw error if retistuple is true,
corresponding to what happens in the general-expression code path that was
being used previously.  (Perhaps someday both of these code paths should
attempt a coercion, but today is not that day.)

In the REC and ROW cases, just hand the problem to exec_eval_datum()
when not retistuple.  Also clean up the ROW coding slightly so it looks
more like exec_eval_datum().

The previous commit also caused exec_stmt_return_next() to be used in
more cases, but that code seems to be OK as-is.

Per off-list report from Serge Rielau.  This bug is new in 9.5 so no need
to back-patch.
2015-06-12 13:44:06 -04:00
Tom Lane b00982344a Improve error message and hint for ALTER COLUMN TYPE can't-cast failure.
We already tried to improve this once, but the "improved" text was rather
off-target if you had provided a USING clause.  Also, it seems helpful
to provide the exact text of a suggested USING clause, so users can just
copy-and-paste it when needed.  Per complaint from Keith Rarick and a
suggestion from Merlin Moncure.

Back-patch to 9.2 where the current wording was adopted.
2015-06-12 11:54:03 -04:00
Fujii Masao b5fe62038f Make postmaster restart archiver soon after it dies, even during recovery.
After the archiver dies, postmaster tries to start a new one immediately.
But previously this could happen only while server was running normally
even though archiving was enabled always (i.e., archive_mode was set to
always). So the archiver running during recovery could not restart soon
after it died. This is an oversight in commit ffd3774.

This commit changes reaper(), postmaster's signal handler to cleanup
after a child process dies, so that it tries to a new archiver even during
recovery if necessary.

Patch by me. Review by Alvaro Herrera.
2015-06-12 23:11:51 +09:00
Michael Meskes 96ad72d1c0 Fixed some memory leaks in ECPG.
Patch by Michael Paquier
2015-06-12 14:52:55 +02:00
Michael Meskes 82be1bf509 Fix intoasc() in Informix compat lib. This function used to be a noop.
Patch by Michael Paquier
2015-06-12 14:50:47 +02:00
Fujii Masao 091c02a958 Fix alphabetization in catalogs.sgml.
System catalogs and views should be listed alphabetically
in catalog.sgml, but only pg_file_settings view not.

This patch also fixes typos in pg_file_settings comments.
2015-06-12 12:59:29 +09:00
Fujii Masao cd3cff4778 Clean up useless mention of RMGRDESCSOURCES in pg_rewind Makefile.
RMGRDESCSOURCES is defined and used only in pg_xlogdump Makefile,
but pg_rewind Makefile mentioned it as extra files to remove in "make clean".
This patch removes that useless mention from pg_rewind Makefile.

Michael Paquier
2015-06-12 12:32:48 +09:00
Bruce Momjian 66447916f7 release notes: add links to doc sections 2015-06-11 23:04:46 -04:00
Bruce Momjian 778fed04cd release notes: update hash item
Report by Tomas Vondra
2015-06-11 11:32:32 -04:00
Bruce Momjian 7b7be78a12 release notes: move pg_buffercache item to the right section
Report by Amit Langote
2015-06-11 11:13:49 -04:00
Bruce Momjian bab74070b3 release notes: implement suggestions
Report by Michael Paquier
2015-06-11 11:11:43 -04:00
Bruce Momjian 1cc9f8ccd9 release notes: explain meaning of pg_stat_get_snapshot_timestamp()
Report by Michael Paquier
2015-06-11 10:58:38 -04:00
Bruce Momjian 5a4ea8e200 release notes: update for pg_basebackup in tar format
Report by Amit Kapila
2015-06-11 10:51:39 -04:00
Andrew Dunstan 908e234733 Rename jsonb - text[] operator to #- to avoid ambiguity.
Following recent discussion  on -hackers. The underlying function is
also renamed to jsonb_delete_path. The regression tests now don't need
ugly type casts to avoid the ambiguity, so they are also removed.

Catalog version bumped.
2015-06-11 10:06:58 -04:00
Fujii Masao 966c37fdb5 Fix some issues in pg_rewind.
* Remove invalid option character "N" from the third argument (valid option
string) of getopt_long().

* Use pg_free() or pfree() to free the memory allocated by pg_malloc() or
palloc() instead of always using free().

* Assume problem is no disk space if write() fails but doesn't set errno.

* Fix several typos.

Patch by me. Review by Michael Paquier.
2015-06-11 22:31:18 +09:00
Bruce Momjian aacb8b9277 First draft of 9.5 release notes 2015-06-11 00:09:32 -04:00
Peter Eisentraut e80f619acf doc: Use "connections" instead of "slots" to avoid confusion
The text was written before replication slots existed, but now "slot" is
best not used for anything else in the space of replication.
2015-06-10 21:34:03 -04:00
Peter Eisentraut 28d17269a1 doc: Fix typo 2015-06-10 21:33:35 -04:00
Peter Eisentraut 385522c7dc Fix typo 2015-06-10 21:30:17 -04:00
Peter Eisentraut 75a49ba550 doc: Call xmllint for validity also in the fop build
This was somehow missed in commit
5d93ce2d0c.
2015-06-10 19:54:28 -04:00