Commit Graph

19222 Commits

Author SHA1 Message Date
Heikki Linnakangas fd75329e81 Fix copy-pasto in the patch to allow background writer to run during
recovery: if background writer or pgstat process dies during recovery (or
any other child process, but those two are the only ones running), send
SIGQUIT to the startup process using correct pid.
2009-03-03 10:42:05 +00:00
Heikki Linnakangas d657843a9a Remove the placeholder LWLockId in place of the removed FreeSpaceLock.
As pointed out by ITAGAKI Takahiro, we split SInvalLock into two in 8.4,
so to keep the numbers of the rest of the locks unchanged from 8.3, we
don't need a placeholder.
2009-03-03 08:11:24 +00:00
Tom Lane fd9e2accef When we are in error recursion trouble, arrange to suppress translation and
encoding conversion of any elog/ereport message being sent to the frontend.
This generalizes a patch that I put in last October, which suppressed
translation of only specific messages known to be associated with recursive
can't-translate-the-message behavior.  As shown in bug #4680, we need a more
general answer in order to have some hope of coping with broken encoding
conversion setups.  This approach seems a good deal less klugy anyway.

Patch in all supported branches.
2009-03-02 21:18:43 +00:00
Teodor Sigaev 32032d42b5 Fix usage of char2wchar/wchar2char. Changes:
- pg_wchar and wchar_t could have different size, so char2wchar
  doesn't call pg_mb2wchar_with_len to prevent out-of-bound
  memory bug
- make char2wchar/wchar2char symmetric, now they should not be
  called with C-locale because mbstowcs/wcstombs oftenly doesn't
  work correct with C-locale.
- Text parser uses pg_mb2wchar_with_len directly in case of
  C-locale and multibyte encoding

Per bug report by Hiroshi Inoue <inoue@tpf.co.jp> and
following discussion.

Backpatch up to 8.2 when multybyte support was implemented in tsearch.
2009-03-02 15:10:09 +00:00
Tom Lane 876b37d50a Fix buffer allocations in encoding conversion routines so that they won't
fail on zero-length inputs.  This isn't an issue in normal use because the
conversion infrastructure skips calling the converters for empty strings.
However a problem was created by yesterday's patch to check whether the
right conversion function is supplied in CREATE CONVERSION.  The most
future-proof fix seems to be to make the converters safe for this corner case.
2009-02-28 18:49:42 +00:00
Tom Lane 21eb6aeb36 Shave a few cycles in compare_pathkeys() by checking for pointer-identical
input lists before we grovel through the lists.  This doesn't save much,
but testing shows that the case of both inputs NIL is common enough that
it saves something.  And this is used enough to be a hotspot.
2009-02-28 03:51:05 +00:00
Tom Lane 640796ff41 Reduce the maximum value of vacuum_cost_delay and autovacuum_vacuum_cost_delay
to 100ms (from 1000).  This still seems to be comfortably larger than the
useful range of the parameter, and it should help discourage people from
picking uselessly large values.  Tweak the documentation to recommend small
values, too.  Per discussion of a couple weeks ago.
2009-02-28 00:10:52 +00:00
Tom Lane 07b9936a0f Temporarily (I hope) disable flattening of IN/EXISTS sublinks that are within
the ON clause of an outer join.  Doing so is semantically correct but results
in de-optimizing queries that were structured to take advantage of the sublink
style of execution, as seen in recent complaint from Kevin Grittner.  Since
the user can get the other behavior by reorganizing his query, having the
flattening happen automatically is just a convenience, and that doesn't
justify breaking existing applications.  Eventually it would be nice to
re-enable this, but that seems to require a significantly different approach
to outer joins in the executor.
2009-02-27 23:30:29 +00:00
Tom Lane 75c85bd199 Tighten up join ordering rules to account for recent more-careful analysis
of the associativity of antijoins.  Also improve optimizer/README discussion
of outer join ordering rules.
2009-02-27 22:41:38 +00:00
Heikki Linnakangas 5c4ca3b632 In CREATE CONVERSION, test that the given function is a valid conversion
function for the specified source and destination encodings. We do that by
calling the function with an empty string. If it can't perform the requested
conversion, it will throw an error.

Backport to 7.4 - 8.3. Per bug report #4680 by Denis Afonin.
2009-02-27 16:35:26 +00:00
Peter Eisentraut 92fc8b41e5 Add the long options to the psql --help display, where they were curiously
missing.

Since this touches most lines of the help output, also change the mix of
puts and printf calls to printf everywhere, for easier code editing and
reviewing.
2009-02-27 09:58:09 +00:00
Tom Lane f01313bc0d Improve create_unique_path to not be fooled by unrelated clauses that happen
to be syntactically part of a semijoin clause.  For example given
WHERE EXISTS(SELECT ... WHERE upper.var = lower.var AND some-condition)
where some-condition is just a restriction on the lower relation, we can
use unique-ification on lower.var after having applied some-condition within
the scan on lower.
2009-02-27 00:06:27 +00:00
Tom Lane f4fea44ce1 Remove outdated join_1.out regression test comparison file. This has
been broken for more than a month, so evidently it's not needed, at
least not for any configuration in the buildfarm.  We can correct it
and replace it later if we find something that still needs it.
2009-02-26 22:19:20 +00:00
Peter Eisentraut 257c4ff160 Final removal of -q options, which haven't done anything since 8.3 and
were marked for removal in 8.4.
2009-02-26 16:20:55 +00:00
Peter Eisentraut 9de59fd191 Add a -w/--no-password option that prevents all password prompts to all
programs that have a -W/--password option.

In passing, remove the ancient PSQL_ALWAYS_GET_PASSWORDS compile option.
2009-02-26 16:02:39 +00:00
Tom Lane eea49769d4 Fix an old problem in decompilation of CASE constructs: the ruleutils.c code
looks for a CaseTestExpr to figure out what the parser did, but it failed to
consider the possibility that an implicit coercion might be inserted above
the CaseTestExpr.  This could result in an Assert failure in some cases
(but correct results if Asserts weren't enabled), or an "unexpected CASE WHEN
clause" error in other cases.  Per report from Alan Li.

Back-patch to 8.1; problem doesn't exist before that because CASE was
implemented differently.
2009-02-25 18:00:01 +00:00
Magnus Hagander 59a64e381c Remove references to foreign data wrapper libraries, since they have
been removed. This should unbreak the msvc build again.
2009-02-25 17:42:19 +00:00
Peter Eisentraut 32b02332e1 Use the same style in the help synopsis that other programs are using. 2009-02-25 13:35:18 +00:00
Peter Eisentraut a3c502c89f Remove feof(stdin) calls related to when to prompt for a password,
leftovers from when the password was read from stdin.
2009-02-25 13:24:40 +00:00
Peter Eisentraut cd3b750929 Sort the output of --help mostly alphabetical, make it align better, make
help of pg_dump and pg_dumpall more similar.
2009-02-25 13:03:07 +00:00
Heikki Linnakangas 0160cebee9 Put back a "continue" that went missing in the changes to start background
writer in WAL recovery.
2009-02-25 11:07:43 +00:00
Tom Lane e549722a8b Get rid of the rather fuzzily defined FlattenedSubLink node type in favor of
making pull_up_sublinks() construct a full-blown JoinExpr tree representation
of IN/EXISTS SubLinks that it is able to convert to semi or anti joins.
This makes pull_up_sublinks() a shade more complex, but the gain in semantic
clarity is worth it.  I still have more to do in this area to address the
previously-discussed problems, but this commit in itself fixes at least one
bug in HEAD, as shown by added regression test case.
2009-02-25 03:30:38 +00:00
Peter Eisentraut 7380b6384b Don't append epoch to log_filename if no format specifier is given.
Robert Haas
2009-02-24 12:09:09 +00:00
Peter Eisentraut 7babccb915 Add the possibility to specify an explicit validator function for foreign-data
wrappers (similar to procedural languages).  This way we don't need to retain
the nearly empty libraries, and we are more free in how to implement the
wrapper API in the future.
2009-02-24 10:06:36 +00:00
Tom Lane f73bed308a Repair a longstanding bug in CLUSTER and the rewriting variants of ALTER
TABLE: if the command is executed by someone other than the table owner (eg,
a superuser) and the table has a toast table, the toast table's pg_type row
ends up with the wrong typowner, ie, the command issuer not the table owner.
This is quite harmless for most purposes, since no interesting permissions
checks consult the pg_type row.  However, it could lead to unexpected failures
if one later tries to drop the role that issued the command (in 8.1 or 8.2),
or strange warnings from pg_dump afterwards (in 8.3 and up, which will allow
the DROP ROLE because we don't create a "redundant" owner dependency for table
rowtypes).  Problem identified by Cott Lang.

Back-patch to 8.1.  The problem is actually far older --- the CLUSTER variant
can be demonstrated in 7.0 --- but it's mostly cosmetic before 8.1 because we
didn't track ownership dependencies before 8.1.  Also, fixing it before 8.1
would require changing the call signature of heap_create_with_catalog(), which
seems to carry a nontrivial risk of breaking add-on modules.
2009-02-24 01:38:10 +00:00
Tom Lane 7de7876cd5 Fix psql's \dD to show only one row per domain, even when the domain has
multiple check constraints.
2009-02-23 15:59:55 +00:00
Peter Eisentraut 3e96ed4c2b Add quotes to message 2009-02-23 10:03:22 +00:00
Heikki Linnakangas bc134d7a51 Change the signaling of end-of-recovery. Startup process now indicates end
of recovery by exiting with exit code 0, like in previous releases. Per
Tom's suggestion.
2009-02-23 09:28:50 +00:00
Peter Eisentraut 1491b4c47d another small message tweak 2009-02-20 10:39:19 +00:00
Andrew Dunstan fae3083c3b Reconnect to the right database when using parallel restore with -C. Fixes bug reported by Olivier Prenant 2009-02-20 02:57:21 +00:00
Tom Lane 7920ed389c Simplify overcomplicated (and overly restrictive) test to see whether an
IS NULL condition is rendered redundant by detection of an antijoin.
If we know that a join is an antijoin, then *any* Var coming out of its
righthand side must be NULL, not only the joining column(s).  Also,
it's still gonna be null after being passed up through higher joins,
whether they're outer joins or not.  I was misled by a faulty analogy
to reduce_outer_joins() in the original coding.  But consider

select * from a left join b on a.x = b.y where b.y is null and b.z is null;

The first IS NULL condition justifies deciding that the join is an antijoin
(if the = is strict) and then the second one is just plain redundant.
2009-02-20 00:01:03 +00:00
Tom Lane 233b8a99ad Improve comments about semijoin implementation strategy, per a question
from Robert Haas.
2009-02-19 20:32:45 +00:00
Heikki Linnakangas 5717f3a3e6 Fix bogus comment, from the patch to start bgwriter during archive
recovery.
2009-02-19 16:43:13 +00:00
Peter Eisentraut 80e26caa02 Wordsmithing for PL/Perl messages 2009-02-19 10:33:17 +00:00
Peter Eisentraut 6becfa280c Add an implicit rule %.c -> %.i for running the C preprocessor.
I occasionally use this for debugging, and it seems wasteful to have to
reinvent this all the time.
2009-02-19 10:32:30 +00:00
Peter Eisentraut b870f8008d Remove croak and Perl_croak from gettext triggers. While we could
selectively mark up their arguments for translation, the Perl xsubpp tool
generates a bunch of additional Perl_croak calls that we cannot control,
so we'd be creating a confusing mix of translated and untranslated messages
of a similar kind.  This is something that might deserve a more
comprehensive solution later.

Also remove _ from gettext triggers, because it wasn't used.

Use SPI.c instead of SPI.xs as source file for xgettext, because the .xs
format isn't really supported in xgettext.
2009-02-19 10:07:58 +00:00
Heikki Linnakangas 6ebc6d9089 Increase NUM_AUXILIARY_PROCS, now that the startup process can co-exist
with other auxiliary processes for a short period. As witnessed by
buildfarm member dungbeetle.
2009-02-19 08:02:32 +00:00
Tom Lane 86ffdcad1b Remove the special cases to prevent minus-zero results in float4 and float8
unary minus operators.  We weren't attempting to prevent minus zero anywhere
else; in view of our gradual trend to make the float datatypes more IEEE
standard compliant, we should allow minus zero here rather than disallow it
elsewhere.

We don't, however, expect that all platforms will produce minus zero, so
we need to adjust the one affected regression test to allow both results.

Per discussion of bug #4660.

(In passing, clean up a couple other minor infelicities in float.c.)
2009-02-18 19:23:26 +00:00
Heikki Linnakangas cdd46c7654 Start background writer during archive recovery. Background writer now performs
its usual buffer cleaning duties during archive recovery, and it's responsible
for performing restartpoints.

This requires some changes in postmaster. When the startup process has done
all the initialization and is ready to start WAL redo, it signals the
postmaster to launch the background writer. The postmaster is signaled again
when the point in recovery is reached where we know that the database is in
consistent state. Postmaster isn't interested in that at the moment, but
that's the point where we could let other backends in to perform read-only
queries. The postmaster is signaled third time when the recovery has ended,
so that postmaster knows that it's safe to start accepting connections.

The startup process now traps SIGTERM, and performs a "clean" shutdown. If
you do a fast shutdown during recovery, a shutdown restartpoint is performed,
like a shutdown checkpoint, and postmaster kills the processes cleanly. You
still have to continue the recovery at next startup, though.

Currently, the background writer is only launched during archive recovery.
We could launch it during crash recovery as well, but it seems better to keep
that codepath as simple as possible, for the sake of robustness. And it
couldn't do any restartpoints during crash recovery anyway, so it wouldn't be
that useful.

log_restartpoints is gone. Use log_checkpoints instead. This is yet to be
documented.

This whole operation is a pre-requisite for Hot Standby, but has some value of
its own whether the hot standby patch makes 8.4 or not.

Simon Riggs, with lots of modifications by me.
2009-02-18 15:58:41 +00:00
Bruce Momjian 36a9cf38c5 Add --freeze option to vacuumdb. 2009-02-18 12:11:55 +00:00
Bruce Momjian 1d88d4e2c0 Have pg_dump/pg_dumpall --binary-upgrade restore frozenids for relations
and databases.
2009-02-18 12:07:08 +00:00
Peter Eisentraut b9a366933d Message wordsmithing 2009-02-18 11:33:04 +00:00
Bruce Momjian 5c89839ab2 Add missing newline. 2009-02-17 22:32:54 +00:00
Bruce Momjian 6883c54a62 Add pg_dump --binary-upgrade flag to be used by binary upgrade
utilities.

The new code allows transfer of dropped column information to the
upgraded server.
2009-02-17 15:41:50 +00:00
Peter Eisentraut 82aea0efe8 Add _() calls for the argument of plpgsql_yyerror() so it actually gets
translated somehow.
2009-02-17 13:01:13 +00:00
Peter Eisentraut 207b4e7461 Add plpgsql_yyerror to gettext triggers 2009-02-17 12:59:35 +00:00
Peter Eisentraut 1d6b681ed3 Mark 3rd argument of validate_tupdesc_compat() for translation, instead of
marking up each instance separately.
2009-02-17 12:51:59 +00:00
Peter Eisentraut b06abb7455 Redefine _() to dgettext() instead of gettext() so that it uses the plpgsql
text domain, instead of the postgres one (or whatever the default may be).
2009-02-17 11:34:34 +00:00
Peter Eisentraut acee2f6fa4 Remove gettext trigger write_stderr(), which isn't used by PLs. 2009-02-17 09:24:57 +00:00
Bruce Momjian d665ed5c21 Wrap some long queries. 2009-02-16 23:06:55 +00:00