]> granicus.if.org Git - postgresql/log
postgresql
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.

16 years agoMan pages back to lowercase names, with additional fixup to make the .so
Peter Eisentraut [Thu, 25 Jun 2009 21:15:38 +0000 (21:15 +0000)]
Man pages back to lowercase names, with additional fixup to make the .so
links work.

16 years agoMake prior patch pgindent-safe.
Tom Lane [Thu, 25 Jun 2009 19:33:25 +0000 (19:33 +0000)]
Make prior patch pgindent-safe.

16 years agoThe code to unlink dropped relations in FinishPreparedTransaction() was
Heikki Linnakangas [Thu, 25 Jun 2009 19:05:52 +0000 (19:05 +0000)]
The code to unlink dropped relations in FinishPreparedTransaction() was
acting like runs inside WAL recovery, but it doesn't. I must've copy-pasted
this from a redo-function in the relation forks patch. Noticed by Tom Lane
while he was looking through callers of smgrdounlink().

16 years agoDisable pg_standby -l option because the backend doesn't expect the recovered
Heikki Linnakangas [Thu, 25 Jun 2009 12:03:11 +0000 (12:03 +0000)]
Disable pg_standby -l option because the backend doesn't expect the recovered
file to be a symlink. We tried to fix this issue with an earlier server-side
patch, but it didn't fix the whole issue.

The same bug is present in older releases as well, but the 8.4 train is
about to leave the station, and I'm not sure if have consensus on whether
we can remove the -l option in back-branches or do we need to attempt a
server-side fix to make symlinking safe.

Patch by Simon Riggs, per discussion on bug identified by Fujii Masao.

16 years agoDisallow empty passwords in LDAP authentication, the same way
Magnus Hagander [Thu, 25 Jun 2009 11:30:08 +0000 (11:30 +0000)]
Disallow empty passwords in LDAP authentication, the same way
we already do it for PAM.

16 years agoCorrect grammar in picksplit debug messages
Peter Eisentraut [Wed, 24 Jun 2009 15:16:22 +0000 (15:16 +0000)]
Correct grammar in picksplit debug messages

16 years agoFix incorrect LDAP example, noted by Tom.
Magnus Hagander [Wed, 24 Jun 2009 13:46:32 +0000 (13:46 +0000)]
Fix incorrect LDAP example, noted by Tom.

16 years agoparse_ident_usermap() shuold use ereport(LOG) and not ERROR, and put the
Magnus Hagander [Wed, 24 Jun 2009 13:39:42 +0000 (13:39 +0000)]
parse_ident_usermap() shuold use ereport(LOG) and not ERROR, and put the
return value in the *error_p variable.

Noted by Tom.

16 years agoProvide a link to the UPDATE reference page in the 'Updating Data'
Tom Lane [Tue, 23 Jun 2009 20:33:25 +0000 (20:33 +0000)]
Provide a link to the UPDATE reference page in the 'Updating Data'
section of the docs.  Per suggestion from Brad Bowman.

16 years agoProperly initialize SSL engines when used from libpq. This is required for
Magnus Hagander [Tue, 23 Jun 2009 18:13:23 +0000 (18:13 +0000)]
Properly initialize SSL engines when used from libpq. This is required for
most external engines.

Per report and initial code from Lars Kanis

16 years agoFix an ancient error in dist_ps (distance from point to line segment), which
Tom Lane [Tue, 23 Jun 2009 16:25:02 +0000 (16:25 +0000)]
Fix an ancient error in dist_ps (distance from point to line segment), which
a number of other geometric operators also depend on.  It miscalculated the
slope of the perpendicular to the given line segment anytime that slope was
other than 0, infinite, or +/-1.  In some cases the error would be masked
because the true closest point on the line segment was one of its endpoints
rather than the intersection point, but in other cases it could give an
arbitrarily bad answer.  Per bug #4872 from Nick Roosevelt.

Bug goes clear back to Berkeley days, so patch all supported branches.
Make a couple of cosmetic adjustments while at it.

16 years agoFix the makefiles to fail cleanly if Perl is needed but not present. This
Tom Lane [Tue, 23 Jun 2009 03:46:00 +0000 (03:46 +0000)]
Fix the makefiles to fail cleanly if Perl is needed but not present.  This
used to work as intended, but got broken some time ago (a quoted empty string
is not an empty string), and got broken some more by the changes to generate
ecpg's preproc.y automatically.  Given all the unprotected uses of $(PERL)
elsewhere, it seems best to make use of the $(missing) script rather than
trying to ensure each such use is protected individually.  Also fix various
bits of documentation that omitted to mention Perl as a requirement for
building from a CVS pull.  Per a complaint from Robert Haas.

16 years agobundle RC2 REL8_4_RC2
Marc G. Fournier [Mon, 22 Jun 2009 23:15:02 +0000 (23:15 +0000)]
bundle RC2

16 years agoFor bulk write operations (eg COPY IN), use a ring buffer of 16MB instead
Tom Lane [Mon, 22 Jun 2009 20:04:28 +0000 (20:04 +0000)]
For bulk write operations (eg COPY IN), use a ring buffer of 16MB instead
of the 256KB limit originally enforced by a patch committed 2008-11-06.
Per recent test results, the smaller size resulted in an undesirable decrease
in bulk data loading speed, due to COPY processing frequently getting blocked
for WAL flushing.  This area might need more tweaking later, but this setting
seems to be good enough for 8.4.

16 years agoMake to_timestamp and friends skip leading spaces before an integer field,
Tom Lane [Mon, 22 Jun 2009 17:54:30 +0000 (17:54 +0000)]
Make to_timestamp and friends skip leading spaces before an integer field,
even when not in FM mode.  This improves compatibility with Oracle and with
our pre-8.4 behavior, as per bug #4862.

Brendan Jurd

Add a couple of regression test cases for this.  In passing, get rid of the
labeling of the individual test cases; doesn't seem to be good for anything
except causing extra work when inserting a test...

Tom Lane

16 years agoAdd more explicit note that the parameters of MOVE are identical to FETCH.
Peter Eisentraut [Mon, 22 Jun 2009 07:12:50 +0000 (07:12 +0000)]
Add more explicit note that the parameters of MOVE are identical to FETCH.

per David Wheeler

16 years agoRevert dubious message wording change.
Tom Lane [Mon, 22 Jun 2009 04:37:18 +0000 (04:37 +0000)]
Revert dubious message wording change.

16 years agoMessage fixes
Peter Eisentraut [Sun, 21 Jun 2009 20:15:32 +0000 (20:15 +0000)]
Message fixes

16 years agoFix things so that array_agg_finalfn does not modify or free its input
Tom Lane [Sat, 20 Jun 2009 18:45:28 +0000 (18:45 +0000)]
Fix things so that array_agg_finalfn does not modify or free its input
ArrayBuildState, per trouble report from Merlin Moncure.  By adopting
this fix, we are essentially deciding that aggregate final-functions
should not modify their inputs ever.  Adjust documentation and comments
to match that conclusion.

16 years agoExtend man page installation hackery so that the man page section is also
Peter Eisentraut [Fri, 19 Jun 2009 19:15:13 +0000 (19:15 +0000)]
Extend man page installation hackery so that the man page section is also
fixed up in the .so links.

16 years agoDon't convert the man page names to lower case, so that the .so links work.
Peter Eisentraut [Fri, 19 Jun 2009 19:14:25 +0000 (19:14 +0000)]
Don't convert the man page names to lower case, so that the .so links work.
This is pretty much a workaround for incomplete tools, but having the man
page names in upper case looks more natural anyway.

16 years agoAdd manvolnum, so that man pages are generated.
Peter Eisentraut [Fri, 19 Jun 2009 15:28:25 +0000 (15:28 +0000)]
Add manvolnum, so that man pages are generated.

16 years agoDon't attempt to "rm" directories on uninstall.
Peter Eisentraut [Thu, 18 Jun 2009 15:10:35 +0000 (15:10 +0000)]
Don't attempt to "rm" directories on uninstall.

16 years agoRecursive Joins -> Recursive Queries
Peter Eisentraut [Thu, 18 Jun 2009 14:42:08 +0000 (14:42 +0000)]
Recursive Joins -> Recursive Queries

per Erik Rijkers

16 years agoAdd some more documentation and cross-links on using dblink with SQL/MED.
Peter Eisentraut [Thu, 18 Jun 2009 14:34:36 +0000 (14:34 +0000)]
Add some more documentation and cross-links on using dblink with SQL/MED.

16 years agoRefine the use of terminology around bound and unbound cursors and cursor
Peter Eisentraut [Thu, 18 Jun 2009 10:22:09 +0000 (10:22 +0000)]
Refine the use of terminology around bound and unbound cursors and cursor
variables. Remove the confusing term "reference cursor".

16 years agoFix a few errors in comments. Patch by Fujii Masao, plus the one in
Heikki Linnakangas [Thu, 18 Jun 2009 10:08:08 +0000 (10:08 +0000)]
Fix a few errors in comments. Patch by Fujii Masao, plus the one in
visibilitymap.c by me.

16 years agoFix the just-reported problem that you can't specify all four trigger event
Tom Lane [Thu, 18 Jun 2009 01:27:02 +0000 (01:27 +0000)]
Fix the just-reported problem that you can't specify all four trigger event
types in CREATE TRIGGER.  While at it, clean up the amazingly tedious and
inextensible way that the trigger event type list was handled.  Per report
from Greg Sabino Mullane.