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

21727 Commits

Author SHA1 Message Date
Bruce Momjian
9a27f72b37 Use SQL standard '' rather than \' in /contrib. Backpatch to 8.1.X. 2006-05-19 02:39:04 +00:00
Tom Lane
1c01a5108a Fix choose_bitmap_and() so that partial index predicates are considered when
deciding whether a potential additional indexscan is redundant or not.  As now
coded, any use of a partial index that was already used in a previous AND arm
will be rejected as redundant.  This might be overly restrictive, but not
considering the point at all is definitely bad, as per example in bug #2441
from Arjen van der Meijden.  In particular, a clauseless scan of a partial
index was *never* considered redundant by the previous coding, and that's
surely wrong.  Being more flexible would also require some consideration
of how not to double-count the index predicate's selectivity.
2006-05-18 19:56:56 +00:00
Tom Lane
59ca5ebf2c When a bitmap indexscan is using a partial index, it is necessary to include
the partial index predicate in the scan's "recheck condition".  Otherwise,
if the scan becomes lossy for lack of bitmap memory, we would fail to enforce
that returned rows satisfy the predicate.  Noted while studying bug #2441
from Arjen van der Meijden.
2006-05-18 18:57:37 +00:00
Bruce Momjian
4aec5303f0 Update pg_dump version wording. 2006-05-13 17:11:02 +00:00
Bruce Momjian
dfc2fc2522 Mention version portability of pg_dump. 2006-05-13 16:20:21 +00:00
Tom Lane
17e048603c Fix the sense of the test on DH_check()'s return value. This was preventing
custom-generated DH parameters from actually being used by the server.
Found by Michael Fuhr.
2006-05-12 22:44:43 +00:00
Tom Lane
988e59f452 Remove unnecessary .seg/.section directives, per Alan Stange. 2006-05-11 21:58:29 +00:00
Bruce Momjian
ae6124627b Use SQL standard '' rather than \' for tutorial/sample code.
Backpatch to 8.1.X.
2006-05-11 19:21:31 +00:00
Bruce Momjian
9083bdd288 Build server libpgport with all non-FRONTEND object files. This is to
fix a Win32 bug where pipe.c included a file that used FRONTEND, but it
wasn't on the server-build list.
2006-05-08 02:18:59 +00:00
Tom Lane
478335a1be Fix calculation of plan node extParams to account for the possibility that one
initPlan sets a parameter for another.  This could not (I think) happen before
8.1, but it's possible now because the initPlans generated by MIN/MAX
optimization might themselves use initPlans.  We attach those initPlans as
siblings of the MIN/MAX ones, not children, to avoid duplicate computation
when multiple MIN/MAX aggregates are present; so this leads to the case of an
initPlan needing the result of a sibling initPlan, which is not possible with
ordinary query nesting.  Hadn't been noticed because in most contexts having
too much stuff listed in extParam is fairly harmless.  Fixes "plan should not
reference subplan's variable" bug reported by Catalin Pitis.
2006-05-03 00:25:07 +00:00
Tom Lane
a3fe5ed594 Avoid assuming that statistics for a parent relation reflect the properties of
the union of its child relations as well.  This might have been a good idea
when it was originally coded, but it's a fatally bad idea when inheritance is
being used for partitioning.  It's better to have no stats at all than
completely misleading stats.  Per report from Mark Liberman.

The bug arguably exists all the way back, but I've only patched HEAD and 8.1
because we weren't particularly trying to support partitioning before 8.1.

Eventually we ought to look at deriving union statistics instead of just
punting, but for now the drop kick looks good.
2006-05-02 04:34:24 +00:00
Tom Lane
0619268b4b Remove the restriction originally coded into optimize_minmax_aggregates() that
MIN/MAX not be converted to use an index if the query WHERE clause contains
any volatile functions or subplans.

I had originally feared that the conversion might alter the behavior of such a
query with respect to a volatile function.  Well, so it might, but only in the
sense that the function would get evaluated at a subset of the table rows
rather than all of them --- and we have never made any such guarantee anyway.
(For instance, we don't refuse to use an index for an ordinary non-aggregate
query when one of the non-indexable filter conditions contains a volatile
function.)

The prohibition against subplans was because of worry that that case wasn't
adequately tested, which it wasn't, but it turns out to be possible to make
8.1 fail anyway:

regression=# select o.ten, (select max(unique2) from tenk1 i where ten = o.ten
or ten = (select f1 from int4_tbl limit 1)) from tenk1 o;
ERROR:  direct correlated subquery unsupported as initplan

This is due to bogus code in SS_make_initplan_from_plan (it's an initplan,
ergo it can't have any parParams).  Having fixed that, we might as well allow
subplans as well as initplans.
2006-04-28 20:57:59 +00:00
Bruce Momjian
96cc1341dd Fix SELECT INTO and CREATE TABLE AS to create tables in the default
tablespace, not the base directory.

Kris Jurka
2006-04-26 23:01:58 +00:00
Tom Lane
abee2cdb1e Revise large-object access routines to avoid running with CurrentMemoryContext
set to the large object context ("fscxt"), as this is inevitably a source of
transaction-duration memory leaks.  Not sure why we'd not noticed it before;
maybe people weren't touching a whole lot of LOs in the same transaction
before the 8.1 pg_dump changes.  Per report from Wayne Conrad.

Backpatched as far as 8.1, but the problem doubtless goes all the way back.
I'm disinclined to spend the time to try to verify that the older branches
would still work if patched, seeing that this code was significantly modified
for 8.0 and again for 8.1, and that we don't have any trouble reports before
8.1.  (Maybe the leaks were smaller before?)
2006-04-26 00:35:35 +00:00
Tom Lane
4454eead14 The 8.1 planner removes WHERE quals from the plan when the quals are
implied by the predicate of a partial index being used to scan a table.
However, this optimization is unsafe in an UPDATE, DELETE, or SELECT FOR
UPDATE query, because the quals need to be rechecked by EvalPlanQual if
there's an update conflict.  Per example from Jean-Samuel Reynaud.
2006-04-25 16:54:26 +00:00
Tom Lane
2c4abf11e1 Improve our private implementation of cbrt() to give results of the
accuracy expected by the regression tests.  Per suggestion from
Martijn van Oosterhout.
2006-04-24 20:36:41 +00:00
Michael Meskes
e37c0d2eb8 Fixed memory leak bugs found by Martijn Oosterhout. 2006-04-24 09:45:44 +00:00
Bruce Momjian
499ec8c7e4 Fixes for BCC 5.5 compile of libpq. Backpatch to 8.1.X.
Mark Morgan Lloyd
2006-04-24 04:03:42 +00:00
Alvaro Herrera
7f0c9716ba Don't add a shared dependency on the owner of a composite type in pg_class.
We track the owner in pg_type instead, as that is the place where the owner is
changed on ALTER TYPE ... OWNER TO.
2006-04-24 01:40:39 +00:00
Bruce Momjian
21138b5e59 Suggest Win32 users user E'' strings and double backslashes used for
patch separators in COPY.

Backpatch doubleing backslashes suggestion to 8.1.
2006-04-22 03:03:19 +00:00
Tom Lane
bc5ba26d6b Fix ancient memory leak in PQprintTuples(); our code no longer uses this
routine, but perhaps some applications do.  Found by Martijn van Oosterhout
using Coverity.
2006-04-19 16:15:34 +00:00
Bruce Momjian
6b46ec2707 Mention "syntax" error as not logged by log_statement.
Backpatch.
2006-04-18 12:41:29 +00:00
Bruce Momjian
65f1a7a8dc Document that errors are not output by log_statement (was they were in
8.0), and add as suggestion to use log_min_error_statement for this
purpose.  I also fixed the code so the first EXECUTE has it's prepare,
rather than the last which is what was in the current code.  Also remove
"protocol" prefix for SQL EXECUTE output because it is not accurate.

Backpatch to 8.1.X.
2006-04-18 00:52:41 +00:00
Bruce Momjian
dd8d1b1fbd Document that pg_dump -d/-D prevents invalid data from canceling the
entire table load.
2006-04-15 18:11:48 +00:00
Tom Lane
d17c5f0acc Fix similar_escape() so that SIMILAR TO works properly for patterns involving
alternatives ("|" symbol).  The original coding allowed the added ^ and $
constraints to be absorbed into the first and last alternatives, producing
a pattern that would match more than it should.  Per report from Eric Noriega.

I also changed the pattern to add an ARE director ("***:"), ensuring that
SIMILAR TO patterns do not change behavior if regex_flavor is changed.  This
is necessary to make the non-capturing parentheses work, and seems like a
good idea on general principles.

Back-patched as far as 7.4.  7.3 also has the bug, but a fix seems impractical
because that version's regex engine doesn't have non-capturing parens.
2006-04-13 18:01:38 +00:00
Bruce Momjian
9b83454f7f Update AIX FAQ:
At any rate, here's a revision to CVS HEAD to reflect some changes by
myself and by Seneca Cunningham for the AIX FAQ.  It touches on the
following issues:

1.  memcpy pointer patch for dynahash.c

2.  AIX memory management, which can, for 32 bit cases, bite people
    quite unexpectedly...

Chris Browne
2006-04-13 11:42:35 +00:00
Tom Lane
e4b8253c40 Fix pg_restore -n option to do what the man page says it does. The
original coding only worked if one of the selTypes restriction options
was also given.  Per report from Nick Johnson.
2006-04-12 22:19:01 +00:00
Bruce Momjian
a5884d5dc8 Updated Japanese FAQ, version 2.
J.Kuwamura
2006-04-11 21:23:28 +00:00
Bruce Momjian
5052aa2edb Update Japanese FAQ, backpatch.
J.Kuwamura
2006-04-11 21:19:05 +00:00
Bruce Momjian
cc1b59c951 Oops, sysctl, not sysconf, for FreeBSD. 2006-04-11 21:06:19 +00:00
Bruce Momjian
e860973aed More FreeBSD jail wording improvements. 2006-04-11 19:46:48 +00:00
Bruce Momjian
493eea649c Add documentation about running postmasters in FreeBSD jails (use
separate users).
2006-04-11 19:28:03 +00:00
Bruce Momjian
36d5976f9e There is updated Russian translation of the FAQ in the attachment.
Victor Vislobokov
2006-04-11 15:49:04 +00:00
Tom Lane
d329913c9c Revert my best_inner_indexscan patch of yesterday, which turns out to have
had a bad side-effect: it stopped finding plans that involved BitmapAnd
combinations of indexscans using both join and non-join conditions.  Instead,
make choose_bitmap_and more aggressive about detecting redundancies between
BitmapOr subplans.
2006-04-09 18:18:59 +00:00
Tom Lane
89d75c56db Fix best_inner_indexscan to actually enforce that an "inner indexscan" use
at least one join condition as an indexqual.  Before bitmap indexscans, this
oversight didn't really cost much except for redundantly considering the
same join paths twice; but as of 8.1 it could result in silly bitmap scans
that would do the same BitmapOr twice and then BitmapAnd these together :-(
2006-04-08 21:32:25 +00:00
Tom Lane
cd360f2484 Fix pg_dumpall to do something sane when a pre-8.1 installation has
identically named user and group: we merge these into a single entity
with LOGIN permission.  Also, add ORDER BY commands to ensure consistent
dump ordering, for ease of comparing outputs from different installations.
2006-04-07 21:26:42 +00:00
Andrew Dunstan
a9351518a7 Revert getaddrinfo configure changes until we get a solution that is
properly tested on Tru64 - pre recent discussion (or lack thereof) on -hackers.
2006-04-07 17:42:50 +00:00
Tom Lane
23c6f11b09 Fix make_restrictinfo_from_bitmapqual() to preserve AND/OR flatness of its
output, ie, no OR immediately below an OR.  Otherwise we get Asserts or
wrong answers for cases such as
	select * from tenk1 a, tenk1 b
	where (a.ten = b.ten and (a.unique1 = 100 or a.unique1 = 101))
	   or (a.hundred = b.hundred and a.unique1 = 42);
Per report from Rafael Martinez Guerrero.
2006-04-07 17:05:47 +00:00
Bruce Momjian
69ab90c775 Update AIX FAQ to show readline options more clearly.
Backpatch FAQ's to 8.1.X.
2006-04-05 22:56:12 +00:00
Teodor Sigaev
06e4478877 Detoast query in g_intbig_consistent and copy query in g_int_consistent.
Minor cleanups.
2006-04-03 09:35:35 +00:00
Tom Lane
e88d84b737 Adjust interval-addition test so that it won't fail on DST transition days.
Strange that we missed this DST dependence while fixing the others.
2006-04-02 19:40:02 +00:00
Tom Lane
21b54ed81a Suppress attempts to report dropped tables to the stats collector from a
startup or recovery process.  Since such a process isn't a real backend,
pgstat.c gets confused.  This accounts for recent reports of strange
"invalid server process ID -1" log messages during crash recovery.
There isn't any point in attempting to make the report, since we'll discard
stats in such scenarios anyhow.
2006-03-30 22:11:59 +00:00
Tom Lane
c119cdcab0 TablespaceCreateDbspace should function normally even on platforms that do not
have symlinks (ie, Windows).  Although it'll never be called on to do anything
useful during normal operation on such a platform, it's still needed to
re-create dropped directories during WAL replay.
2006-03-29 15:15:50 +00:00
Tom Lane
fdc28fdcfa Disable full_page_writes, because turning it off risks causing crash-recovery
failures even when the hardware and OS did nothing wrong.  Per recent analysis
of a problem report from Alex Bahdushka.

For the moment I've just diked out the test of the parameter, rather than
removing the GUC infrastructure and documentation, in case we conclude that
there's something salvageable there.  There seems no chance of it being
resurrected in the 8.1 branch though.
2006-03-28 22:01:25 +00:00
Tom Lane
3c3ed28c75 Repair longstanding error in btree xlog replay: XLogReadBuffer should be
passed extend = true whenever we are reading a page we intend to reinitialize
completely, even if we think the page "should exist".  This is because it
might indeed not exist, if the relation got truncated sometime after the
current xlog record was made and before the crash we're trying to recover
from.  These two thinkos appear to explain both of the old bug reports
discussed here:
http://archives.postgresql.org/pgsql-hackers/2005-05/msg01369.php
2006-03-28 21:17:31 +00:00
Tom Lane
df7b5f5734 Comments in IndexBuildHeapScan describe the indexing of recently-dead
tuples as needed "to keep VACUUM from complaining", but actually there is
a more compelling reason to do it: failure to do so violates MVCC semantics.
This is because a pre-existing serializable transaction might try to use
the index after we finish (re)building it, and it might fail to find tuples
it should be able to see.  We got this mostly right, but not in the case
of partial indexes: the code mistakenly discarded recently-dead tuples for
partial indexes.  Fix that, and adjust the comments.
2006-03-24 23:02:23 +00:00
Tom Lane
db61437b27 Fix plpgsql to pass only one copy of any given plpgsql variable into a SQL
command or expression, rather than one copy for each textual occurrence as
it did before.  This might result in some small performance improvement,
but the compelling reason to do it is that not doing so can result in
unexpected grouping failures because the main SQL parser won't see different
parameter numbers as equivalent.  Add a regression test for the failure case.
Per report from Robert Davidson.
2006-03-23 04:22:45 +00:00
Tom Lane
a155814e37 Improve performance of our private version of qsort. Per recent testing,
the logic it contained to switch to insertion sort for near-sorted input was
in fact a big loss, because it could fairly easily be fooled into applying
insertion sort to large subfiles that weren't all that well ordered.  Remove
that, and instead add a simple check for already-perfectly-sorted input, as
per suggestion from Dann Corbit.  This adds at worst O(N*lgN) overhead, and
usually far less, while sometimes allowing a subfile sort to finish in O(N)
time.  Preliminary testing says this is an improvement over the basic
Bentley & McIlroy code for many nonrandom inputs, and it costs almost
nothing when the input is random.
2006-03-21 19:49:19 +00:00
Michael Meskes
85fa81f65b Fixed bug 2330: Wrong error code in case of a duplicate key 2006-03-19 12:29:40 +00:00
Tom Lane
a9f18b97ba Adjust join_1.out to match Windows behavior for new mergejoin regression
test, per Dave Page and buildfarm.  Perhaps we will need a join_2 instead,
but for the moment assume that this test tracks the other diffs.
2006-03-19 01:19:55 +00:00