Commit Graph

7807 Commits

Author SHA1 Message Date
Tom Lane a037926295 Reorder code so that we don't have to hold a critical section while
reserving SLRU space for a new MultiXact.  The original coding would have
treated out-of-disk-space as a PANIC condition, which is unnecessary.
2005-10-28 19:00:19 +00:00
Tom Lane 1986ca5ce5 Fix race condition in multixact code: it's possible to try to read a
multixact's starting offset before the offset has been stored into the
SLRU file.  A simple fix would be to hold the MultiXactGenLock until the
offset has been stored, but that looks like a big concurrency hit.  Instead
rely on knowledge that unset offsets will be zero, and loop when we see
a zero.  This requires a little extra hacking to ensure that zero is never
a valid value for the offset.  Problem reported by Matteo Beccati, fix
ideas from Martijn van Oosterhout, Alvaro Herrera, and Tom Lane.
2005-10-28 17:27:29 +00:00
Tom Lane 97b8013db5 Add an ifneq to avoid make warning on AIX --- there is a separate rule
for postgres: on line 86, and line 43 shouldn't be used.  Noted while
looking at kookaburra buildfarm results.
2005-10-27 20:45:29 +00:00
Tom Lane fbbe00242d Tweak buffer manager so that 'internal' accesses to a buffer do not
advance its usage_count.  This includes writes of dirty buffers triggered
by bgwriter, checkpoint, or FlushRelationBuffers, as well as various
corner cases that really ought not count as accesses to the page.
Should make for some marginal improvement in the quality of our decisions
about when to recycle buffers.  Per suggestion from ITAGAKI Takahiro.
2005-10-27 17:07:58 +00:00
Bruce Momjian 69f16b562a Add comment documenting actual failure case of using
interval_justify_hours in timestamp subtraction.  TODO already has text
description.
2005-10-27 02:45:22 +00:00
Tom Lane fc5894bf77 Adjust parser so that POSTQUEL-style implicit RTEs are stored with
inFromCl true, meaning that they will list out as explicit RTEs if they
are in a view or rule.  Update comments about inFromCl to reflect the way
it's now actually used.  Per recent discussion.
2005-10-26 19:21:55 +00:00
Tom Lane ddb4015ec0 Fix longstanding bug that would sometimes let the planner generate a bad plan
for an outer join; symptom is bogus error "RIGHT JOIN is only supported with
merge-joinable join conditions".  Problem was that select_mergejoin_clauses
did its tests in the wrong order.  We need to force left join not right join
for a merge join when there are non-mergeable join clauses; but the test for
this only accounted for mergejoinability of the clause operator, and not
whether the left and right Vars were of the proper relations.  Per report
from Jean-Pierre Pelletier.
2005-10-25 20:30:30 +00:00
Tom Lane 6a9b93a0e1 Remove justify_hours call from interval_mul and interval_div, and make
some small stylistic improvements in these functions.  Also fix several
places where TMODULO() was being used with wrong-sized quotient argument,
creating a risk of overflow --- interval2tm was actually capable of going
into an infinite loop because of this.
2005-10-25 17:13:07 +00:00
Tom Lane 25777f6fd3 Fix Windows setitimer() emulation to not depend on delivering an APC
to the main thread.  This allows removal of WaitForSingleObjectEx() calls
from the main thread, thereby allowing us to re-enable Qingqing Zhou's
CHECK_FOR_INTERRUPTS performance improvement.  Qingqing, Magnus, et al.
2005-10-25 15:15:16 +00:00
Bruce Momjian 9ee8b9fd38 Change trace_sort to output to the log, rather than the user's terminal. 2005-10-25 13:47:08 +00:00
Tom Lane 6d6c3722fb Make code for selecting default WAL sync method less confusing. 2005-10-22 20:27:17 +00:00
Andrew Dunstan 188c52497d minor code cleanup - replace useless struct timezone argument to
gettimeofday with NULL in a few places, making it consistent with
usage elsewhere.
2005-10-22 14:27:29 +00:00
Tom Lane 6aad07d270 Improve performance of CHECK_FOR_INTERRUPTS() macro on Windows by not doing
a kernel call unless there's some evidence of a pending signal.  This should
bring its performance on Windows into line with the Unix version.  Problem
diagnosis and patch by Qingqing Zhou.  Minor stylistic tweaks by moi ...
if it's broken, it's my fault.
2005-10-21 21:43:46 +00:00
Tom Lane 9fc24f2bf6 Fix EXPLAIN ANALYZE bug noted by Wiebe Cazemier: although we were
properly advancing the CommandCounter between multiple sub-queries
generated by rules, we forgot to update the snapshot being used, so
that the successive sub-queries didn't actually see each others'
results.  This is still not *exactly* like the semantics of normal
execution of the same queries, in that we don't take new transaction
snapshots and hence don't see changes from concurrently committed
commands, but I think that's OK and probably even preferable for
EXPLAIN ANALYZE.
2005-10-21 16:43:33 +00:00
Tom Lane 78ce809216 Postpone pg_timezone_initialize() until after creation of postmaster.pid,
since it can take a fair amount of time and this can confuse boot scripts
that expect postmaster.pid to appear quickly.  Move initialization of SSL
library and preloaded libraries to after that point, too, just for luck.
Per reports from Tony Caduto and others.
2005-10-20 20:05:45 +00:00
Tom Lane 7218aab7a2 Adjust not-too-sane calculation of DDD value for to_char(interval).
Per gripe from Chris Matheson.
2005-10-20 15:59:46 +00:00
Tom Lane 8130cbce96 Clean up md5.c to make it clearer that it is a frontend-and-backend
module.  Don't rely on backend palloc semantics; in fact, best to not
use palloc at all, rather than #define'ing it to malloc, because that
just encourages errors of omission.  Bug spotted by Volkan YAZICI,
but I went further than he did to fix it.
2005-10-20 13:54:08 +00:00
Tom Lane d9cb48786e Better solution to the problem of labeling whole-row Datums that are
generated from subquery outputs: use the type info stored in the Var
itself.  To avoid making ExecEvalVar and slot_getattr more complex
and slower, I split out the whole-row case into a separate ExecEval routine.
2005-10-19 22:30:30 +00:00
Tom Lane 07908c9c37 Ensure that the Datum generated from a whole-row Var contains valid
type ID information even when it's a record type.  This is needed to
handle whole-row Vars referencing subquery outputs.  Per example from
Richard Huxton.
2005-10-19 18:18:33 +00:00
Tom Lane 32fcfcdbd6 Fix oversight in recent changes to enable the 'physical tlist'
optimization for subquery and function scan nodes: we can't just do it
unconditionally, we still have to check whether there is any need for
a whole-row Var.  I had been thinking that these node types couldn't
have any system columns, which is true, but that loop is also checking
for attno zero, ie, whole-row Var.  Fix comment to not be so misleading.
Per test case from Richard Huxton.
2005-10-19 17:31:20 +00:00
Tom Lane b33a732264 Improve trace_sort code to also show the total memory or disk space used.
Per request from Marc.
2005-10-18 22:59:37 +00:00
Tom Lane 220f2a7d15 Code review for regexp_replace patch. Improve documentation and comments,
fix problems with replacement-string backslashes that aren't followed by
one of the expected characters, avoid giving the impression that
replace_text_regexp() is meant to be called directly as a SQL function,
etc.
2005-10-18 20:38:58 +00:00
Tom Lane 23836fb1fb A few trivial code cleanups motivated by reading warnings generated
by a recent HP C compiler.  Mostly, get rid of useless local variables
that are assigned to but never used.
2005-10-18 01:06:24 +00:00
Tom Lane d330f1554d Clean up libpq's pollution of application namespace by renaming the
exported routines of ip.c, md5.c, and fe-auth.c to begin with 'pg_'.
Also get rid of the vestigial fe_setauthsvc/fe_getauthsvc routines
altogether.
2005-10-17 16:24:20 +00:00
Bruce Momjian 649e74bf90 Add space after description.
Euler Taveira de Oliveira
2005-10-16 18:26:00 +00:00
Bruce Momjian 98d5f4e574 kerberos error message: localhost -> server hostname 2005-10-15 21:27:19 +00:00
Tom Lane e4cd186608 Fix thinko in pg_read_file: testing for negative result is not the way
to determine whether fread() failed.
2005-10-15 19:47:09 +00:00
Bruce Momjian 1dc3498251 Standard pgindent run for 8.1. 2005-10-15 02:49:52 +00:00
Tom Lane abd3f43b4c Fix syslog bug: if any messages are emitted to write_syslog before
the facility has been set, the facility gets set to LOCAL0 and cannot
be changed later.  This seems reasonably plausible to happen, particularly
at higher debug log levels, though I am not certain it explains Han Holl's
recent report.  Easiest fix is to teach the code how to change the value
on-the-fly, which is nicer anyway.  I made the settings PGC_SIGHUP to
conform with log_destination.
2005-10-14 20:53:56 +00:00
Tom Lane 4aa0d70fb7 Pass a strdup'd ident string to openlog(), to ensure that reallocation
of GUC memory doesn't cause us to start emitting a bogus ident string.
Per report from Han Holl.  Also some trivial code cleanup in write_syslog.
2005-10-14 16:41:02 +00:00
Bruce Momjian a93bf4503f Allow times of 24:00:00 to match rounding behavior:
regression=# select '23:59:59.9'::time(0);
	   time
	----------
	 24:00:00
	(1 row)

	This is bad because:

	regression=# select '24:00:00'::time(0);
	ERROR:  date/time field value out of range: "24:00:00"

The last example now works.
2005-10-14 11:47:57 +00:00
Bruce Momjian 2d8e3d1d71 Make stack_base_ptr non-static, for PL/Java. 2005-10-13 22:57:27 +00:00
Bruce Momjian 1d028537a2 This makes the error messages for PREPARE TRANSACTION, COMMIT PREPARED
etc. match the docs, which talk about "transaction identifier" not
"gid" or "global transaction identifier".

Steve Woodcock
2005-10-13 22:55:55 +00:00
Bruce Momjian 5aae047e23 Update krb_server_name to document that a missing entry defaults to
'localhost'.

Improve kerberos error message.
2005-10-13 22:55:19 +00:00
Bruce Momjian 84cc9a4bb3 Back out this because of fear of changing error strings:
This makes the error messages for PREPARE TRANSACTION, COMMIT PREPARED
etc. match the docs, which talk about "transaction identifier" not
"gid" or "global transaction identifier".

Steve Woodcock
2005-10-13 17:57:57 +00:00
Bruce Momjian 90c22c9206 This makes the error messages for PREPARE TRANSACTION, COMMIT PREPARED
etc. match the docs, which talk about "transaction identifier" not
"gid" or "global transaction identifier".

Steve Woodcock
2005-10-13 17:57:17 +00:00
Bruce Momjian 32e6c2a160 Use get_progname() in backend main.c, rather than port-specific hack
that is too fragile.
2005-10-13 15:37:14 +00:00
Neil Conway c10dba2fe3 Remove an antiquated comment. 2005-10-13 06:24:05 +00:00
Tom Lane 1e9a6ba5e6 Don't try to remove duplicate OR-subclauses in create_bitmap_subplan and
make_restrictinfo_from_bitmapqual.  The likelihood of finding duplicates
seems much less than in the AND-subclause case, and the cost much higher,
because OR lists with hundreds or even thousands of subclauses are not
uncommon.  Per discussion with Ilia Kantor and andrew@supernews.
2005-10-13 00:06:46 +00:00
Tom Lane e952ae1268 Fix longstanding bug found by Atsushi Ogawa: _bt_check_unique would mark
the wrong buffer dirty when trying to kill a dead index entry that's on
a page after the one it started on.  No risk of data corruption, just
inefficiency, but still a bug.
2005-10-12 17:18:03 +00:00
Tom Lane fa72121594 Fix another recently-changed place that was messing with spinlock-
protected data structures and not using a volatile pointer for same.
2005-10-12 16:55:59 +00:00
Tom Lane 07eeb9d109 Do all accesses to shared buffer headers through volatile-qualified
pointers, to ensure that compilers won't rearrange accesses to occur
while we're not holding the buffer header spinlock.  It's probably
not necessary to mark volatile in every single place in bufmgr.c,
but better safe than sorry.  Per trouble report from Kevin Grittner.
2005-10-12 16:45:14 +00:00
Neil Conway 6f8236f1b5 Fix typo in sample pg_hba.conf; per IRC report from Bernhard Neuhauser. 2005-10-11 22:58:15 +00:00
Tom Lane a72ee09090 Add infrastructure for making spins_per_delay variable depending on
whether we seem to be running in a uniprocessor or multiprocessor.
The adjustment rules could probably still use further tweaking, but
I'm convinced this should be a win overall.
2005-10-11 20:41:32 +00:00
Tom Lane 0cc0d0822d Document that get_attstatsslot/free_attstatsslot only need to be passed
valid type information if they are asked to fetch the values part of a
pg_statistic slot; these arguments are unneeded if fetching only the
numbers part.  Use this to save a catcache lookup in btcostestimate,
which is looking like a bit of a hotspot in recent profiling.  Not a
big savings, but since it's essentially free, might as well do it.
2005-10-11 17:27:14 +00:00
Tom Lane 07e6f93d6b Fix oversight in 8.0 modification of RestrictInfo data structures.
A RestrictInfo representing an OR clause now contains two versions of
the contained expression, one with sub-RestrictInfos and one without.
clause_selectivity() should descend to the version with sub-RestrictInfos
so that it has a chance of caching its results for the OR's sub-clauses.
Failing to do so resulted in redundant planner effort.
2005-10-11 16:44:40 +00:00
Tom Lane 375e7d5579 Use a safer order of operations in dropdb(): rollbackable operations,
ie removing shared-dependency entries, should happen before non-rollbackable
ones.  That way a failure during the rollbackable part doesn't leave us
with inconsistent state.
2005-10-10 20:02:20 +00:00
Peter Eisentraut b473d7adc4 Translation update 2005-10-10 19:36:36 +00:00
Tom Lane 9178306151 Fix the problem of GRANTs creating "dangling" privileges not directly
traceable to grant options.  As per my earlier proposal, a GRANT made by
a role member has to be recorded as being granted by the role that actually
holds the grant option, and not the member.
2005-10-10 18:49:04 +00:00
Tom Lane 313ed1ed94 Fix (hopefully for the last time) problems with datetime values displaying
like '23:59:60' because of fractional-second roundoff problems.  Trying
to control this upstream of the actual display code was hopeless; the right
way is to explicitly round fractional seconds in the display code and then
refigure the results if the fraction rounds up to 1.  Per bug #1927.
2005-10-09 17:21:47 +00:00