]> granicus.if.org Git - postgresql/log
postgresql
15 years agoConvert a perl array to a postgres array when returned by Set Returning Functions...
Andrew Dunstan [Mon, 28 Sep 2009 17:30:56 +0000 (17:30 +0000)]
Convert a perl array to a postgres array when returned by Set Returning Functions as well as non SRFs. Backpatch to 8.1 where these facilities were introduced. with a little help from Abhijit Menon-Sen.

15 years agoFix RelationCacheInitializePhase2 (Phase3, in HEAD) to cope with the
Tom Lane [Sat, 26 Sep 2009 18:24:55 +0000 (18:24 +0000)]
Fix RelationCacheInitializePhase2 (Phase3, in HEAD) to cope with the
possibility of shared-inval messages causing a relcache flush while it tries
to fill in missing data in preloaded relcache entries.  There are actually
two distinct failure modes here:

1. The flush could delete the next-to-be-processed cache entry, causing
the subsequent hash_seq_search calls to go off into the weeds.  This is
the problem reported by Michael Brown, and I believe it also accounts
for bug #5074.  The simplest fix is to restart the hashtable scan after
we've read any new data from the catalogs.  It appears that pre-8.4
branches have not suffered from this failure, because by chance there were
no other catalogs sharing the same hash chains with the catalogs that
RelationCacheInitializePhase2 had work to do for.  However that's obviously
pretty fragile, and it seems possible that derivative versions with
additional system catalogs might be vulnerable, so I'm back-patching this
part of the fix anyway.

2. The flush could delete the *current* cache entry, in which case the
pointer to the newly-loaded data would end up being stored into an
already-deleted Relation struct.  As long as it was still deleted, the only
consequence would be some leaked space in CacheMemoryContext.  But it seems
possible that the Relation struct could already have been recycled, in
which case this represents a hard-to-reproduce clobber of cached data
structures, with unforeseeable consequences.  The fix here is to pin the
entry while we work on it.

In passing, also change RelationCacheInitializePhase2 to Assert that
formrdesc() set up the relation's cached TupleDesc (rd_att) with the
correct type OID and hasoids values.  This is more appropriate than
silently updating the values, because the original tupdesc might already
have been copied into the catcache.  However this part of the patch is
not in HEAD because it fails due to some questionable recent changes in
formrdesc :-(.  That will be cleaned up in a subsequent patch.

15 years agoFix crash if a DROP is attempted on an internally-dependent object.
Tom Lane [Tue, 22 Sep 2009 15:46:43 +0000 (15:46 +0000)]
Fix crash if a DROP is attempted on an internally-dependent object.
Introduced in 8.4 rewrite of dependency.c.
Per bug #5072 from Amit Khandekar.

15 years agofsync test files
Bruce Momjian [Mon, 21 Sep 2009 20:21:02 +0000 (20:21 +0000)]
fsync test files

Prevent creation of 16GB files during fsync testing; only create 16MB
files;  backpatch to 8.4.X.

15 years agoA bit more wordsmithing on the COPY CSV NULL business.
Tom Lane [Fri, 18 Sep 2009 20:01:18 +0000 (20:01 +0000)]
A bit more wordsmithing on the COPY CSV NULL business.

15 years agoFix incorrect arguments for gist_box_penalty call. The bug could be observed
Teodor Sigaev [Fri, 18 Sep 2009 14:02:40 +0000 (14:02 +0000)]
Fix incorrect arguments for gist_box_penalty call. The bug could be observed
only for secondary page split (i.e. for non-first columns of index)

 Patch by Paul Ramsey <pramsey@opengeo.org>

15 years agoCSV NULL Documentation
Bruce Momjian [Thu, 17 Sep 2009 21:49:22 +0000 (21:49 +0000)]
CSV NULL Documentation

Update docs to clearly explain NULL value matching behavior, per Andrew.

Backpatch to 8.4.X.

15 years agoCVS NULL Documentation
Bruce Momjian [Thu, 17 Sep 2009 21:28:30 +0000 (21:28 +0000)]
CVS NULL Documentation

Clearify documentation of CVS's output of NULL values, per suggestion
from Magnus.

Backpatch to 8.4.X.

15 years agoFix two distinct errors in creation of GIN_INSERT_LISTPAGE xlog records.
Tom Lane [Tue, 15 Sep 2009 20:31:35 +0000 (20:31 +0000)]
Fix two distinct errors in creation of GIN_INSERT_LISTPAGE xlog records.
In practice these mistakes were always masked when full_page_writes was on,
because XLogInsert would always choose to log the full page, and then
ginRedoInsertListPage wouldn't try to do anything.  But with full_page_writes
off a WAL replay failure was certain.

The GIN_INSERT_LISTPAGE record type could probably be eliminated entirely
in favor of using XLOG_HEAP_NEWPAGE, but I refrained from doing that now
since it would have required a significantly more invasive patch.

In passing do a little bit of code cleanup, including making the accounting
for free space on GIN list pages more precise.  (This wasn't a bug as the
errors were always in the conservative direction.)

Per report from Simon.  Back-patch to 8.4 which contains the identical code.

15 years agoDon't error out if recycling or removing an old WAL segment fails at the end
Heikki Linnakangas [Sun, 13 Sep 2009 18:32:17 +0000 (18:32 +0000)]
Don't error out if recycling or removing an old WAL segment fails at the end
of checkpoint. Although the checkpoint has been written to WAL at that point
already, so that all data is safe, and we'll retry removing the WAL segment at
the next checkpoint, if such a failure persists we won't be able to remove any
other old WAL segments either and will eventually run out of disk space. It's
better to treat the failure as non-fatal, and move on to clean any other WAL
segment and continue with any other end-of-checkpoint cleanup.

We don't normally expect any such failures, but on Windows it can happen with
some anti-virus or backup software that lock files without FILE_SHARE_DELETE
flag.

Also, the loop in pgrename() to retry when the file is locked was broken. If a
file is locked on Windows, you get ERROR_SHARE_VIOLATION, not
ERROR_ACCESS_DENIED, at least on modern versions. Fix that, although I left
the check for ERROR_ACCESS_DENIED in there as well (presumably it was correct
in some environment), and added ERROR_LOCK_VIOLATION to be consistent with
similar checks in pgwin32_open(). Reduce the timeout on the loop from 30s to
10s, on the grounds that since it's been broken, we've effectively had a
timeout of 0s and no-one has complained, so a smaller timeout is actually
closer to the old behavior. A longer timeout would mean that if recycling a
WAL file fails because it's locked for some reason, InstallXLogFileSegment()
will hold ControlFileLock for longer, potentially blocking other backends, so
a long timeout isn't totally harmless.

While we're at it, set errno correctly in pgrename().

Backpatch to 8.2, which is the oldest version supported on Windows. The xlog.c
changes would make sense on other platforms and thus on older versions as
well, but since there's no such locking issues on other platforms, it's not
worth it.

15 years agoplug dblink resource leak
Joe Conway [Sat, 12 Sep 2009 23:21:13 +0000 (23:21 +0000)]
plug dblink resource leak

dblink generates orphaned connections when called with a connection string,
fail_on_error = true, and an ERROR occurs. Discovery and patch by
Tatsuhito Kasahara. Introduced in 8.4.

15 years agoFix assertion failure when a SELECT DISTINCT ON expression is volatile.
Tom Lane [Sat, 12 Sep 2009 00:05:07 +0000 (00:05 +0000)]
Fix assertion failure when a SELECT DISTINCT ON expression is volatile.
In this case we generate two PathKey references to the expression (one for
DISTINCT and one for ORDER BY) and they really need to refer to the same
EquivalenceClass.  However get_eclass_for_sort_expr was being overly paranoid
and creating two different EC's.  Correct behavior is to use the SortGroupRef
index to decide whether two references to volatile expressions that are
equal() (ie textually equivalent) should be considered the same.

Backpatch to 8.4.  Possibly this should be changed in 8.3 as well, but
I'll refrain in the absence of evidence of a visible failure in that branch.

Per bug #5049.

15 years agoOn Windows, when a file is deleted and another process still has an open
Heikki Linnakangas [Thu, 10 Sep 2009 09:42:29 +0000 (09:42 +0000)]
On Windows, when a file is deleted and another process still has an open
file handle on it, the file goes into "pending deletion" state where it
still shows up in directory listing, but isn't accessible otherwise. That
confuses RemoveOldXLogFiles(), making it think that the file hasn't been
archived yet, while it actually was, and it was deleted along with the .done
file.

Fix that by renaming the file with ".deleted" extension before deleting it.
Also check the return value of rename() and unlink(), so that if the removal
fails for any reason (e.g another process is holding the file locked), we
don't delete the .done file until the WAL file is really gone.

Backpatch to 8.2, which is the oldest version supported on Windows.

15 years agoFix bug with WITH RECURSIVE immediately inside WITH RECURSIVE. 99% of the
Tom Lane [Wed, 9 Sep 2009 03:33:01 +0000 (03:33 +0000)]
Fix bug with WITH RECURSIVE immediately inside WITH RECURSIVE.  99% of the
code was already okay with this, but the hack that obtained the output
column types of a recursive union in advance of doing real parse analysis
of the recursive union forgot to handle the case where there was an inner
WITH clause available to the non-recursive term.  Best fix seems to be to
refactor so that we don't need the "throwaway" parse analysis step at all.
Instead, teach the transformSetOperationStmt code to set up the CTE's output
column information after it's processed the non-recursive term normally.
Per report from David Fetter.

15 years agoRemove outside-the-scanner references to "yyleng".
Tom Lane [Tue, 8 Sep 2009 04:25:14 +0000 (04:25 +0000)]
Remove outside-the-scanner references to "yyleng".

It seems the flex developers have decided to change yyleng from int to size_t.
This has already happened in the latest release of OS X, and will start
happening elsewhere once the next release of flex appears.  Rather than trying
to divine how it's declared in any particular build, let's just remove the one
existing not-very-necessary external usage.

Back-patch to all supported branches; not so much because users in the field
are likely to care about building old branches with cutting-edge flex, as
to keep OSX-based buildfarm members from having problems with old branches.

15 years agoUpdate the tznames reference files, and add IDT (Israel Daylight Time)
Tom Lane [Sun, 6 Sep 2009 15:25:31 +0000 (15:25 +0000)]
Update the tznames reference files, and add IDT (Israel Daylight Time)
to the Default timezone abbreviation set.

Back-port the the current file set to all branches that contain tznames.
This includes adding SGT to the Default set in pre-8.4 releases.

Joachim Wieland

15 years agoPut back "ifeq ($(PORTNAME), solaris)", this time with some documentation
Tom Lane [Sat, 5 Sep 2009 21:14:13 +0000 (21:14 +0000)]
Put back "ifeq ($(PORTNAME), solaris)", this time with some documentation
of why it's not as broken as it appears on first glance.

15 years agoRevert ill-considered restriction of dtrace support to Solaris only.
Tom Lane [Fri, 4 Sep 2009 23:11:10 +0000 (23:11 +0000)]
Revert ill-considered restriction of dtrace support to Solaris only.

15 years agoFix encoding handling in xml binary input function. If the XML header didn't
Heikki Linnakangas [Fri, 4 Sep 2009 10:49:43 +0000 (10:49 +0000)]
Fix encoding handling in xml binary input function. If the XML header didn't
specify an encoding explicitly, we used to treat it as being in database
encoding when we parsed it, but then perform a UTF-8 -> database encoding
conversion on it, which was completely bogus. It's now consistently treated as
UTF-8.

15 years agoTag 8.4.1 REL8_4_1
Marc G. Fournier [Fri, 4 Sep 2009 00:36:51 +0000 (00:36 +0000)]
Tag 8.4.1

15 years agoFinal updates of release notes for 8.4.1, 8.3.8, 8.2.14, 8.1.18, 8.0.22,
Tom Lane [Thu, 3 Sep 2009 22:13:58 +0000 (22:13 +0000)]
Final updates of release notes for 8.4.1, 8.3.8, 8.2.14, 8.1.18, 8.0.22,
7.4.26.

15 years agoMake LOAD of an already-loaded library into a no-op, instead of attempting
Tom Lane [Thu, 3 Sep 2009 22:11:13 +0000 (22:11 +0000)]
Make LOAD of an already-loaded library into a no-op, instead of attempting
to unload and re-load the library.

The difficulty with unloading a library is that we haven't defined safe
protocols for doing so.  In particular, there's no safe mechanism for
getting out of a "hook" function pointer unless libraries are unloaded
in reverse order of loading.  And there's no mechanism at all for undefining
a custom GUC variable, so GUC would be left with a pointer to an old value
that might or might not still be valid, and very possibly wouldn't be in
the same place anymore.

While the unload and reload behavior had some usefulness in easing
development of new loadable libraries, it's of no use whatever to normal
users, so just disabling it isn't giving up that much.  Someday we might
care to expend the effort to develop safe unload protocols; but even if
we did, there'd be little certainty that every third-party loadable module
was following them, so some security restrictions would still be needed.

Back-patch to 8.2; before that, LOAD was superuser-only anyway.

Security: unprivileged users could crash backend.  CVE not assigned yet

15 years agoDisallow RESET ROLE and RESET SESSION AUTHORIZATION inside security-definer
Tom Lane [Thu, 3 Sep 2009 22:08:14 +0000 (22:08 +0000)]
Disallow RESET ROLE and RESET SESSION AUTHORIZATION inside security-definer
functions.

This extends the previous patch that forbade SETting these variables inside
security-definer functions.  RESET is equally a security hole, since it
would allow regaining privileges of the caller; furthermore it can trigger
Assert failures and perhaps other internal errors, since the code is not
expecting these variables to change in such contexts.  The previous patch
did not cover this case because assign hooks don't really have enough
information, so move the responsibility for preventing this into guc.c.

Problem discovered by Heikki Linnakangas.

Security: no CVE assigned yet, extends CVE-2007-6600

15 years agoTranslation updates
Peter Eisentraut [Thu, 3 Sep 2009 21:01:26 +0000 (21:01 +0000)]
Translation updates

15 years agoInstall a workaround for a longstanding gcc bug that allows SIGFPE traps
Tom Lane [Thu, 3 Sep 2009 18:48:21 +0000 (18:48 +0000)]
Install a workaround for a longstanding gcc bug that allows SIGFPE traps
to occur for division by zero, even though the code is carefully avoiding
that.  All available evidence is that the only functions affected are
int24div, int48div, and int28div, so patch just those three functions to
include a "return" after the ereport() call.

Backpatch to 8.4 so that the fix can be tested in production builds.
For older branches our recommendation will continue to be to use -O1
on affected platforms (which are mostly non-mainstream anyway).

15 years agoUpdate time zone data files to tzdata release 2009l: DST law changes in
Tom Lane [Thu, 3 Sep 2009 04:44:43 +0000 (04:44 +0000)]
Update time zone data files to tzdata release 2009l: DST law changes in
Egypt, Mauritius, Bangladesh.

15 years agoFix subquery pullup to wrap a PlaceHolderVar around the entire RowExpr
Tom Lane [Wed, 2 Sep 2009 17:52:33 +0000 (17:52 +0000)]
Fix subquery pullup to wrap a PlaceHolderVar around the entire RowExpr
that's generated for a whole-row Var referencing the subquery, when the
subquery is in the nullable side of an outer join.  The previous coding
instead put PlaceHolderVars around the elements of the RowExpr.  The effect
was that when the outer join made the subquery outputs go to null, the
whole-row Var produced ROW(NULL,NULL,...) rather than just NULL.  There
are arguments afoot about whether those things ought to be semantically
indistinguishable, but for the moment they are not entirely so, and the
planner needs to take care that its machinations preserve the difference.
Per bug #5025.

Making this feasible required refactoring ResolveNew() to allow more caller
control over what is substituted for a Var.  I chose to make ResolveNew()
a wrapper around a new general-purpose function replace_rte_variables().
I also fixed the ancient bogosity that ResolveNew might fail to set
a query's hasSubLinks field after inserting a SubLink in it.  Although
all current callers make sure that happens anyway, we've had bugs of that
sort before, and it seemed like a good time to install a proper solution.

Back-patch to 8.4.  The problem can be demonstrated clear back to 8.0,
but the fix would be too invasive in earlier branches; not to mention
that people may be depending on the subtly-incorrect behavior.  The
8.4 series is new enough that fixing this probably won't cause complaints,
but it might in older branches.  Also, 8.4 shows the incorrect behavior
in more cases than older branches do, because it is able to flatten
subqueries in more cases.

15 years agoFix pg_ctl's readfile() to not go into infinite loop on an empty file
Tom Lane [Wed, 2 Sep 2009 02:40:59 +0000 (02:40 +0000)]
Fix pg_ctl's readfile() to not go into infinite loop on an empty file
(could happen if either postgresql.conf or postmaster.opts is empty).
It's been broken since the C version was written for 8.0, so patch
all the way back.

initdb's copy of the function is broken in the same way, but it's
less important there since the input files should never be empty.
Patch that in HEAD only, and also fix some cosmetic differences that
crept into that copy of the function.

Per report from Corry Haines and Jeff Davis.

15 years agoRemove duplicate variable initializations identified by clang static checker.
Tom Lane [Sun, 30 Aug 2009 16:53:37 +0000 (16:53 +0000)]
Remove duplicate variable initializations identified by clang static checker.
One of these represents a nontrivial bug (a promptly-leaked palloc), so
backpatch.

Greg Stark

15 years agoModify the definition of window-function PARTITION BY and ORDER BY clauses
Tom Lane [Thu, 27 Aug 2009 20:08:12 +0000 (20:08 +0000)]
Modify the definition of window-function PARTITION BY and ORDER BY clauses
so that their elements are always taken as simple expressions over the
query's input columns.  It originally seemed like a good idea to make them
act exactly like GROUP BY and ORDER BY, right down to the SQL92-era behavior
of accepting output column names or numbers.  However, that was not such a
great idea, for two reasons:

1. It permits circular references, as exhibited in bug #5018: the output
column could be the one containing the window function itself.  (We actually
had a regression test case illustrating this, but nobody thought twice about
how confusing that would be.)

2. It doesn't seem like a good idea for, eg, "lead(foo) OVER (ORDER BY foo)"
to potentially use two completely different meanings for "foo".

Accordingly, narrow down the behavior of window clauses to use only the
SQL99-compliant interpretation that the expressions are simple expressions.

15 years agoFix broken markup
Alvaro Herrera [Thu, 27 Aug 2009 20:05:46 +0000 (20:05 +0000)]
Fix broken markup

Jan UrbaƄski

15 years agoFix handling of autovacuum reloptions.
Alvaro Herrera [Thu, 27 Aug 2009 17:19:31 +0000 (17:19 +0000)]
Fix handling of autovacuum reloptions.

In the original coding, setting a single reloption would cause default
values to be used for all the other reloptions.  This is a problem
particularly for autovacuum reloptions.

Itagaki Takahiro

15 years agoIn the checkpoint written at the end of archive recovery, the WAL page header
Heikki Linnakangas [Thu, 27 Aug 2009 07:18:04 +0000 (07:18 +0000)]
In the checkpoint written at the end of archive recovery, the WAL page header
was incorrectly initialized with timeline ID 0. That rendered the WAL page
unrecoverable, making a subsequent archive recovery stop at that point.
ThisTimeLineID needs to be initialized before calling AdvanceXLInsertBuffer().

This fixes bug #5011 reported by James Bardin. Backpatch to 8.4, as the bug
was introduced by the changes to use of bgwriter for writing the
end-of-archive-recovery checkpoint. Patch by Tom Lane.

15 years agoUpdate release notes for 7.4.26, 8.0.22, 8.1.18, 8.2.14, 8.3.8, 8.4.1.
Bruce Momjian [Thu, 27 Aug 2009 01:27:43 +0000 (01:27 +0000)]
Update release notes for 7.4.26, 8.0.22, 8.1.18, 8.2.14, 8.3.8, 8.4.1.

15 years agoTry to make silent_mode behave somewhat reasonably.
Tom Lane [Mon, 24 Aug 2009 20:08:40 +0000 (20:08 +0000)]
Try to make silent_mode behave somewhat reasonably.

Instead of sending stdout/stderr to /dev/null after forking away from the
terminal, send them to postmaster.log within the data directory.  Since
this opens the door to indefinite logfile bloat, recommend even more
strongly that log output be redirected when using silent_mode.

Move the postmaster's initial calls of load_hba() and load_ident() down
to after we have started the log collector, if we are going to.  This
is so that errors reported by them will appear in the "usual" place.

Reclassify silent_mode as a LOGGING_WHERE, not LOGGING_WHEN, parameter,
since it's got absolutely nothing to do with the latter category.

In passing, fix some obsolete references to -S ... this option hasn't
had that switch letter for a long time.

Back-patch to 8.4, since as of 8.4 load_hba() and load_ident() are more
picky (and thus more likely to fail) than they used to be.  This entire
change was driven by a complaint about those errors disappearing into
the bit bucket.

15 years agoSmall correction to previous patch: we shouldn't ReleasePostmasterChildSlot
Tom Lane [Mon, 24 Aug 2009 18:09:54 +0000 (18:09 +0000)]
Small correction to previous patch: we shouldn't ReleasePostmasterChildSlot
for a dead_end child, because we didn't AssignPostmasterChildSlot.

15 years agoAvoid calling kill() in a postmaster signal handler.
Alvaro Herrera [Mon, 24 Aug 2009 17:23:17 +0000 (17:23 +0000)]
Avoid calling kill() in a postmaster signal handler.

This causes problems when the system load is high, per report from Zdenek
Kotala in <1250860954.1239.114.camel@localhost>; instead of calling kill
directly, have the signal handler set a flag which is checked in ServerLoop.
This way, the handler can return before being called again by a subsequent
signal sent from the autovacuum launcher.  Also, increase the sleep in the
launcher in this failure path to 1 second.

Backpatch to 8.3, which is when the signalling between autovacuum
launcher/postmaster was introduced.

Also, add a couple of ReleasePostmasterChildSlot calls in error paths; this
part backpatched to 8.4 which is when the child slot stuff was introduced.

15 years agoFix inclusions of readline/editline header files so that we only attempt to
Tom Lane [Mon, 24 Aug 2009 16:18:19 +0000 (16:18 +0000)]
Fix inclusions of readline/editline header files so that we only attempt to
#include the version of history.h that is in the same directory as the
readline.h we are using.  This avoids problems in some scenarios where both
readline and editline are installed.  Report and patch by Zdenek Kotala.

15 years agoFix a violation of WAL coding rules in the recent patch to include an
Tom Lane [Mon, 24 Aug 2009 02:18:40 +0000 (02:18 +0000)]
Fix a violation of WAL coding rules in the recent patch to include an
"all tuples visible" flag in heap page headers.  The flag update *must*
be applied before calling XLogInsert, but heap_update and the tuple
moving routines in VACUUM FULL were ignoring this rule.  A crash and
replay could therefore leave the flag incorrectly set, causing rows
to appear visible in seqscans when they should not be.  This might explain
recent reports of data corruption from Jeff Ross and others.

In passing, do a bit of editorialization on comments in visibilitymap.c.

15 years agoTweak ExecIndexEvalRuntimeKeys to forcibly detoast any toasted comparison
Tom Lane [Sun, 23 Aug 2009 18:26:15 +0000 (18:26 +0000)]
Tweak ExecIndexEvalRuntimeKeys to forcibly detoast any toasted comparison
values before they get passed to the index access method.  This avoids
repeated detoastings that will otherwise ensue as the comparison value
is examined by various index support functions.  We have seen a couple of
reports of cases where repeated detoastings result in an order-of-magnitude
slowdown, so it seems worth adding a bit of extra logic to prevent this.

I had previously proposed trying to avoid duplicate detoastings in general,
but this fix takes care of what seems the most important case in practice
with very little effort or risk.

Back-patch to 8.4 so that the PostGIS folk won't have to wait a year to
have this fix in a production release.  (The issue exists further back,
of course, but the code's diverged enough to make backpatching further a
higher-risk action.  Also it appears that the possible gains may be limited
in prior releases because of different handling of lossy operators.)

15 years agoFix overflow for INTERVAL 'x ms' where x is more than a couple million,
Tom Lane [Tue, 18 Aug 2009 21:23:21 +0000 (21:23 +0000)]
Fix overflow for INTERVAL 'x ms' where x is more than a couple million,
and integer datetimes are in use.  Per bug report from Hubert Depesz
Lubaczewski.

Alex Hunsaker

15 years agoFix imprecise documentation of random(): it never returns 1.0.
Tom Lane [Sun, 16 Aug 2009 19:55:28 +0000 (19:55 +0000)]
Fix imprecise documentation of random(): it never returns 1.0.
This was changed in 8.2 but the documentation was not corrected.
Per gripe from Sam Mason.

15 years agoFix incorrect encoding-aware name truncation in makeArrayTypeName().
Tom Lane [Sun, 16 Aug 2009 18:14:39 +0000 (18:14 +0000)]
Fix incorrect encoding-aware name truncation in makeArrayTypeName().

truncate_identifier won't do anything if the passed-in strlen is already
less than NAMEDATALEN, which it always would be given the strlcpy usage.
This has been broken since the arrays-of-composite-types code went in.

Arguably truncate_identifier is suffering from excessive optimization
and should always process the string, but for the moment I'll take the
more localized patch.

Per bug #4987.

15 years agoRemove tab in SGML.
Bruce Momjian [Sat, 15 Aug 2009 19:33:29 +0000 (19:33 +0000)]
Remove tab in SGML.

15 years agoPut back adjust_appendrel_attrs()'s code for dealing with RestrictInfo.
Tom Lane [Thu, 13 Aug 2009 16:53:15 +0000 (16:53 +0000)]
Put back adjust_appendrel_attrs()'s code for dealing with RestrictInfo.
I mistakenly removed it last month, thinking it was no longer needed ---
but it is still needed for dealing with joininfo lists.  Fortunately this
bit of brain fade hadn't made it into any released versions yet.

15 years agoFix old bug in log_autovacuum_min_duration code: it was relying on being able
Tom Lane [Wed, 12 Aug 2009 18:23:55 +0000 (18:23 +0000)]
Fix old bug in log_autovacuum_min_duration code: it was relying on being able
to access a Relation entry it had just closed.  I happened to be testing with
CLOBBER_CACHE_ALWAYS, which made this a guaranteed core dump (at least on
machines where sprintf %s isn't forgiving of a NULL pointer).  It's probably
quite unlikely that it would fail in the field, but a bug is a bug.  Fix by
moving the relation_close call down past the logging action.

15 years agoReserve the shared memory region during backend startup on Windows, so
Magnus Hagander [Tue, 11 Aug 2009 11:51:22 +0000 (11:51 +0000)]
Reserve the shared memory region during backend startup on Windows, so
that memory allocated by starting third party DLLs doesn't end up
conflicting with it.

Hopefully this solves the long-time issue with "could not reattach
to shared memory" errors on Win32.

Patch from Tsutomu Yamada and me, based on idea from Trevor Talbot.

15 years agoFix URL to "The Hitch-Hiker's Guide to Evolutionary Computation".
Alvaro Herrera [Mon, 10 Aug 2009 22:42:41 +0000 (22:42 +0000)]
Fix URL to "The Hitch-Hiker's Guide to Evolutionary Computation".

Per Andreas Wenk, Andres Freund and Rob Wultsh.  Thanks, Robert Haas, for the
patch.

15 years agoFix number of columns declared for pg_user_mappings description table.
Alvaro Herrera [Mon, 10 Aug 2009 22:16:11 +0000 (22:16 +0000)]
Fix number of columns declared for pg_user_mappings description table.

15 years agoAdjust test_fsync code to be more sane.
Bruce Momjian [Mon, 10 Aug 2009 18:19:11 +0000 (18:19 +0000)]
Adjust test_fsync code to be more sane.

Backpatch to 8.4.X.

15 years agoEnable the use of multiple CPUs/cores when building on MSVC. This only
Magnus Hagander [Mon, 10 Aug 2009 11:48:52 +0000 (11:48 +0000)]
Enable the use of multiple CPUs/cores when building on MSVC. This only
affects the C compiler step - we still only build one target at a
time.

15 years agoRe-add documentation for --no-readline option of psql, mistakenly removed a decade...
Andrew Dunstan [Mon, 10 Aug 2009 02:50:18 +0000 (02:50 +0000)]
Re-add documentation for --no-readline option of psql, mistakenly removed a decade ago. Backpatch to release 7.4.

15 years agoDocument that LocalSetXLogInsertAllowed can be re-executed.
Tom Lane [Sat, 8 Aug 2009 16:39:25 +0000 (16:39 +0000)]
Document that LocalSetXLogInsertAllowed can be re-executed.
Per comment from Simon.

15 years agoDocument that autovacuum may run ANALYZE
Alvaro Herrera [Fri, 7 Aug 2009 20:55:05 +0000 (20:55 +0000)]
Document that autovacuum may run ANALYZE

15 years agoTry to defend against the possibility that libpq is still in COPY_IN state
Tom Lane [Fri, 7 Aug 2009 20:16:16 +0000 (20:16 +0000)]
Try to defend against the possibility that libpq is still in COPY_IN state
when we reach the post-COPY "pump it dry" error recovery code that was added
2006-11-24.  Per a report from Neil Best, there is at least one code path
in which this occurs, leading to an infinite loop in code that's supposed
to be making it more robust not less so.  A reasonable response seems to be
to call PQputCopyEnd() again, so let's try that.

Back-patch to all versions that contain the cleanup loop.

15 years agorm_cleanup functions need to be allowed to write WAL entries. This oversight
Tom Lane [Fri, 7 Aug 2009 19:29:57 +0000 (19:29 +0000)]
rm_cleanup functions need to be allowed to write WAL entries.  This oversight
appears to explain the recent reports of "PANIC: cannot make new WAL entries
during recovery".

15 years agoFix some omissions in the dependency-object-class support for SQL/MED objects.
Tom Lane [Fri, 7 Aug 2009 15:28:07 +0000 (15:28 +0000)]
Fix some omissions in the dependency-object-class support for SQL/MED objects.

Main problem found by Muhammad Aqeel, some cosmetic additions by me.

15 years agoFast shutdown stop should forcibly disconnect any active backends, even
Heikki Linnakangas [Fri, 7 Aug 2009 05:59:42 +0000 (05:59 +0000)]
Fast shutdown stop should forcibly disconnect any active backends, even
if a smart shutdown is already in progress. Backpatch to 8.3, this was broken
in the patch that introduced "dead-end backends".

Per report by Itagaki Takahiro, patch by Fujii Masao.

15 years agoMake sure FD_SETSIZE is set before we include any Windows
Magnus Hagander [Thu, 30 Jul 2009 09:28:05 +0000 (09:28 +0000)]
Make sure FD_SETSIZE is set before we include any Windows
header files.

Josh Williams

15 years agoFix time_part and timetz_part (ie, EXTRACT() for those datatypes) to
Tom Lane [Wed, 29 Jul 2009 22:19:23 +0000 (22:19 +0000)]
Fix time_part and timetz_part (ie, EXTRACT() for those datatypes) to
include a fractional part in the output for MILLISECOND and SECOND cases,
rather than truncating the source value.  This is what the float-timestamp
code has always done, and it was clearly the code author's intent to do
the same for integer timestamps, but he forgot about integer division in C.
The other datatypes supported by EXTRACT() already do this correctly.

Backpatch to 8.4, so that the default (integer) behavior of that branch will
match the default (float) behavior of older branches.  Arguably we should
patch further back, but it's possible that applications are expecting the
broken behavior in older branches.  8.4 is new enough that expectations
shouldn't be too settled.

Per report from Greg Stark.

15 years agoFix a thinko introduced into CountActiveBackends by a recent patch:
Tom Lane [Wed, 29 Jul 2009 15:57:16 +0000 (15:57 +0000)]
Fix a thinko introduced into CountActiveBackends by a recent patch:
we should ignore NULL array entries, not non-NULL ones.  This had the
effect of disabling commit_delay, and could have caused a crash in the
rare race condition the patch was intended to fix.

Bug report and diagnosis by Jeff Janes, in bug #4952.

15 years agoFix incorrect cleanup of tsquery in ts_rewrite(). Per bug #4933 by
Teodor Sigaev [Tue, 28 Jul 2009 09:32:23 +0000 (09:32 +0000)]
Fix incorrect cleanup of tsquery in ts_rewrite(). Per bug #4933 by
 Aaron Marcuse-Kubitza <aaronmk@blackducksoftware.com>

15 years agoImprove comment, per gripe from Alvaro.
Tom Lane [Mon, 27 Jul 2009 04:10:01 +0000 (04:10 +0000)]
Improve comment, per gripe from Alvaro.

15 years agoFix pg_stat_statements for EXEC_BACKEND case.
Tom Lane [Mon, 27 Jul 2009 03:34:46 +0000 (03:34 +0000)]
Fix pg_stat_statements for EXEC_BACKEND case.

We should not try to load old statistics when re-attaching to existing
shared memory.  Per bug #4941.

Itagaki Takahiro

15 years agoDocument \dg+ and \du+
Peter Eisentraut [Fri, 24 Jul 2009 19:35:26 +0000 (19:35 +0000)]
Document \dg+ and \du+

The fact that \dg and \du take the + option was missing in the documentation.

backpatched to 8.4

Author: Andreas Wenk <a.wenk@netzmeister-st-pauli.de>

15 years agoIn a non-hashed Agg node, reset the "aggcontext" at group boundaries, instead
Tom Lane [Thu, 23 Jul 2009 20:45:34 +0000 (20:45 +0000)]
In a non-hashed Agg node, reset the "aggcontext" at group boundaries, instead
of individually pfree'ing pass-by-reference transition values.  This should
be at least as fast as the prior coding, and it has the major advantage of
clearing out any working data an aggregate function may have stored in or
underneath the aggcontext.  This avoids memory leakage when an aggregate
such as array_agg() is used in GROUP BY mode.  Per report from Chris Spotts.

Back-patch to 8.4.  In principle the problem could arise in prior versions,
but since they didn't have array_agg the issue seems not critical.

15 years agoFix another thinko in join_is_legal's handling of semijoins: we have to test
Tom Lane [Thu, 23 Jul 2009 17:42:13 +0000 (17:42 +0000)]
Fix another thinko in join_is_legal's handling of semijoins: we have to test
for the case that the semijoin was implemented within either input by
unique-ifying its RHS before we test to see if it appears to match the current
join situation.  The previous coding would select semijoin logic in situations
where we'd already unique-ified the RHS and joined it to some unrelated
relation(s), and then came to join it to the semijoin's LHS.  That still gave
the right answer as far as the semijoin itself was concerned, but would lead
to incorrectly examining only an arbitrary one of the matchable rows from the
unrelated relation(s).  The cause of this thinko was incorrect unification of
the pre-8.4 logic for IN joins and OUTER joins --- the comparable case for
outer joins can be handled after making the match test, but that's because
there is nothing like the unique-ification escape hatch for outer joins.
Per bug #4934 from Benjamin Reed.

15 years agoFix mismatch in const:ness of parameters.
Magnus Hagander [Wed, 22 Jul 2009 11:07:04 +0000 (11:07 +0000)]
Fix mismatch in const:ness of parameters.

15 years agoRemove translated FAQs
Peter Eisentraut [Tue, 21 Jul 2009 19:21:02 +0000 (19:21 +0000)]
Remove translated FAQs

The English FAQ has been moved to the wiki, so the translated versions should
have been removed at that point as well.

The FAQ_MINGW.html should have been removed when the platform FAQs were
integrated into the documentation (or earlier).

applied to both 8.4 and 8.5

15 years agoFix another semijoin-ordering bug. We already knew that we couldn't
Tom Lane [Tue, 21 Jul 2009 02:02:51 +0000 (02:02 +0000)]
Fix another semijoin-ordering bug.  We already knew that we couldn't
reorder a semijoin into or out of the righthand side of another semijoin,
but actually it doesn't work to reorder it into or out of the righthand
side of a left or antijoin, either.  Per bug #4906 from Mathieu Fenniak.

This was sloppy thinking on my part.  This identity does work:

( A left join B on (Pab) ) semijoin C on (Pac)
==
( A semijoin C on (Pac) ) left join B on (Pab)

but I failed to see that that doesn't mean this does:

( A left join B on (Pab) ) semijoin C on (Pbc)
!=
A left join ( B semijoin C on (Pbc) ) on (Pab)

15 years agoProperly restore pg_largeobject.relfozenxid in binary upgrade mode.
Bruce Momjian [Mon, 20 Jul 2009 20:53:47 +0000 (20:53 +0000)]
Properly restore pg_largeobject.relfozenxid in binary upgrade mode.

Backpatch to 8.4.X.

15 years agoInstall src/include/utils/fmgroids.h on VPATH builds too.
Alvaro Herrera [Mon, 20 Jul 2009 20:48:58 +0000 (20:48 +0000)]
Install src/include/utils/fmgroids.h on VPATH builds too.

The original coding was not dealing specially with this file being a symlink,
with the end result that it was not installed in VPATH builds.  Oddly enough,
the clean target does know about it ...

15 years agoRemove unnecessary and version-sensitive dependence on the exact set of
Tom Lane [Mon, 20 Jul 2009 03:46:53 +0000 (03:46 +0000)]
Remove unnecessary and version-sensitive dependence on the exact set of
column names to be found in a sequence.  Per gripe from Bruce.

15 years agoFix a thinko in join_is_legal: when we decide we can implement a semijoin
Tom Lane [Sun, 19 Jul 2009 20:32:56 +0000 (20:32 +0000)]
Fix a thinko in join_is_legal: when we decide we can implement a semijoin
by unique-ifying the RHS and then inner-joining to some other relation,
that is not grounds for violating the RHS of some other outer join.
Noticed while regression-testing new GEQO code, which will blindly follow
any path that join_is_legal says is legal, and then complain later if that
leads to a dead end.

I'm not certain that this can result in any visible failure in 8.4: the
mistake may always be masked by the fact that subsequent attempts to join
the rest of the RHS of the other join will fail.  But I'm not certain it
can't, either, and it's definitely not operating as intended.  So back-patch.

The added regression test depends on the new no-failures-allowed logic
that I'm about to commit in GEQO, so no point back-patching that.

15 years agoFix error cleanup failure caused by 8.4 changes in plpgsql to try to avoid
Tom Lane [Sat, 18 Jul 2009 19:15:50 +0000 (19:15 +0000)]
Fix error cleanup failure caused by 8.4 changes in plpgsql to try to avoid
memory leakage in error recovery.  We were calling FreeExprContext, and
therefore invoking ExprContextCallback callbacks, in both normal and error
exits from subtransactions.  However this isn't very safe, as shown in
recent trouble report from Frank van Vugt, in which releasing a tupledesc
refcount failed.  It's also unnecessary, since the resources that callbacks
might wish to release should be cleaned up by other error recovery mechanisms
(ie the resource owners).  We only really want FreeExprContext to release
memory attached to the exprcontext in the error-exit case.  So, add a bool
parameter to FreeExprContext to tell it not to call the callbacks.

A more general solution would be to pass the isCommit bool parameter on to
the callbacks, so they could do only safe things during error exit.  But
that would make the patch significantly more invasive and possibly break
third-party code that registers ExprContextCallback callbacks.  We might want
to do that later in HEAD, but for now I'll just do what seems reasonable to
back-patch.

15 years agoRepair bug #4926 "too few pathkeys for mergeclauses". This example shows
Tom Lane [Fri, 17 Jul 2009 23:19:59 +0000 (23:19 +0000)]
Repair bug #4926 "too few pathkeys for mergeclauses".  This example shows
that the sanity checking I added to create_mergejoin_plan() in 8.3 was a
few bricks shy of a load: the mergeclauses could reference pathkeys in a
noncanonical order such as x,y,x, not only cases like x,x,y which is all
that the code had allowed for.  The odd cases only turn up when using
redundant clauses in an outer join condition, which is why no one had
noticed before.

16 years agoDo a conditional SPI_push/SPI_pop when replanning a query in
Tom Lane [Tue, 14 Jul 2009 15:37:55 +0000 (15:37 +0000)]
Do a conditional SPI_push/SPI_pop when replanning a query in
RevalidateCachedPlan.  This is to avoid a "SPI_ERROR_CONNECT" failure when
the planner calls a SPI-using function and we are already inside one.
The alternative fix is to expect callers of RevalidateCachedPlan to do this,
which seems likely to result in additional hard-to-detect bugs of omission.
Per reports from Frank van Vugt and Marek Lewczuk.

Back-patch to 8.3. It's much harder to trigger the bug in 8.3, due to a
smaller set of cases in which plans can be invalidated, but it could happen.
(I think perhaps only a SI reset event could make 8.3 fail here, but that's
certainly within the realm of possibility.)

16 years agoFix set_rel_width() to do something reasonable with non-Var items in a
Tom Lane [Sat, 11 Jul 2009 04:09:40 +0000 (04:09 +0000)]
Fix set_rel_width() to do something reasonable with non-Var items in a
RelOptInfo targetlist.  It used to be that the only possibility other than
a Var was a RowExpr representing a whole-row child Var, but as of 8.4's
expanded ability to flatten appendrel members, we can get arbitrary expressions
in there.  Use the expression's type info and get_typavgwidth() to produce
an at-least-marginally-sane result.  Note that get_typavgwidth()'s fallback
estimate (32 bytes) is the same as what was here before, so there will be
no behavioral change for RowExprs.  Noted while looking at recent gripe
about constant quals pushed down to FunctionScan appendrel members ...
not only were we failing to recognize the constant qual, we were getting
the width estimate wrong :-(

16 years agoFix xslt_process() to ensure that it inserts a NULL terminator after the
Tom Lane [Fri, 10 Jul 2009 00:32:06 +0000 (00:32 +0000)]
Fix xslt_process() to ensure that it inserts a NULL terminator after the
last pair of parameter name/value strings, even when there are MAXPARAMS
of them.  Aboriginal bug in contrib/xml2, noted while studying bug #4912
(though I'm not sure whether there's something else involved in that
report).

This might be thought a security issue, since it's a potential backend
crash; but considering that untrustworthy users shouldn't be allowed
to get their hands on xslt_process() anyway, it's probably not worth
getting excited about.

16 years agoRemove no-longer-necessary transmission of postmaster's LC_COLLATE and
Tom Lane [Wed, 8 Jul 2009 18:55:42 +0000 (18:55 +0000)]
Remove no-longer-necessary transmission of postmaster's LC_COLLATE and
LC_CTYPE settings to children via BackendParameters.  Per discussion,
the postmaster is now just using system defaults anyway, so we might as
well save a few cycles during backend startup.

16 years agoNeed to use pg_perm_setlocale when setting LC_CTYPE and LC_COLLATE at startup.
Heikki Linnakangas [Wed, 8 Jul 2009 17:53:32 +0000 (17:53 +0000)]
Need to use pg_perm_setlocale when setting LC_CTYPE and LC_COLLATE at startup.
Otherwise, the LC_CTYPE/COLLATE setting gets reverted when using plperl, which
leads to incorrect query results and index corruption.

This was accidentally broken in the per-database locale patch in 8.4. Pointed
out by Andrew Gierth.

16 years agoAdd missing HOUR TO SECOND option to list of possible INTERVAL field sets,
Tom Lane [Wed, 8 Jul 2009 17:22:01 +0000 (17:22 +0000)]
Add missing HOUR TO SECOND option to list of possible INTERVAL field sets,
as noted by Sebastien Flaesch.  Also update the claim that we simply throw
away fields outside this set --- that got changed later to only discard
less-significant fields.

16 years agoFix ancient bug in handling of to_char modifier 'TH', when used with HH.
Heikki Linnakangas [Mon, 6 Jul 2009 19:11:46 +0000 (19:11 +0000)]
Fix ancient bug in handling of to_char modifier 'TH', when used with HH.
In what seems like an oversight, we used to treat 'TH' the same as lowercase
'th', but only with HH/HH12.

16 years agoFix set_append_rel_pathlist() to deal intelligently with cases where
Tom Lane [Mon, 6 Jul 2009 18:26:39 +0000 (18:26 +0000)]
Fix set_append_rel_pathlist() to deal intelligently with cases where
substituting a child rel's output expressions into the appendrel's restriction
clauses yields a pseudoconstant restriction.  We might be able to skip scanning
that child rel entirely (if we get constant FALSE), or generate a one-time
filter.  8.3 more or less accidentally generated plans that weren't completely
stupid in these cases, but that was only because an extra recursive level of
subquery_planner() always occurred and allowed const-simplification to happen.
8.4's ability to pull up appendrel members with non-Var outputs exposes the
fact that we need to work harder here.  Per gripe from Sergey Burladyan.

16 years agoPer SQL spec (in particular, the grammar in SQL:2008 7.13) we should allow
Tom Lane [Mon, 6 Jul 2009 02:58:48 +0000 (02:58 +0000)]
Per SQL spec (in particular, the grammar in SQL:2008 7.13) we should allow
parentheses around the <query expression body> that follows a WITH clause, eg
with cte(foo) as ( values(0) ) ((select foo from cte));
This seems to be just an oversight/thinko in gram.y.  Noted while
experimenting with bug #4902.

16 years agoFix handling of changed-Param signaling for CteScan plan nodes. We were using
Tom Lane [Mon, 6 Jul 2009 02:16:14 +0000 (02:16 +0000)]
Fix handling of changed-Param signaling for CteScan plan nodes.  We were using
the "cteParam" as a proxy for the possibility that the underlying CTE plan
depends on outer-level variables or Params, but that doesn't work very well
because it sometimes causes calling subqueries to be treated as SubPlans when
they could be InitPlans.  This is inefficient and also causes the outright
failure exhibited in bug #4902.  Instead, leave the cteParam out of it and
copy the underlying CTE plan's extParams directly.  Per bug #4902 from
Marko Tiikkaja.

16 years agoFix up pg_dump's --binary-upgrade option so that it behaves properly with
Tom Lane [Thu, 2 Jul 2009 21:34:38 +0000 (21:34 +0000)]
Fix up pg_dump's --binary-upgrade option so that it behaves properly with
inherited columns and check constraints.  Per my recent trouble report.

16 years agoRemove useless References column for pg_listener catalog description. Per Shigehiro...
Tom Lane [Wed, 1 Jul 2009 23:57:45 +0000 (23:57 +0000)]
Remove useless References column for pg_listener catalog description.  Per Shigehiro Honda.

16 years agoAdd missed src/include/foreign subdirectory to the set installed into
Tom Lane [Wed, 1 Jul 2009 23:09:40 +0000 (23:09 +0000)]
Add missed src/include/foreign subdirectory to the set installed into
INSTALLDIR/include/server/.  Itagaki Takahiro

16 years agoRevert addition of "o" to tar options. This was intended to fix bug #4883, REL8_4_0
Tom Lane [Sat, 27 Jun 2009 21:06:46 +0000 (21:06 +0000)]
Revert addition of "o" to tar options.  This was intended to fix bug #4883,
but the cure appears to be worse than the disease.  It turns out that GNU
tar versions 1.14.x misinterpret -o as --same-owner, not --no-same-owner,
leading to exactly the wrong behavior for both root and nonroot users.
While that bug has been fixed for nearly five years, these tar versions
are still found in the wild, notably in OS X 10.4.  Given that #4883 was
the first complaint we'd heard, it's definitely not worth fixing at the
risk of breaking things for other users.  Perhaps revisit at a later date
when we're not up against a release deadline.

16 years agoBundle v8.4.0
Marc G. Fournier [Sat, 27 Jun 2009 00:14:47 +0000 (00:14 +0000)]
Bundle v8.4.0

16 years agoUpdate release notes in final preparation for 8.4.0.
Tom Lane [Fri, 26 Jun 2009 22:23:17 +0000 (22:23 +0000)]
Update release notes in final preparation for 8.4.0.

16 years agoAdd a note about SystemTap vs DTrace spelling of probe names.
Tom Lane [Fri, 26 Jun 2009 22:08:17 +0000 (22:08 +0000)]
Add a note about SystemTap vs DTrace spelling of probe names.

16 years agoMarginal improvement of description of recovery_end_command.
Tom Lane [Fri, 26 Jun 2009 22:06:11 +0000 (22:06 +0000)]
Marginal improvement of description of recovery_end_command.

16 years agoCleanup and code review for the patch that made bgwriter active during
Tom Lane [Fri, 26 Jun 2009 20:29:04 +0000 (20:29 +0000)]
Cleanup and code review for the patch that made bgwriter active during
archive recovery.  Invent a separate state variable and inquiry function
for XLogInsertAllowed() to clarify some tests and make the management of
writing the end-of-recovery checkpoint less klugy.  Fix several places
that were incorrectly testing InRecovery when they should be looking at
RecoveryInProgress or XLogInsertAllowed (because they will now be executed
in the bgwriter not startup process).  Clarify handling of bad LSNs passed
to XLogFlush during recovery.  Use a spinlock for setting/testing
SharedRecoveryInProgress.  Improve quite a lot of comments.

Heikki and Tom

16 years agoTranslation updates for 8.4 release.
Peter Eisentraut [Fri, 26 Jun 2009 19:33:52 +0000 (19:33 +0000)]
Translation updates for 8.4 release.

File that are translated less than 80% have been removed, as per new
translation team policy.

16 years agoExtract tarballs with "o" option (tar xof), to behave reasonably when run
Peter Eisentraut [Fri, 26 Jun 2009 06:40:57 +0000 (06:40 +0000)]
Extract tarballs with "o" option (tar xof), to behave reasonably when run
as root, as would usually be the case during make install.

per bug #4883

16 years agoUse $(TAR) instead of tar in makefiles.
Peter Eisentraut [Fri, 26 Jun 2009 06:37:14 +0000 (06:37 +0000)]
Use $(TAR) instead of tar in makefiles.

16 years agoAdd __attribute__((format_arg(1))) to the declaration of err_gettext(),
Tom Lane [Thu, 25 Jun 2009 23:07:15 +0000 (23:07 +0000)]
Add __attribute__((format_arg(1))) to the declaration of err_gettext(),
to restore gcc's ability to crosscheck format arguments within elog.c.
Noted in a test compilation with -Wformat-nonliteral enabled.

16 years agoFix some serious bugs in archive recovery, now that bgwriter is active
Heikki Linnakangas [Thu, 25 Jun 2009 21:36:00 +0000 (21:36 +0000)]
Fix some serious bugs in archive recovery, now that bgwriter is active
during it:

When bgwriter is active, the startup process can't perform mdsync() correctly
because it won't see the fsync requests accumulated in bgwriter's private
pendingOpsTable. Therefore make bgwriter responsible for the end-of-recovery
checkpoint as well, when it's active.

When bgwriter is active (= archive recovery), the startup process must not
accumulate fsync requests to its own pendingOpsTable, since bgwriter won't
see them there when it performs restartpoints. Make startup process drop its
pendingOpsTable when bgwriter is launched to avoid that.

Update minimum recovery point one last time when leaving archive recovery.
It won't be updated by the end-of-recovery checkpoint because XLogFlush()
sees us as out of recovery already.

This fixes bug #4879 reported by Fujii Masao.