Commit Graph

23983 Commits

Author SHA1 Message Date
Tom Lane
1e172f9692 Fix aboriginal bug in BufFileDumpBuffer that would cause it to write the
wrong data when dumping a bufferload that crosses a component-file boundary.
This probably has not been seen in the wild because (a) component files are
normally 1GB apiece and (b) non-block-aligned buffer usage is relatively
rare.  But it's fairly easy to reproduce a problem if one reduces RELSEG_SIZE
in a test build.  Kudos to Kurt Harriman for spotting the bug.
2007-06-01 23:43:17 +00:00
Tom Lane
3e2c198e06 Fix performance problems in multi-batch hash joins by ensuring that we select
a well-randomized batch number even when given a poorly-randomized hash value.
This is a bit inefficient but seems the only practical solution given the
constraint that we can't change the hash functions in released branches.
Per report from Joseph Shraibman.

Applied to 8.1 and 8.2 only --- HEAD is getting a cleaner fix, and 8.0 and
before use different coding that seems less vulnerable.
2007-06-01 15:58:02 +00:00
Tom Lane
9a4c943747 Fix overly-strict sanity check in BeginInternalSubTransaction that made it
fail when used in a deferred trigger.  Bug goes back to 8.0; no doubt the
reason it hadn't been noticed is that we've been discouraging use of
user-defined constraint triggers.  Per report from Frank van Vugt.
2007-05-30 21:01:45 +00:00
Neil Conway
75103cc218 Fix a bug in input processing for the "interval" type. Previously,
"microsecond" and "millisecond" units were not considered valid input
by themselves, which caused inputs like "1 millisecond" to be rejected
erroneously.

Update the docs, add regression tests, and backport to 8.2 and 8.1
2007-05-29 04:59:15 +00:00
Tom Lane
7b6b5ba9b2 Repair planner bug introduced in 8.2 by ability to rearrange outer joins:
in cases where a sub-SELECT inserts a WHERE clause between two outer joins,
that clause may prevent us from re-ordering the two outer joins.  The code
was considering only the joins' own ON-conditions in determining reordering
safety, which is not good enough.  Add a "delay_upper_joins" flag to
OuterJoinInfo to flag that we have detected such a clause and higher-level
outer joins shouldn't be permitted to commute with this one.  (This might
seem overly coarse, but given the current rules for OJ reordering, it's
sufficient AFAICT.)

The failure case is actually pretty narrow: it needs a WHERE clause within
the RHS of a left join that checks the RHS of a lower left join, but is not
strict for that RHS (else we'd have simplified the lower join to a plain
join).  Even then no failure will be manifest unless the planner chooses to
rearrange the join order.

Per bug report from Adam Terrey.
2007-05-22 23:24:09 +00:00
Tom Lane
107cbb2b90 Fix best_inner_indexscan to return both the cheapest-total-cost and
cheapest-startup-cost innerjoin indexscans, and make joinpath.c consider
both of these (when different) as the inside of a nestloop join.  The
original design was based on the assumption that indexscan paths always
have negligible startup cost, and so total cost is the only important
figure of merit; an assumption that's obviously broken by bitmap
indexscans.  This oversight could lead to choosing poor plans in cases
where fast-start behavior is more important than total cost, such as
LIMIT and IN queries.  8.1-vintage brain fade exposed by an example from
Chuck D.
2007-05-22 01:40:42 +00:00
Peter Eisentraut
06df9a69e8 Fix spurious German index entry 2007-05-21 15:10:20 +00:00
Michael Meskes
08629a2d60 Removed errant ISODOW 2007-05-21 14:57:07 +00:00
Michael Meskes
87304ef621 Backported fix from HEAD that removes superfluous function Vista has a problem with 2007-05-21 07:10:23 +00:00
Peter Eisentraut
0b98091e23 Fix inappropriate comments 2007-05-18 09:43:15 +00:00
Tom Lane
cac8953d52 Remove redundant logging of send failures when SSL is in use. While pqcomm.c
had been taught not to do that ages ago, the SSL code was helpfully bleating
anyway.  Resolves some recent reports such as bug #3266; however the
underlying cause of the related bug #2829 is still unclear.
2007-05-18 01:20:25 +00:00
Tom Lane
2f6d85101b Temporary fix for the problem that pg_stat_activity, inet_client_addr(),
and inet_server_addr() fail if the client connected over a "scoped" IPv6
address.  In this case getnameinfo() will return a string ending with
a poorly-standardized "%something" zone specifier, which these functions
try to feed to network_in(), which won't take it.  So that we don't lose
functionality altogether, suppress the zone specifier before giving the
string to network_in().  Per report from Brian Hirt.

TODO: probably someday the inet type should support scoped IPv6 addresses,
and then this patch should be reverted.

Backpatch to 8.2 ... is it worth going further?
2007-05-17 23:31:59 +00:00
Alvaro Herrera
d42e2b7502 Avoid emitting empty role names in the GRANTED BY clause of GRANT ROLE
when the grantor has been dropped.  This is a workaround for the fact
that we don't track the grantor as a shared dependency.
2007-05-15 20:20:24 +00:00
Neil Conway
fbef95ef13 Fix a bunch of bad grammar in the docs: "<link>, which see for more
information" is un-good English.
2007-05-15 19:43:59 +00:00
Neil Conway
10d1f31253 Add a note to the documentation to clarify that even when
"autovacuum = off", the system may still periodically start autovacuum
processes to prevent XID wraparound. Patch from David Fetter, with
editorializing.
2007-05-15 15:35:58 +00:00
Magnus Hagander
38e6aea5a7 Document that CLUSTER breaks MVCC visibility rules.
(Not needed in cvs head, because CLUSTER itself is fixed there)

Heikki Linnakangas
2007-05-13 16:04:40 +00:00
Tom Lane
1e7f0c3a14 Improve predicate_refuted_by_simple_clause() to handle IS NULL and IS NOT NULL
more completely.  The motivation for having it understand IS NULL at all was
to allow use of "foo IS NULL" as one of the subsets of a partitioning on
"foo", but as reported by Aleksander Kmetec, it wasn't really getting the job
done.  Backpatch to 8.2 since this is arguably a performance bug.
2007-05-12 19:22:43 +00:00
Tom Lane
4a898fbb20 Fix my oversight in enabling domains-of-domains: ALTER DOMAIN ADD CONSTRAINT
needs to check the new constraint against columns of derived domains too.

Also, make it error out if the domain to be modified is used within any
composite-type columns.  Eventually we should support that case, but it seems
a bit painful, and not suitable for a back-patch.  For the moment just let the
user know we can't do it.

Backpatch to 8.2, which is the only released version that allows nested
domains.  Possibly the other part should be back-patched further.
2007-05-11 20:18:21 +00:00
Magnus Hagander
ff5ff47b5d Check return code from strxfrm on Windows since it has a
non-standard way of indicating errors, so we don't try to
allocate INT_MAX bytes to store a result in.
2007-05-05 17:05:55 +00:00
Alvaro Herrera
61f9c3a54d Fix a few more double words in docs. 2007-05-03 15:47:37 +00:00
Neil Conway
6c6ab55b8c Fix some typos in the documentation. Patch from Brian Gough. Backport
the relevant fixes to 8.2 as well.
2007-05-03 15:06:13 +00:00
Tom Lane
1430b51761 Fix a thinko in my patch of a couple months ago for bug #3116: it did the
wrong thing when inlining polymorphic SQL functions, because it was using the
function's declared return type where it should have used the actual result
type of the current call.  In 8.1 and 8.2 this causes obvious failures even if
you don't have assertions turned on; in 8.0 and 7.4 it would only be a problem
if the inlined expression were used as an input to a function that did
run-time type determination on its inputs.  Add a regression test, since this
is evidently an under-tested area.
2007-05-01 18:54:02 +00:00
Michael Meskes
9c35b136f1 Removed non-existant function from extern.h 2007-04-27 07:55:22 +00:00
Michael Meskes
1b87b4474f Inlined two functions to get rid of va_list prolems on some archs. 2007-04-27 06:58:17 +00:00
Tom Lane
b26329654e Fix dynahash.c to suppress hash bucket splits while a hash_seq_search() scan
is in progress on the same hashtable.  This seems the least invasive way to
fix the recently-recognized problem that a split could cause the scan to
visit entries twice or (with much lower probability) miss them entirely.
The only field-reported problem caused by this is the "failed to re-find
shared lock object" PANIC in COMMIT PREPARED reported by Michel Dorochevsky,
which was caused by multiply visited entries.  However, it seems certain
that mdsync() is vulnerable to missing required fsync's due to missed
entries, and I am fearful that RelationCacheInitializePhase2() might be at
risk as well.  Because of that and the generalized hazard presented by this
bug, back-patch all the supported branches.

Along the way, fix pg_prepared_statement() and pg_cursor() to not assume
that the hashtables they are examining will stay static between calls.
This is risky regardless of the newly noted dynahash problem, because
hash_seq_search() has never promised to cope with deletion of table entries
other than the just-returned one.  There may be no bug here because the only
supported way to call these functions is via ExecMakeTableFunctionResult()
which will cycle them to completion before doing anything very interesting,
but it seems best to get rid of the assumption.  This affects 8.2 and HEAD
only, since those functions weren't there earlier.
2007-04-26 23:24:57 +00:00
Magnus Hagander
3f92fd6524 Set maximum semaphore count to 32767 instead of 1. Fixes
errorcode 298 when unlocking a semaphore more than once.

Per report from Marcin Waldowski.
2007-04-24 12:25:23 +00:00
Neil Conway
6d0e96df6f Fix newly-introduced documentation typo. 2007-04-23 16:52:56 +00:00
Neil Conway
f0ed36748d Fix LOCK_DEBUG compilation in the 8.2 branch; HEAD was fixed earlier.
Heikki Linnakangas.
2007-04-23 15:13:30 +00:00
Tom Lane
ce8a3e6c88 Fix markup.
Security: CVE-2007-2138
2007-04-20 03:27:34 +00:00
PostgreSQL Daemon
e05d9875b2 Update configure.in version number
Security: tag for release
2007-04-20 03:20:42 +00:00
Tom Lane
d694bdd1c9 Support explicit placement of the temporary-table schema within search_path.
This is needed to allow a security-definer function to set a truly secure
value of search_path.  Without it, a malicious user can use temporary objects
to execute code with the privileges of the security-definer function.  Even
pushing the temp schema to the back of the search path is not quite good
enough, because a function or operator at the back of the path might still
capture control from one nearer the front due to having a more exact datatype
match.  Hence, disable searching the temp schema altogether for functions and
operators.

Security: CVE-2007-2138
2007-04-20 02:37:49 +00:00
Tom Lane
4e6c6a40e0 Sync timezone data with 2007e zic release. 2007-04-19 22:44:38 +00:00
Tom Lane
c0a562287b Fix missed PACKAGE_STRING. 2007-04-19 22:23:31 +00:00
Tom Lane
7fc2507f7c Repair PANIC condition in hash indexes when a previous index extension attempt
failed (due to lock conflicts or out-of-space).  We might have already
extended the index's filesystem EOF before failing, causing the EOF to be
beyond what the metapage says is the last used page.  Hence the invariant
maintained by the code needs to be "EOF is at or beyond last used page",
not "EOF is exactly the last used page".  Problem was created by my patch
of 2006-11-19 that attempted to repair bug #2737.  Since that was
back-patched to 7.4, this needs to be as well.  Per report and test case
from Vlastimil Krejcir.
2007-04-19 20:24:10 +00:00
Tom Lane
266a0ffe45 Fix plpgsql to avoid reference to already-freed memory when returning a
pass-by-reference data type and the RETURN statement is within an EXCEPTION
block.  Bug introduced by my fix of 2007-01-28 to use per-subtransaction
ExprContexts/EStates; since that wasn't back-patched into older branches,
only 8.2 and HEAD are affected.  Per report from Gary Winslow.
2007-04-19 16:33:32 +00:00
Bruce Momjian
9de4b61388 Release wording updates for releases 8.2.4, 8.1.9, 8.0.13, 7.4.17, 7.3.19. 2007-04-19 13:03:07 +00:00
Bruce Momjian
90e4b46998 Stamp releases 8.2.4, 8.1.9, 8.0.13, 7.4.17, 7.3.19. 2007-04-19 03:07:32 +00:00
Bruce Momjian
fe48792a11 Release note updates for 8.2.4, 8.1.9, 8.0.13, 7.4.17, 7.3.19. 2007-04-19 02:47:52 +00:00
Peter Eisentraut
d3753aad55 Translation updates 2007-04-18 20:01:39 +00:00
Bruce Momjian
65c531df04 Update docs/error message for CSV quote/escape --- must be ASCII.
Backpatch doc change to 8.2.X.
2007-04-18 02:29:39 +00:00
Bruce Momjian
4e93443455 Document that the COPY delimiter must be an ASCII byte, rather than a
multi-byte value.  It can also be a single-byte encoded character if
the client and server versions match.

Backpatch to 8.2.X.
2007-04-18 00:18:31 +00:00
Tom Lane
2edda80720 Rewrite choose_bitmap_and() to make it more robust in the presence of
competing alternatives for indexes to use in a bitmap scan.  The former
coding took estimated selectivity as an overriding factor, causing it to
sometimes choose indexes that were much slower to scan than ones with a
slightly worse selectivity.  It was also too narrow-minded about which
combinations of indexes to consider ANDing.  The rewrite makes it pay more
attention to index scan cost than selectivity; this seems sane since it's
impossible to have very bad selectivity with low cost, whereas the reverse
isn't true.  Also, we now consider each index alone, as well as adding
each index to an AND-group led by each prior index, for a total of about
O(N^2) rather than O(N) combinations considered.  This makes the results
much less dependent on the exact order in which the indexes are
considered.  It's still a lot cheaper than an O(2^N) exhaustive search.
A prefilter step eliminates all but the cheapest of those indexes using
the same set of WHERE conditions, to keep the effective value of N down in
scenarios where the DBA has created lots of partially-redundant indexes.
2007-04-17 20:03:10 +00:00
Magnus Hagander
ff663c9606 Don't write timing output in quiet mode.
Merlin Moncure
2007-04-16 20:16:11 +00:00
Tom Lane
aeb5417633 Fix pg_dump to not crash if -t or a similar switch is used to select a serial
sequence for dumping without also selecting its owning table.  Make it not try
to emit ALTER SEQUENCE OWNED BY in this situation.
Per report from Michael Nolan.
2007-04-16 18:42:17 +00:00
Tom Lane
366e9eea24 Rearrange mdsync() looping logic to avoid the problem that a sufficiently
fast flow of new fsync requests can prevent mdsync() from ever completing.
This was an unforeseen consequence of a patch added in Mar 2006 to prevent
the fsync request queue from overflowing.  Problem identified by Heikki
Linnakangas and independently by ITAGAKI Takahiro; fix based on ideas from
Takahiro-san, Heikki, and Tom.

Back-patch as far as 8.1 because a previous back-patch introduced the problem
into 8.1 ...
2007-04-12 17:11:00 +00:00
Tom Lane
707964b6a8 Cancel pending fsync requests during WAL replay of DROP DATABASE, per bug
report from David Darville.  Back-patch as far as 8.1, which may or may not
have the problem but it seems a safe change anyway.
2007-04-12 15:04:41 +00:00
Bruce Momjian
627939c337 Backpatch doc change SYMETRIC -> SYMMETRIC, for 8.2.X. 2007-04-07 15:43:47 +00:00
Tom Lane
3ac7d76096 Fix check_sql_fn_retval to allow the case where a SQL function declared to
return void ends with a SELECT, if that SELECT has a single result that is
also of type void.  Without this, it's hard to write a void function that
calls another void function.  Per gripe from Peter.

Back-patch as far as 8.0.
2007-04-02 18:49:36 +00:00
Teodor Sigaev
100beb0dea Fix caching of unsuccessful initialization of parser or configuration.
Per report from Listmail <lists@peufeu.com>
2007-04-02 11:42:25 +00:00
Bruce Momjian
4dd2d9192d Update SSL description for when SSL root.crt/server.crt is required;
add link to libpq SSL does from server docs.

Backpatch to 8.2.X.
2007-03-30 03:19:19 +00:00