Commit Graph

7779 Commits

Author SHA1 Message Date
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
Tom Lane 76cb32d848 Fix up grammar in variable description string. 2005-10-08 20:08:19 +00:00
Tom Lane 18d0ca2d1b Fix Kerberos authentication in wake of virtual-hosts changes --- need
to call krb5_sname_to_principal() always.  Also, use krb_srvname rather
than the hardwired string 'postgres' as the appl_version string in the
krb5_sendauth/recvauth calls, to avoid breaking compatibility with PG
8.0.  Magnus Hagander
2005-10-08 19:32:58 +00:00
Tom Lane 82e861fbe1 Fix LWLockAssign() so that it can safely be executed after postmaster
initialization.  Add spinlocking, fix EXEC_BACKEND unsafeness.
2005-10-07 21:42:38 +00:00
Tom Lane bb55e583f6 Allocate a few extra LWLocks for possible use by add-on modules.
Per request from Marc Munro.
2005-10-07 20:11:03 +00:00
Tom Lane 426d0158ca Marginal performance improvement in aclmask(): don't bother with
testing ownership if the caller isn't interested in any GOPTION bits
(which is the common case).  It did not matter in 8.0 where the ownership
test was just a trivial equality test, but it matters now.
2005-10-07 19:59:34 +00:00
Tom Lane b888ab82da Recognize ERROR_SHARING_VIOLATION (translate to EACCES), increase log
level for unrecognized win32 error codes to LOG, and make messages
conform to style guide.  Per old suggestion from Qingqing Zhou, which
seems to have gotten lost in the shuffle.
2005-10-07 16:34:48 +00:00
Tom Lane e6b92542a3 Marginal speedup in RelationIsVisible and TypeIsVisible: avoid a redundant
cache lookup in the success case.  This won't help much for cases where
the given relation is far down the search path, but it does not hurt in
any cases either; and it requires only a little new code.  Per gripe from
Jim Nasby about slowness of \d with many tables.
2005-10-06 22:43:16 +00:00
Neil Conway f59175d72f Minor API cleanup for async notifications: we can only register the
current backend in pg_listener, so there is little point in making
the PID to register part of async.c's public API. Other minor tweaks.
2005-10-06 21:30:39 +00:00
Tom Lane 9ea14ef56a When a function not returning RECORD has a single OUT parameter, use
the parameter's name (if any) as the default column name for SELECT FROM
the function, rather than the function name as previously.  I still think
this is a bad idea, but I lost the argument.  Force decompilation of
function RTEs to specify full aliases always, to reduce the odds of this
decision breaking dumped views.
2005-10-06 19:51:16 +00:00
Tom Lane fa63749d21 Fix oversight in indexscan plan creation. I recently added code to use
predicate_implied_by() to detect redundant filter conditions, but forgot
that predicate_implied_by() assumes its first argument contains only
immutable functions.  Add a check to guarantee that.  Also, test to see
if filter conditions can be discarded because they are redundant with
the predicate of a partial index.
2005-10-06 16:01:55 +00:00
Tom Lane cb8b6618ce Revise pgstats stuff to fix the problems with not counting accesses
generated by bitmap index scans.  Along the way, simplify and speed up
the code for counting sequential and index scans; it was both confusing
and inefficient to be taking care of that in the per-tuple loops, IMHO.
initdb forced because of internal changes in pg_stat view definitions.
2005-10-06 02:29:23 +00:00
Neil Conway b5aad11a1b Code cleanup for log_disconnections(). Patch from Qingqing Zhou,
fixes by Neil Conway.
2005-10-05 23:46:06 +00:00
Tom Lane e011459029 Make set_function_size_estimates() marginally smarter: per original
comment, it can at least test whether the expression returns set.
2005-10-05 17:19:19 +00:00
Peter Eisentraut 9c76af4a5e Add _ to gettext triggers. Must have been forgotten here when it was introduced. 2005-10-04 11:14:03 +00:00
Tom Lane 060d13f7c7 COPY's test for read-only transaction was backward; it prohibited COPY TO
where it should prohibit COPY FROM.  Found by Alon Goldshuv.
2005-10-03 23:43:09 +00:00
Tom Lane 53e47cdd79 Add a trace_sort option to help with measuring resource usage of external
sort operations.  Per recent discussion.  Simon Riggs and Tom Lane.
2005-10-03 22:55:56 +00:00
Tom Lane 12992ab37a Separate out the VacRUsage stuff as an independent module, in preparation
for using it for other things besides VACUUM.
2005-10-03 22:52:26 +00:00
Tom Lane f20cad7870 Preserve tuple OIDs during ATRewriteTable. Per gripe from Duncan Crombie. 2005-10-03 02:45:12 +00:00
Tom Lane 64eea6c21d Expand pg_control information so that we can verify that the database
was created on a machine with alignment rules and floating-point format
similar to the current machine.  Per recent discussion, this seems like
a good idea with the increasing prevalence of 32/64 bit environments.
2005-10-03 00:28:43 +00:00
Tom Lane aa731ed843 Change nextval and other sequence functions to specify their sequence
argument as a 'regclass' value instead of a text string.  The frontend
conversion of text string to pg_class OID is now encapsulated as an
implicitly-invocable coercion from text to regclass.  This provides
backwards compatibility to the old behavior when the sequence argument
is explicitly typed as 'text'.  When the argument is just an unadorned
literal string, it will be taken as 'regclass', which means that the
stored representation will be an OID.  This solves longstanding problems
with renaming sequences that are referenced in default expressions, as
well as new-in-8.1 problems with renaming such sequences' schemas or
moving them to another schema.  All per recent discussion.
Along the way, fix some rather serious problems in dbmirror's support
for mirroring sequence operations (int4 vs int8 confusion for instance).
2005-10-02 23:50:16 +00:00
Tom Lane 1b61ee3c69 _SPI_execute_plan failed to return result tuple table to caller in
the ProcessUtility case, resulting in an intratransaction memory leak
if a utility command actually did return any tuples, as reported by
Dmitry Karasik.  Fix this and also make the behavior more consistent
for cases involving nested SPI operations and multiple query trees,
by ensuring that we store the state locally until it is ready to be
returned to the caller.
2005-10-01 18:43:19 +00:00
Alvaro Herrera a7084efd2d Fix confusion between relfilenode and Oid.
Also, make pg_total_relation_size include the size of the
TOAST index.
2005-09-29 22:04:36 +00:00
Tom Lane 2e1254e7fa Repair planning bug introduced in 7.4: outer-join ON clauses that referenced
only the inner-side relation would be considered as potential equijoin clauses,
which is wrong because the condition doesn't necessarily hold above the point
of the outer join.  Per test case from Kevin Grittner (bug#1916).
2005-09-28 21:17:02 +00:00
Bruce Momjian 72739020c2 Log protocol-excute fetch operatation as fetch, rather than execute,
adjusted from a patch by Simon.
2005-09-26 15:51:12 +00:00
Tom Lane e990b9ce23 The original patch to avoid building a hash join's hashtable when the
outer relation is empty did not work, per test case from Patrick Welche.
It tried to use nodeHashjoin.c's high-level mechanisms for fetching an
outer-relation tuple, but that code expected the hash table to be filled
already.  As patched, the code failed in corner cases such as having no
outer-relation tuples for the first hash batch.  Revert and rewrite.
2005-09-25 19:37:35 +00:00
Tom Lane 303e089df5 Clean up possibly-uninitialized-variable warnings reported by gcc 4.x. 2005-09-24 22:54:44 +00:00
Tom Lane 8889685555 Suppress signed-vs-unsigned-char warnings. 2005-09-24 17:53:28 +00:00
Tom Lane 54a8af058e In a machine where INT64_IS_BUSTED, we can only support 32-bit values
for int8 and related types.  However we might be talking to a client
that has working int64; so pq_getmsgint64 really needs to check the
incoming value and throw an overflow error if we can't represent it
accurately.
2005-09-24 15:34:07 +00:00