1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-21 12:05:57 +03:00

35638 Commits

Author SHA1 Message Date
Peter Eisentraut
4b41460675 Revert "Ensure installation dirs are built before contents are installed (v2)"
This reverts commit 7f165f2587f6dafe7d4d438136dd959ed5610979.

pending resolution of
http://www.postgresql.org/message-id/1381193255.25702.4.camel@vanquo.pezone.net
2013-10-07 22:31:31 -04:00
Bruce Momjian
2589a5a59b docs: update release notes for 8.4.18, 9.0.14, 9.1.10, 9.2.5, 9.3.1 2013-10-07 21:35:02 -04:00
Heikki Linnakangas
cc736ed91f Fix bugs in SSI tuple locking.
1. In heap_hot_search_buffer(), the PredicateLockTuple() call is passed
wrong offset number. heapTuple->t_self is set to the tid of the first
tuple in the chain that's visited, not the one actually being read.

2. CheckForSerializableConflictIn() uses the tuple's t_ctid field
instead of t_self to check for exiting predicate locks on the tuple. If
the tuple was updated, but the updater rolled back, t_ctid points to the
aborted dead tuple.

Reported by Hannu Krosing. Backpatch to 9.1.
2013-10-08 00:03:24 +03:00
Peter Eisentraut
4750eae350 Translation updates 2013-10-07 16:27:04 -04:00
Kevin Grittner
ef388b65a8 Eliminate xmin from hash tag for predicate locks on heap tuples.
If a tuple was frozen while its predicate locks mattered,
read-write dependencies could be missed, resulting in failure to
detect conflicts which could lead to anomalies in committed
serializable transactions.

This field was added to the tag when we still thought that it was
necessary to carry locks forward to a new version of an updated
row.  That was later proven to be unnecessary, which allowed
simplification of the code, but elimination of xmin from the tag
was missed at the time.

Per report and analysis by Heikki Linnakangas.
Backpatch to 9.1.
2013-10-07 14:26:54 -05:00
Andrew Dunstan
9598134e30 Document support for VPATH builds of extensions.
Cédric Villemain and me.
2013-10-06 23:03:57 -04:00
Bruce Momjian
6f85b317d6 pg_upgrade doc: link mode additions
Mention that link mode uses less disk space, and uses junction points on
Windows.

Backpatch to 9.3.
2013-10-05 10:18:17 -04:00
Alvaro Herrera
3078f21431 add multixact-no-deadlock to schedule 2013-10-04 15:59:22 -03:00
Alvaro Herrera
0ac659d4a5 Make some isolationtester specs more complete
Also, make sure they pass on all transaction isolation levels.
2013-10-04 15:59:22 -03:00
Alvaro Herrera
eb8a811c5a isolationtester: Allow tuples to be returned in more places
Previously, isolationtester would forbid returning tuples in
session-specific teardown (but not global teardown), as well as in
global setup.  Allow these places to return tuples, too.
2013-10-04 15:59:21 -03:00
Peter Eisentraut
e632b6b594 doc: Correct psycopg URL 2013-10-02 21:34:06 -04:00
Magnus Hagander
513251832e Fix copy/paste error 2013-10-02 16:43:46 +02:00
Alvaro Herrera
ecce2618a9 Remove broken PGXS code for pg_xlogdump
With the PGXS boilerplate in place, pg_xlogdump currently fails with an
ominous error message that certain targets cannot be built because
certain files do not exist.  Remove that and instead throw a quick error
message alerting the user of the actual problem, which should be easier
to diagnose that the statu quo.

Andres Freund
2013-10-01 17:39:46 -03:00
Andrew Dunstan
d794eae613 Add missing condition for pg_depend in hstore migration script.
Error noted by Andres Freund.
2013-09-30 11:38:31 -04:00
Andrew Dunstan
7f165f2587 Ensure installation dirs are built before contents are installed (v2)
Push dependency on installdirs down to individual targets.

Christoph Berg
2013-09-30 10:19:56 -04:00
Heikki Linnakangas
f609d07438 Fix snapshot leak if lo_open called on non-existent object.
lo_open registers the currently active snapshot, and checks if the
large object exists after that. Normally, snapshots registered by lo_open
are unregistered at end of transaction when the lo descriptor is closed, but
if we error out before the lo descriptor is added to the list of open
descriptors, it is leaked. Fix by moving the snapshot registration to after
checking if the large object exists.

Reported by Pavel Stehule. Backpatch to 8.4. The snapshot registration
system was introduced in 8.4, so prior versions are not affected (and not
supported, anyway).
2013-09-30 12:53:56 +03:00
Andrew Dunstan
311be2aa05 Fix makefile broken by hstore fix. 2013-09-29 22:46:30 -04:00
Andrew Dunstan
83e83aad56 Use a new hstore extension version for added json functions.
This should have been done when the json functionality was added to
hstore in 9.3.0. To handle this correctly, the upgrade script therefore
uses conditional logic by using plpgsql in a DO statement to add the two
new functions and the new cast. If hstore_to_json_loose is detected as
already present and dependent on the hstore extension nothing is done.
This will require that the database be loaded with plpgsql.

People who have installed the earlier and spurious 1.1 version of hstore
will need to do:

	ALTER EXTENSION hstore UPDATE;

to pick up the new functions properly.
2013-09-29 17:51:11 -04:00
Andrew Dunstan
f8110c5f66 Backpatch pgxs vpath build and installation fixes.
This is a backpatch of commits d942f9d9, 82b01026, and 6697aa2bc, back
to release 9.1 where we introduced extensions which make heavy use of
the PGXS infrastructure.
2013-09-29 17:28:16 -04:00
Andrew Dunstan
32d8602852 Fix erroneous statements about multiply specified JSON columns.
The behaviour in json_populate_record() and json_populate_recordset()
was changed during development but the docs were not.
2013-09-26 17:46:07 -04:00
Heikki Linnakangas
5bdf02cd29 Fix spurious warning after vacuuming a page on a table with no indexes.
There is a rare race condition, when a transaction that inserted a tuple
aborts while vacuum is processing the page containing the inserted tuple.
Vacuum prunes the page first, which normally removes any dead tuples, but
if the inserting transaction aborts right after that, the loop after
pruning will see a dead tuple and remove it instead. That's OK, but if the
page is on a table with no indexes, and the page becomes completely empty
after removing the dead tuple (or tuples) on it, it will be immediately
marked as all-visible. That's OK, but the sanity check in vacuum would
throw a warning because it thinks that the page contains dead tuples and
was nevertheless marked as all-visible, even though it just vacuumed away
the dead tuples and so it doesn't actually contain any.

Spotted this while reading the code. It's difficult to hit the race
condition otherwise, but can be done by putting a breakpoint after the
heap_page_prune() call.

Backpatch all the way to 8.4, where this code first appeared.
2013-09-26 11:38:15 +03:00
Heikki Linnakangas
3393675282 Plug memory leak in range_cmp function.
B-tree operators are not allowed to leak memory into the current memory
context. Range_cmp leaked detoasted copies of the arguments. That caused
a quick out-of-memory error when creating an index on a range column.

Reported by Marian Krucina, bug #8468.
2013-09-25 16:05:24 +03:00
Alvaro Herrera
ea9a2bcea3 Fix pgindent comment breakage 2013-09-24 18:21:28 -03:00
Noah Misch
98a746c1ea Use @libdir@ in both of regress/{input,output}/security_label.source
Though @libdir@ almost always matches @abs_builddir@ in this context,
the test could only fail if they differed.  Back-patch to 9.1, where the
test was introduced.

Hamid Quddus Akhtar
2013-09-23 16:00:47 -04:00
Robert Haas
faf2971578 doc: Clarify that file_fdw options require values.
Mike Blackwell and Robert Haas
2013-09-23 15:02:08 -04:00
Stephen Frost
73c4e527a4 Fix SSL deadlock risk in libpq
In libpq, we set up and pass to OpenSSL callback routines to handle
locking.  When we run out of SSL connections, we try to clean things
up by de-registering the hooks.  Unfortunately, we had a few calls
into the OpenSSL library after these hooks were de-registered during
SSL cleanup which lead to deadlocking.  This moves the thread callback
cleanup to be after all SSL-cleanup related OpenSSL library calls.
I've been unable to reproduce the deadlock with this fix.

In passing, also move the close_SSL call to be after unlocking our
ssl_config mutex when in a failure state.  While it looks pretty
unlikely to be an issue, it could have resulted in deadlocks if we
ended up in this code path due to something other than SSL_new
failing.  Thanks to Heikki for pointing this out.

Back-patch to all supported versions; note that the close_SSL issue
only goes back to 9.0, so that hunk isn't included in the 8.4 patch.

Initially found and reported by Vesa-Matti J Kari; many thanks to
both Heikki and Andres for their help running down the specific
issue and reviewing the patch.
2013-09-23 08:42:37 -04:00
Heikki Linnakangas
62ff6556ab Fix two timeline handling bugs in pg_receivexlog.
When a timeline history file is fetched from server, it is initially created
with a temporary file name, and renamed to place. However, the temporary
file name was constructed using an uninitialized buffer. Usually that meant
that the file was created in current directory instead of the target, which
usually goes unnoticed, but if the target is on a different filesystem than
the current dir, the rename() would fail. Fix that.

The second issue is that pg_receivexlog would not take .partial files into
account when determining when scanning the target directory for existing
WAL files. If the timeline has switched in the server several times in the
last WAL segment, and pg_receivexlog is restarted, it would choose a too
old starting point. That's not a problem as long as the old WAL segment
exists in the server and can be streamed over, but will cause a failure if
it's not.

Backpatch to 9.3, where this timeline handling code was written.

Analysed by Andrew Gierth, bug #8453, based on a bug report on IRC.
2013-09-23 10:40:25 +03:00
Alvaro Herrera
3451faaec8 Rename various "freeze multixact" variables
It seems to make more sense to use "cutoff multixact" terminology
throughout the backend code; "freeze" is associated with replacing of an
Xid with FrozenTransactionId, which is not what we do for MultiXactIds.

Andres Freund
Some adjustments by Álvaro Herrera
2013-09-16 15:56:11 -03:00
Noah Misch
374652fb6d Ignore interrupts during quickdie().
Once the administrator has called for an immediate shutdown or a backend
crash has triggered a reinitialization, no mere SIGINT or SIGTERM should
change that course.  Such derailment remains possible when the signal
arrives before quickdie() blocks signals.  That being a narrow race
affecting most PostgreSQL signal handlers in some way, leave it for
another patch.  Back-patch this to all supported versions.
2013-09-11 20:14:07 -04:00
Michael Meskes
1eea0ebddc Return error if allocation of new element was not possible.
Found by Coverity.
2013-09-08 13:13:03 +02:00
Michael Meskes
3560dbcaac Close file to no leak file descriptor memory. Found by Coverity. 2013-09-08 13:13:03 +02:00
Jeff Davis
fb843b2679 Improve Range Types and Exclusion Constraints example.
Make the examples self-contained to avoid confusion. Per bug report
8367 from KOIZUMI Satoru.
2013-09-05 07:26:26 -07:00
Bruce Momjian
dacd258bf1 Remove dead URL mention in OSX startup script
Backpatch to 9.3.

Per suggestion from Gavan Schneider
2013-09-04 17:04:57 -04:00
Tom Lane
69876085d6 Don't fail for bad GUCs in CREATE FUNCTION with check_function_bodies off.
The previous coding attempted to activate all the GUC settings specified
in SET clauses, so that the function validator could operate in the GUC
environment expected by the function body.  However, this is problematic
when restoring a dump, since the SET clauses might refer to database
objects that don't exist yet.  We already have the parameter
check_function_bodies that's meant to prevent forward references in
function definitions from breaking dumps, so let's change CREATE FUNCTION
to not install the SET values if check_function_bodies is off.

Authors of function validators were already advised not to make any
"context sensitive" checks when check_function_bodies is off, if indeed
they're checking anything at all in that mode.  But extend the
documentation to point out the GUC issue in particular.

(Note that we still check the SET clauses to some extent; the behavior
with !check_function_bodies is now approximately equivalent to what ALTER
DATABASE/ROLE have been doing for awhile with context-dependent GUCs.)

This problem can be demonstrated in all active branches, so back-patch
all the way.
2013-09-03 18:32:23 -04:00
Alvaro Herrera
30b5b3b917 Update obsolete comment 2013-09-03 16:54:03 -04:00
Greg Stark
9720164d34 Fix thinko in worker_spi, count(*) returns a bigint. Thanks RhodiumToad 2013-09-03 16:44:20 +01:00
Robert Haas
767de7dcd6 docs: Clarify that we also support Solaris versions greater than 10.
MauMau
2013-09-03 11:22:31 -04:00
Tom Lane
da645b3a73 Stamp 9.3.0. REL9_3_0 2013-09-02 16:53:17 -04:00
Tom Lane
e3d02a10ec Update time zone data files to tzdata release 2013d.
DST law changes in Israel, Morocco, Palestine, Paraguay.
Historical corrections for Macquarie Island.
2013-09-02 15:06:30 -04:00
Andrew Dunstan
4e1e5d3bad Fix relfrozenxid query in docs to include TOAST tables.
The original query ignored TOAST tables which could result in tables
needing a vacuum not being reported.

Backpatch to all live branches.
2013-09-02 14:37:53 -04:00
Peter Eisentraut
c7ef895f69 Translation updates 2013-09-02 02:28:21 -04:00
Tom Lane
b9a06c9329 Update "Using EXPLAIN" documentation examples using current code.
It seems like a good idea to update these examples since some fairly
basic planner behaviors have changed in 9.3; notably that the startup cost
for an indexscan plan node is no longer invariably estimated at 0.00.
2013-09-01 19:43:26 -04:00
Tom Lane
3234a64f45 Update 9.3 release notes.
Some corrections, a lot of copy-editing.

Set projected release date as 2013-09-09.
2013-08-31 23:53:33 -04:00
Tom Lane
3c2a425da7 Improve regression test for #8410.
The previous version of the query disregarded the result of the MergeAppend
instead of checking its results.

Andres Freund
2013-08-30 21:40:49 -04:00
Tom Lane
ce58aad2ba Add test case for bug #8410.
Per Andres Freund.
2013-08-30 19:27:47 -04:00
Tom Lane
16e8e36ceb Reset the binary heap in MergeAppend rescans.
Failing to do so can cause queries to return wrong data, error out or crash.
This requires adding a new binaryheap_reset() method to binaryheap.c,
but that probably should have been there anyway.

Per bug #8410 from Terje Elde.  Diagnosis and patch by Andres Freund.
2013-08-30 19:15:32 -04:00
Alvaro Herrera
dfed97b744 Make error wording more consistent 2013-08-29 13:11:08 -04:00
Andrew Dunstan
e536d47ab7 Unconditionally use the WSA equivalents of Socket error constants.
This change will only apply to mingw compilers, and has been found
necessary by late versions of the mingw-w64 compiler. It's the same as
what is done elsewhere for the Microsoft compilers.

Backpatch of commit 73838b5251e.

Problem reported by Michael Cronenworth, although not his patch.
2013-08-26 14:58:14 -04:00
Tom Lane
a5f11e24a4 Account better for planning cost when choosing whether to use custom plans.
The previous coding in plancache.c essentially used 10% of the estimated
runtime as its cost estimate for planning.  This can be pretty bogus,
especially when the estimated runtime is very small, such as in a simple
expression plan created by plpgsql, or a simple INSERT ... VALUES.

While we don't have a really good handle on how planning time compares
to runtime, it seems reasonable to use an estimate based on the number of
relations referenced in the query, with a rather large multiplier.  This
patch uses 1000 * cpu_operator_cost * (nrelations + 1), so that even a
trivial query will be charged 1000 * cpu_operator_cost for planning.
This should address the problem reported by Marc Cousin and others that
9.2 and up prefer custom plans in cases where the planning time greatly
exceeds what can be saved.
2013-08-24 15:14:21 -04:00
Magnus Hagander
3cf89057b5 Don't crash when pg_xlog is empty and pg_basebackup -x is used
The backup will not work (without a logarchive, and that's the whole
point of -x) in this case, this patch just changes it to throw an
error instead of crashing when this happens.

Noticed and diagnosed by TAKATSUKA Haruka
2013-08-24 17:14:18 +02:00