Commit Graph

9462 Commits

Author SHA1 Message Date
Alvaro Herrera 230e8962f3 Make CSV column ordering a bit more logical. 2007-12-11 20:07:31 +00:00
Alvaro Herrera 3bf66d6f1c Extend the format of CSV logs to include the additional information supplied
with the logged event.  CSV logs are now a first-class citizen along plain
text logs in that they carry much of the same information.

Per complaint from depesz on bug #3799.
2007-12-11 15:19:05 +00:00
Tom Lane 9fd8843647 Fix mergejoin cost estimation so that we consider the statistical ranges of
the two join variables at both ends: not only trailing rows that need not be
scanned because there cannot be a match on the other side, but initial rows
that will be scanned without possibly having a match.  This allows a more
realistic estimate of startup cost to be made, per recent pgsql-performance
discussion.  In passing, fix a couple of bugs that had crept into
mergejoinscansel: it was not quite up to speed for the task of estimating
descending-order scans, which is a new requirement in 8.3.
2007-12-08 21:05:11 +00:00
Peter Eisentraut cac82bb20c Realign the running text in this file to 79 characters wide. Some other
copy-editing.
2007-12-07 16:44:56 +00:00
Alvaro Herrera 59c841506c Change wording of logged message when cancelling an autovacuum task, using
american speling (unlike this commit message).  Per complaint from Mike C. on
bug #3790 and subsequent discussion.
2007-12-06 14:32:54 +00:00
Tom Lane f538329f9d Fix build_minmax_path() to cope if an IS NULL clause turns up in the
indexable-clauses list for a btree index.  Formerly it just Asserted that
all such clauses were opclauses, but that's no longer true in 8.3.
Per bug #3796 from Matthias Schoeneich.
2007-12-03 22:37:17 +00:00
Tom Lane a63b63ff96 Revert COPY OUT to follow the pre-8.3 handling of ASCII control characters,
namely that \r, \n, \t, \b, \f, \v are dumped as those two-character
representations rather than a backslash and the literal control character.
I had made it do the other to save some code, but this was ill-advised,
because dump files in which these characters appear literally are prone to
newline mangling.  Fortunately, doing it the old way should only cost a few
more lines of code, and not slow down the copy loop materially.
Per bug #3795 from Lou Duchez.
2007-12-03 00:03:05 +00:00
Tom Lane 265f904d8f Code review for LIKE ... INCLUDING INDEXES patch. Fix failure to propagate
constraint status of copied indexes (bug #3774), as well as various other
small bugs such as failure to pstrdup when needed.  Allow INCLUDING INDEXES
indexes to be merged with identical declared indexes (perhaps not real useful,
but the code is there and having it not apply to LIKE indexes seems pretty
unorthogonal).  Avoid useless work in generateClonedIndexStmt().  Undo some
poorly chosen API changes, and put a couple of routines in modules that seem
to be better places for them.
2007-12-01 23:44:44 +00:00
Tom Lane 895a94de6d Avoid incrementing the CommandCounter when CommandCounterIncrement is called
but no database changes have been made since the last CommandCounterIncrement.
This should result in a significant improvement in the number of "commands"
that can typically be performed within a transaction before hitting the 2^32
CommandId size limit.  In particular this buys back (and more) the possible
adverse consequences of my previous patch to fix plan caching behavior.

The implementation requires tracking whether the current CommandCounter
value has been "used" to mark any tuples.  CommandCounter values stored into
snapshots are presumed not to be used for this purpose.  This requires some
small executor changes, since the executor used to conflate the curcid of
the snapshot it was using with the command ID to mark output tuples with.
Separating these concepts allows some small simplifications in executor APIs.

Something for the TODO list: look into having CommandCounterIncrement not do
AcceptInvalidationMessages.  It seems fairly bogus to be doing it there,
but exactly where to do it instead isn't clear, and I'm disinclined to mess
with asynchronous behavior during late beta.
2007-11-30 21:22:54 +00:00
Tom Lane f0f18c7087 Repair bug that allowed RevalidateCachedPlan to attempt to rebuild a cached
plan before the effects of DDL executed in an immediately prior SPI operation
had been absorbed.  Per report from Chris Wood.

This patch has an unpleasant side effect of causing the number of
CommandCounterIncrement()s done by a typical plpgsql function to
approximately double.  Amelioration of the consequences of that
will be undertaken in a separate patch.
2007-11-30 18:38:34 +00:00
Peter Eisentraut 42a0c88ead Translation updates 2007-11-29 08:50:36 +00:00
Tom Lane bb0e3011f8 Make a cleanup pass over error reports in tsearch code. Use ereport
for user-facing errors, fix some poor choices of errcode, adhere to
message style guide.
2007-11-28 21:56:30 +00:00
Tom Lane 03ffc4d6d5 Improve test coverage of CLOBBER_CACHE_ALWAYS by having it also force
reloading of operator class information on each use of LookupOpclassInfo.
Had this been in place a year ago, it would have helped me find a bug
in the then-new 'operator family' code.  Now that we have a build farm
member testing CLOBBER_CACHE_ALWAYS on a regular basis, it seems worth
expending a little bit of effort here.
2007-11-28 20:44:26 +00:00
Tom Lane 11fccbeaeb Adjust the names of a couple of tsearch index support functions that had
inappropriately generic-sounding names.  This is more or less free since
we already forced initdb for the next beta, and it may prevent confusion or
name conflicts (particularly at the C-global-symbol level) down the road.
Per my proposal yesterday.
2007-11-28 19:33:05 +00:00
Tom Lane d54ca56743 Install a lookaside cache to speed up repeated lookups of the same operator
by short-circuiting schema search path and ambiguous-operator resolution
computations.  Remarkably, this buys as much as 45% speedup of repetitive
simple queries that involve operators that are not an exact match to the
input datatypes.  It should be marginally faster even for exact-match
cases, though I've not had success in proving an improvement in benchmark
tests.  Per report from Guillame Smet and subsequent discussion.
2007-11-28 18:47:56 +00:00
Peter Eisentraut a238bd146d Proper capitalization of Ispell 2007-11-28 15:42:46 +00:00
Peter Eisentraut 96ee6ff502 Fix XML Schema structure for char types without length (bug #3782) 2007-11-28 14:01:51 +00:00
Peter Eisentraut 2609345c85 Improve terminology 2007-11-28 13:30:36 +00:00
Peter Eisentraut 178c78c79f Fix typo 2007-11-28 13:30:16 +00:00
Bruce Momjian 43e082fc98 Change a stop word on the right-hand-side in the thesaurus file to be an
ERROR, not NOTICE.
2007-11-28 04:24:38 +00:00
Tom Lane 66d7bbf674 Suppress compiler warning. 2007-11-27 18:13:01 +00:00
Peter Eisentraut 7888b52076 Make casts from xml to text independent of the XML option setting, thus
immutable and indexable.  Also fix the volatility settings of some other
XML-related functions.
2007-11-27 12:21:05 +00:00
Peter Eisentraut 542d04e179 correct capitalization 2007-11-27 12:17:27 +00:00
Tom Lane 07daff63c5 Fix select_common_type() so that it can select a domain type, if all inputs
to a UNION, CASE, or related construct are of the same domain type.  The
main part of this routine smashes domains to their base types, which seems
necessary because the logic involves TypeCategory() and IsPreferredType(),
neither of which work usefully on domains.  However, we can add a first
pass that just detects whether all the inputs are exactly the same type,
and if so accept that without question (so long as it's not UNKNOWN).
Per recent gripe from Dean Rasheed.

In passing, remove some tests for InvalidOid, which have clearly been dead
code for quite some time now, because getBaseType() would fail on that input.

Also, clarify the manual's not-very-precise description of the existing
algorithm's behavior.
2007-11-26 16:46:51 +00:00
Andrew Dunstan 5575826b70 Allow for X as well as x to be the prefix for hexadecimal character ref entity numbers,
as in HTML.
2007-11-25 19:35:41 +00:00
Andrew Dunstan 3de1f0daac Fix XML tag namespace change inadvertantly missed from previous fix. Add
regression test for XML names and numeric entities.
2007-11-25 15:37:11 +00:00
Peter Eisentraut a999ff63ff Use double quotes for quoting xml attributes. 2007-11-25 12:08:11 +00:00
Tom Lane 66b1f4daa8 Fix thinko in comment. 2007-11-25 02:09:46 +00:00
Tom Lane 86be19bf70 Reduce routine successful-archiving message from LOG to DEBUG1 grade,
to reduce chattiness of logs.  Per discussion.
Simon Riggs
2007-11-24 21:37:04 +00:00
Tom Lane ae3ff7adf7 Fix (I think) broken usage of MultiByteToWideChar. I had missed the
subtlety that this function only returns a null terminator if it's
fed input that includes one; which, in the usage here, it's not.
This probably fixes bugs reported by Thomas Haegi.
2007-11-24 21:20:07 +00:00
Tom Lane 0f20e7a83e Slightly more paranoia and slightly better comments for use of
Windows-specific MultiByteToWideChar/WideCharToMultiByte calls.
2007-11-24 21:16:55 +00:00
Tom Lane aca467b9b3 Save another little bit of planner overhead on simple queries, by having
clauselist_selectivity skip some analysis that's useless when there's only
one clause in the given list.  Actually this can win even for not-so-simple
queries, because we also apply clauselist_selectivity to sublists such as the
quals matching an index; which are likely to have only a single entry even
when the total query is quite complicated.
2007-11-24 19:08:51 +00:00
Bruce Momjian 8a52d0c94d Clarify how MONEY trims off trailing thousands separator. 2007-11-24 16:18:48 +00:00
Bruce Momjian 5f128d5fe8 Make the MONEY data type have a thousands separator != decimal symbol,
if the locale has the thousands separator as "".  This now matches the
to_char and psql numericlocale behavior.  (Previously this data type was
basically useless for such setups.)
2007-11-24 15:28:02 +00:00
Tom Lane a36436ea3f Change fix_scan_expr() to avoid copying the input node tree in the common case
where rtoffset == 0.  In that case there is no need to change Var nodes,
and since filling in unset opfuncid fields is always safe, scribbling on the
input tree to that extent is not objectionable.  This brings the cost of this
operation back down to what it was in 8.2 for simple queries.  Per
investigation of performance gripe from Guillaume Smet.
2007-11-24 00:39:44 +00:00
Tom Lane 92c0bf0960 Avoid uselessly building a duplicate of the original clause in trivial cases
where the EquivalenceClass machinery is unable to deduce anything more from a
simple "var = const" qual clause.  There are probably some more cases where
this could be done, but this seems to take care of most of the added overhead
for simple queries.  Per gripe from Guillaume Smet.

In passing, fix a problem that was exposed by this change:
reconsider_outer_join_clause and friends were passing the wrong relids to
build_implied_join_equality, resulting in RestrictInfos with the wrong
required_relids.  This mistake was masked in typical cases since the bogus
RestrictInfos would never have escaped from the EquivalenceClass machinery,
but I think there might be corner cases involving "broken" ECs where there
would have been a visible failure even without the new optimization.  In any
case the code was certainly not operating as intended.
2007-11-23 19:57:44 +00:00
Bruce Momjian 335d9aff6f Fix white space in MONEY type code. Rename 'comma' to more generic
'ssymbol' as used in previous function.
2007-11-23 19:54:39 +00:00
Tom Lane ef48ed4c86 Actually ... it's pretty silly that parse_oper.c doesn't set up the
opfuncid of an OpExpr initially, considering that it has the information
at hand already.  We'll still treat opfuncid as a cache rather than a
guaranteed-valid value, but this change saves one more syscache lookup
in the normal code path.
2007-11-22 19:40:25 +00:00
Tom Lane 6342f36d87 Save one syscache lookup when examining volatility or strictness of
OpExpr and related nodes.  We're going to have to set the opfuncid of
such nodes eventually (if we haven't already), so we might as well
exploit the opportunity to cache the function OID.  Buys back some
of the extra planner overhead noted by Guillaume Smet, though I still
need to fool with equivclass.c to really respond to that.
2007-11-22 19:09:23 +00:00
Bruce Momjian b85cf684f7 Add more comments about thousands separator handling. 2007-11-22 17:51:39 +00:00
Bruce Momjian d9bc7a3946 Add comments about thousands separator logic. 2007-11-22 15:10:05 +00:00
Bruce Momjian 3894e7cc55 When setting default thousands separator when locale has "", use logic
so new thousands separator doesn't match decimal symbol.
2007-11-21 22:28:18 +00:00
Bruce Momjian 6f3149e464 Fix typo in comment. 2007-11-21 21:49:22 +00:00
Tom Lane d23ba77a44 Fix bogus length calculation that could lead to crash if the string
happened to be right up against the end of memory, per report from
Matt Magoffin.  While at it, avoid useless multiple copying of string
by not depending on xmlStrncatNew.
2007-11-20 23:14:41 +00:00
Andrew Dunstan 1157f3cc81 Change descriptions of entity and tag objects to "XML entity" and "XML tag".
Allow tag and entity names that follow XML rules. Provide for hexadecimal
as well as decimal numeric entities. Adjust code names to coincide with
new descriptions.
2007-11-20 02:25:22 +00:00
Tom Lane 6f4cfe48ac Improve GIN index build's tracking of memory usage by using
GetMemoryChunkSpace, not just the palloc request size.  This brings the
allocatedMemory counter close enough to reality (as measured by
MemoryContextStats printouts) that I think we can get rid of the arbitrary
factor-of-2 adjustment that was put into the code initially.  Given the
sensitivity of GIN build to work memory size, not using as much of work
memory as we're allowed to seems a pretty bad idea.
2007-11-16 21:55:59 +00:00
Tom Lane 93190c3098 Repair still another bug in the btree page split WAL reduction patch:
it failed for splits of non-leaf pages because in such pages the first
data key on a page is suppressed, and so we can't just copy the first
key from the right page to reconstitute the left page's high key.
Problem found by Koichi Suzuki, patch by Heikki.
2007-11-16 19:53:50 +00:00
Teodor Sigaev a867b40cf4 Fix tsvectorout() and tsqueryout() to escape backslesh, add test of that.
Patch by Bruce Momjian <bruce@momjian.us>

Backpatch is needed, but it's impossible to apply it directly
2007-11-16 15:05:59 +00:00
Bruce Momjian f639df0d61 Small comment spacing improvement. 2007-11-16 01:51:22 +00:00
Bruce Momjian 5f0bf6cb0d Run pgindent on remaining files now that LOOPBYTE is a usable macro. 2007-11-16 01:12:24 +00:00
Bruce Momjian 0c2c061eb0 Cleanup for new else/comment handling. 2007-11-16 01:11:04 +00:00
Tom Lane eae7e00f1f Fix stupid typo in recently-added code :-( 2007-11-16 00:57:55 +00:00
Bruce Momjian 224f91f66d Modify LOOPBYTE/LOOPBIT macros to be more logical; rather than have the
for() body passed as a parameter, make the macros act as simple headers
to code blocks.

This allows pgindent to be run on these files.
2007-11-16 00:13:02 +00:00
Bruce Momjian 7d4c99b414 Fix pgindent to properly handle 'else' and single-line comments on the
same line;  previous fix was only partial.  Re-run pgindent on files
that need it.
2007-11-15 23:23:44 +00:00
Bruce Momjian f6e8730d11 Re-run pgindent with updated list of typedefs. (Updated README should
avoid this problem in the future.)
2007-11-15 22:25:18 +00:00
Peter Eisentraut b30769ee54 When logging the recovery.conf parameters, show them quoted as they would
appear in the configuration file.
2007-11-15 22:02:12 +00:00
Tom Lane 591b9b091c Use ftruncate() not truncate() in mdunlink. Seems Windows doesn't
support the latter.
2007-11-15 21:49:47 +00:00
Bruce Momjian fdf5a5efb7 pgindent run for 8.3. 2007-11-15 21:14:46 +00:00
Peter Eisentraut 3adc760fb9 Translation updates 2007-11-15 20:38:15 +00:00
Tom Lane 6cc4451b5c Prevent re-use of a deleted relation's relfilenode until after the next
checkpoint.  This guards against an unlikely data-loss scenario in which
we re-use the relfilenode, then crash, then replay the deletion and
recreation of the file.  Even then we'd be OK if all insertions into the
new relation had been WAL-logged ... but that's not guaranteed given all
the no-WAL-logging optimizations that have recently been added.

Patch by Heikki Linnakangas, per a discussion last month.
2007-11-15 20:36:40 +00:00
Peter Eisentraut 166f67cebe Message improvements 2007-11-15 20:04:38 +00:00
Tom Lane 866bad9543 Add a rank/(rank+1) normalization option to ts_rank(). While the usefulness
of this seems a bit marginal, if it's useful enough to be shown in the manual
then we probably ought to support doing it without double evaluation of the
ts_rank function.  Per my proposal earlier today.
2007-11-14 23:43:27 +00:00
Tom Lane 5858990f87 Fix incorrect calculation of elapsed_xlogs. Itagaki Takahiro 2007-11-14 21:19:18 +00:00
Tom Lane ca450a07ee Add an Accept parameter to "simple" dictionaries. The default of true
gives the old behavior; selecting false allows the dictionary to be used
as a filter ahead of other dictionaries, because it will pass on rather
than accept words that aren't in its stopword list.
Jan Urbanski
2007-11-14 18:36:37 +00:00
Tom Lane b40c0a4bb0 Clean up some stray references to tsearch2. 2007-11-13 23:36:26 +00:00
Tom Lane 4394c1b09c Resurrect the code for the rewrite(ARRAY[...]) aggregate function,
and put it into contrib/tsearch2 compatibility module.
2007-11-13 22:14:50 +00:00
Tom Lane 0bd4da23a4 Ensure that typmod decoration on a datatype name is validated in all cases,
even in code paths where we don't pay any subsequent attention to the typmod
value.  This seems needed in view of the fact that 8.3's generalized typmod
support will accept a lot of bogus syntax, such as "timestamp(foo)" or
"record(int, 42)" --- if we allow such things to pass without comment,
users will get confused.  Per a recent example from Greg Stark.

To implement this in a way that's not very vulnerable to future
bugs-of-omission, refactor the API of parse_type.c's TypeName lookup routines
so that typmod validation is folded into the base lookup operation.  Callers
can still choose not to receive the encoded typmod, but we'll check the
decoration anyway if it's present.
2007-11-11 19:22:49 +00:00
Tom Lane 2b477a2c73 Add missing closing / in xsd:restriction, and remove some unnecessary
spaces for consistency.  Per bug #3734 from Ben Leslie; fix by
Euler Taveira de Oliveira.
2007-11-10 19:29:54 +00:00
Tom Lane d2d52bbb55 xmlGetUTF8Char()'s second argument is both input and output. Fix
uninitialized value, and avoid invoking the function nine separate
times in the pg_xmlIsNameChar macro.  Should resolve buildfarm failures.
Per report from Ben Leslie.
2007-11-10 18:51:20 +00:00
Bruce Momjian d009992ba3 Have text search thesaurus files use "?" for stop words.
Throw an error for actual stop words, rather than a warning.  This fixes
problems with cache reloading causing warning messages.

Re-enable stop words in regression tests;  was disabled by Tom.

Document "?" as API change.
2007-11-10 15:39:34 +00:00
Bruce Momjian 82748bc253 Reduce error level of ROLLBACK outside a transaction from WARNING to
NOTICE.
2007-11-10 14:36:44 +00:00
Tom Lane 654dcfb9e4 Clean up ts_locale.h/.c. Fix broken and not-consistent-across-platforms
behavior of wchar2char/char2wchar; this should resolve bug #3730.  Avoid
excess computations of pg_mblen in t_isalpha and friends.  Const-ify
APIs where possible.
2007-11-09 22:37:35 +00:00
Tom Lane a96fa85025 Second pass at improving LIKE/regex estimation in non-C locales. It turns
out that it's actually quite likely that a string that is an extension of
the given prefix will sort as larger than the "greater" string our previous
code created.  To provide some defense against that, do the comparisons
against a modified string instead of just the bare prefix.  We tack on
"Z", "z", "y", or "9", whichever is seen as largest in the current locale.
Testing suggests that this is sufficient at least for cases involving
ASCII data.
2007-11-09 20:10:02 +00:00
Magnus Hagander 4b606ee444 Add parameter krb_realm used by GSSAPI, SSPI and Kerberos
to validate the realm of the connecting user. By default
it's empty meaning no verification, which is the way
Kerberos authentication has traditionally worked in
PostgreSQL.
2007-11-09 17:31:07 +00:00
Peter Eisentraut 8db43db01e Allow XML processing instructions starting with "xml" while prohibiting
those being exactly "xml".  Bug #3735 from Ben Leslie
2007-11-09 15:52:51 +00:00
Bruce Momjian 3991c3fb2b In tsearch code, remove !(A && B) via restructuring, for clarity 2007-11-09 01:32:22 +00:00
Tom Lane c293ba9eff If an index depends on no columns of its table, give it a dependency on the
whole table instead, to ensure that it goes away when the table is dropped.
Per bug #3723 from Sam Mason.

Backpatch as far as 7.4; AFAICT 7.3 does not have the issue, because it doesn't
have general-purpose expression indexes and so there must be at least one
column referenced by an index.
2007-11-08 23:22:54 +00:00
Tom Lane c291203ca3 Fix EquivalenceClass code to handle volatile sort expressions in a more
predictable manner; in particular that if you say ORDER BY output-column-ref,
it will in fact sort by that specific column even if there are multiple
syntactic matches.  An example is
	SELECT random() AS a, random() AS b FROM ... ORDER BY b, a;
While the use-case for this might be a bit debatable, it worked as expected
in earlier releases, so we should preserve the behavior for 8.3.  Per my
recent proposal.

While at it, fix convert_subquery_pathkeys() to handle RelabelType stripping
in both directions; it needs this for the same reasons make_sort_from_pathkeys
does.
2007-11-08 21:49:48 +00:00
Tom Lane 1be0601681 Last week's patch for make_sort_from_pathkeys wasn't good enough: it has
to be able to discard top-level RelabelType nodes on *both* sides of the
equivalence-class-to-target-list comparison, since make_pathkey_from_sortinfo
might either add or remove a RelabelType.  Also fix the latter to do the
removal case cleanly.  Per example from Peter.
2007-11-08 19:25:37 +00:00
Peter Eisentraut 4c726d5c11 After conferencing again with Bruce, put in more accurate XML error message. 2007-11-08 15:16:45 +00:00
Peter Eisentraut b5a47f245f Wording changes 2007-11-08 14:47:51 +00:00
Peter Eisentraut 156d648025 Add sentence-ending periods. 2007-11-08 14:47:41 +00:00
Peter Eisentraut 79cff6bc7e Improve error message 2007-11-08 13:12:56 +00:00
Tom Lane 2de946be6a Improve the performance of LIKE/regex estimation in non-C locales, by making
make_greater_string() try harder to generate a string that's actually greater
than its input string.  Before we just assumed that making a string that was
memcmp-greater was enough, but it is easy to generate examples where this is
not so when the locale is not C.  Instead, loop until the relevant comparison
function agrees that the generated string is greater than the input.

Unfortunately this is probably not enough to guarantee that the generated
string is greater than all extensions of the input, so we cannot relax the
restriction to C locale for the LIKE/regex index optimization.  But it should
at least improve the odds of getting a useful selectivity estimate in
prefix_selectivity().  Per example from Guillaume Smet.

Backpatch to 8.1, mainly because that's what the complainant is using...
2007-11-07 22:37:24 +00:00
Tom Lane 9542287123 Fix patternsel() and callers to do the right thing for NOT LIKE and the other
negated-match operators.  patternsel had been using the supplied operator as
though it were a positive-match operator, and thus obtaining a wrong result,
which was even more wrong after the caller subtracted it from 1.  Seems
cleanest to give patternsel an explicit "negate" argument so that it knows
what's going on.  Also install the same factorization scheme for pattern
join selectivity estimators; even though they are just stubs at the
moment, this may keep someone from making the same type of mistake when
they get filled out.  Per report from Greg Mullane.

Backpatch to 8.2 --- previous releases do not show the problem because
patternsel() doesn't actually use the operator directly.
2007-11-07 21:00:37 +00:00
Peter Eisentraut 5f9869d0ee Use "alternative" instead of "alternate" where it is clearer. 2007-11-07 12:24:24 +00:00
Tom Lane 5e51297104 Some code review for xml.c:
Add some more xml_init() calls that might not be necessary, but seem like a
good idea to avoid possible problems like we saw in xmlelement().
Fix unsafe assumption that you can keep using the tupledesc of a relcache
entry you don't have open.
Add missing error checks for SearchSysCache failure.
Get rid of handwritten array traversal in xpath() and O(N^2), broken-for-nulls
array access code in map_sql_value_to_xml_value(), in favor of using
deconstruct_array.
Manually adjust a lot of line breaks in places where the code is otherwise
gonna look pretty awful after pg_indent hacks it up (original author seems to
have liked to lay out code for a 200-column window).
2007-11-06 03:06:28 +00:00
Tom Lane 85f807d782 Fix xmlelement() to initialize libxml correctly before using it, and to avoid
assuming that evaluation of its input expressions won't change the state of
libxml.  This requires refactoring xml_init() to not call xmlInitParser(),
since now not all of its callers want that.  I also tweaked things to avoid
repeated execution of one-time-only tests inside xml_init(), though this is
mostly for clarity rather than in hopes of saving any noticeable amount of
runtime.  Per report from Sheikh Amjad and subsequent discussion.
In passing, fix a couple of inadequately schema-qualified queries.
2007-11-05 22:23:07 +00:00
Tom Lane df87074092 Improve conversion of legacy CREATE CONSTRAINT TRIGGER representation of
foreign keys, one more time.  Insist on matching up all three triggers before
we create a constraint; this will avoid creation of duplicate constraints
in scenarios where a broken FK constraint was repaired by re-adding the
constraint without removing the old partial trigger set.  Basically, this will
work nicely in all cases where the FK was actually functioning correctly in
the database that was dumped.  It will fail to restore an FK in just one case
where we theoretically could restore it: where we find the referenced table's
triggers and not the referencing table's trigger.  However, in such a scenario
it's likely that the user doesn't even realize he still has an FK at all
(since the more-likely-to-fail cases aren't enforced), and we'd probably not
accomplish much except to cause the reload to fail because the data doesn't
meet the FK constraint.  Also make the NOTICE logging still more verbose, by
adding detail about which of the triggers were found.  This seems about all
we can do without solving the problem of getting the user's attention at
session end.
2007-11-05 19:00:25 +00:00
Neil Conway 9a48d22ef5 Use LOG instead of DEBUG2 for logging invalid cancel requests. (That is,
cancel requests with an incorrect key, or with a non-existent PID). Per
recent discussion on -hackers.
2007-11-05 00:00:34 +00:00
Tom Lane 5e0377ae7e Minor improvements to code for converting legacy CREATE CONSTRAINT TRIGGER
commands into proper foreign-key constraints.  Believe the constraint name
given in the trigger arguments in preference to the trigger name --- to judge
from Olivier Prenant's example, pg_dump must at some time have used the
autogenerated trigger name there, though AFAICT no current release branch tip
does.  Improve the emitted NOTICEs to provide more detail (PK table's name and
column names).  Handle the case where pg_dump forgot to provide the FROM table
(a bug that never did get fixed in 7.0.x apparently).  This commit doesn't
do anything about the question of what to do with incomplete trigger groups.
2007-11-04 21:25:55 +00:00
Tom Lane 69500b05d6 Prevent continuing disk-space bloat when profiling (with PROFILE_PID_DIR
enabled) and autovacuum is on.  Since there will be a steady stream of autovac
worker processes exiting and dropping gmon.out files, allowing them to make
separate subdirectories results in serious bloat; and it seems unlikely that
anyone will care about those profiles anyway.  Limit the damage by forcing all
autovac workers to dump in one subdirectory, PGDATA/gprof/avworker/.

Per report from Jšrg Beyer and subsequent discussion.
2007-11-04 17:55:15 +00:00
Tom Lane a2899ebdc2 Teach CREATE CONSTRAINT TRIGGER to convert old-style foreign key
trigger definitions into regular foreign key constraints.  This seems
necessary given that some people evidently never did get around to
running adddepend on their schemas, and without some sort of hack the
old definitions will no longer work.  Per report from Olivier Prenant
and subsequent investigation.
2007-11-04 01:16:19 +00:00
Tom Lane 97ddfc9607 Ensure that EquivalenceClasses generated from ORDER BY keys contain proper
RelabelType nodes when the sort key is binary-compatible with the sort
operator rather than having exactly its input type.  We did this correctly
for index columns but not sort keys, leading to failure to notice that
a varchar index matches an ORDER BY request.  This requires a bit more work
in make_sort_from_pathkeys, but not anyplace else that I can find.
Per bug report and subsequent discussion.
2007-11-02 18:54:15 +00:00
Alvaro Herrera 92be6991ad In the previous commit message, I forgot to credit Simon Riggs who provided
the patch, which I modified only slightly before applying.
2007-10-29 22:17:41 +00:00
Tom Lane 2aae35d049 Mention the index name in 'could not create unique index' errors,
per suggestion from Rene Gollent.
2007-10-29 21:31:28 +00:00
Tom Lane b17b7fae8c Remove the hack in the grammar that "optimized away" DEFAULT NULL clauses.
Instead put in a test to drop a NULL default at the last moment before
storing the catalog entry.  This changes the behavior in a couple of ways:
* Specifying DEFAULT NULL when creating an inheritance child table will
  successfully suppress inheritance of any default expression from the
  parent's column, where formerly it failed to do so.
* Specifying DEFAULT NULL for a column of a domain type will correctly
  override any default belonging to the domain; likewise for a sub-domain.
The latter change happens because by the time the clause is checked,
it won't be a simple null Const but a CoerceToDomain expression.

Personally I think this should be back-patched, but there doesn't seem to
be consensus for that on pgsql-hackers, so refraining.
2007-10-29 19:40:40 +00:00
Teodor Sigaev bf5ccf382c - Add check of already changed page while replay WAL. This touches only
ginRedoInsert(), because other ginRedo* functions rewrite whole page or
make changes which could be applied several times without consistent's loss

- Remove check of identifying of corresponding split record:
it's possible that replaying of WAL starts after actual page split, but before
removing of that split from incomplete splits list. In this case, that check
cause FATAL error.

Per stress test which reproduces bug reported by Craig McElroy
<craig.mcelroy@contegix.com>
2007-10-29 19:26:57 +00:00
Magnus Hagander 5140058071 Make variable static, per Tom. 2007-10-29 14:04:42 +00:00
Teodor Sigaev 85376c6f7d Fix coredump during replay WAL after crash. Change entrySplitPage() to prevent
usage of any information from system catalog, because it could be called during
replay of WAL.

Per bug report from Craig McElroy <craig.mcelroy@contegix.com>. Patch doesn't
change on-disk storage.
2007-10-29 13:49:21 +00:00