Tom Lane [Thu, 13 Oct 2005 15:34:19 +0000 (15:34 +0000)]
Fix small oversight in recent patch to add more CREATE-FUNCTION-time
syntax checking to plpgsql: check_sql_expr() wasn't being called by
make_select_stmt(), so that there was no SQL syntax check for SELECT
statements.
Bruce Momjian [Thu, 13 Oct 2005 01:23:49 +0000 (01:23 +0000)]
Update:
> * Prevent PQfnumber() from lowercasing unquoted the column name
>
> PQfnumber() should never have been doing lowercasing, but historically
> it has so we need a way to prevent it
>
Tom Lane [Thu, 13 Oct 2005 00:06:46 +0000 (00:06 +0000)]
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.
Bruce Momjian [Wed, 12 Oct 2005 22:39:35 +0000 (22:39 +0000)]
Remove item:
< * Prevent libpq's PQfnumber() from lowercasing the column name
<
< One idea is to lowercase all identifiers except those that are
< surrounded by quotes.
<
Tom Lane [Wed, 12 Oct 2005 17:18:03 +0000 (17:18 +0000)]
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.
Tom Lane [Wed, 12 Oct 2005 16:45:14 +0000 (16:45 +0000)]
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.
Bruce Momjian [Wed, 12 Oct 2005 14:06:46 +0000 (14:06 +0000)]
No longer needed:
<
< * Add code to detect an SMP machine and handle spinlocks accordingly
< from distributted.net, http://www1.distributed.net/source,
< in client/common/cpucheck.cpp
<
< On SMP machines, it is possible that locks might be released shortly,
< while on non-SMP machines, the backend should sleep so the process
< holding the lock can complete and release it.
Bruce Momjian [Wed, 12 Oct 2005 13:41:08 +0000 (13:41 +0000)]
Rearrange:
< o %Add dumping of comments on composite type columns
< o %Add dumping of comments on index columns
< o Stop dumping CASCADE on DROP TYPE commands in clean mode
> o %Add dumping of comments on index columns and composite type columns 604a603
> o Stop dumping CASCADE on DROP TYPE commands in clean mode
Bruce Momjian [Wed, 12 Oct 2005 03:26:38 +0000 (03:26 +0000)]
Add description:
< * Prevent libpq's PQfnumber() from lowercasing the column name?
> * Prevent libpq's PQfnumber() from lowercasing the column name
>
> One idea is to lowercase all identifiers except those that are
> surrounded by quotes.
>
Bruce Momjian [Tue, 11 Oct 2005 23:55:10 +0000 (23:55 +0000)]
Add:
> o Allow selection of individual object(s) of all types, not just
> tables
> o In a selective dump, allow dumping of an object and all its
> dependencies
Tom Lane [Tue, 11 Oct 2005 20:41:32 +0000 (20:41 +0000)]
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.
Tom Lane [Tue, 11 Oct 2005 20:01:30 +0000 (20:01 +0000)]
Don't use a non-locked pre-test of the spinlock on x86_64 machines.
The pre-test has been shown to be a big loss on Opterons and at best a
wash on EM64T.
Tom Lane [Tue, 11 Oct 2005 17:27:14 +0000 (17:27 +0000)]
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.
Tom Lane [Tue, 11 Oct 2005 16:44:40 +0000 (16:44 +0000)]
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.
Tom Lane [Mon, 10 Oct 2005 22:29:48 +0000 (22:29 +0000)]
Remove the DELETEs from pg_shadow and pg_group that pg_dumpall used to
emit when given the --clean option, in favor of individual DROP ROLE
commands. The old technique could not possibly work in 8.1, and was
never a very good idea anyway IMHO. The DROP ROLE approach has the
defect that the DROPs will fail for roles that own objects or have
privileges, but perhaps we can improve that later.
Tom Lane [Mon, 10 Oct 2005 20:02:20 +0000 (20:02 +0000)]
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.
Tom Lane [Mon, 10 Oct 2005 18:49:04 +0000 (18:49 +0000)]
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.
Tom Lane [Sun, 9 Oct 2005 17:21:47 +0000 (17:21 +0000)]
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.
Tom Lane [Sat, 8 Oct 2005 19:32:58 +0000 (19:32 +0000)]
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
Tom Lane [Fri, 7 Oct 2005 19:59:34 +0000 (19:59 +0000)]
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.
Tom Lane [Fri, 7 Oct 2005 16:34:48 +0000 (16:34 +0000)]
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.
Tom Lane [Fri, 7 Oct 2005 15:34:17 +0000 (15:34 +0000)]
(Apologies for fat-fingering cvs commit command...) Should have read:
Remove unportable use of tfind/tsearch in favor of bsearch. Fix up
random number generator to use random() not rand() and to actually honor
its min/max arguments properly. That wasn't so important before, but
with exposure of capability to ask for general ranges, it will be.
Bruce Momjian [Fri, 7 Oct 2005 14:04:19 +0000 (14:04 +0000)]
Update:
< * Consider compressing indexes by storing key prefix values shared by
> * Consider compressing indexes by storing key values duplicated in 735a736,737
>
> This is difficult because it requires datatype-specific knowledge.
Tom Lane [Thu, 6 Oct 2005 22:43:16 +0000 (22:43 +0000)]
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.
Neil Conway [Thu, 6 Oct 2005 21:30:39 +0000 (21:30 +0000)]
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.
Tom Lane [Thu, 6 Oct 2005 19:51:16 +0000 (19:51 +0000)]
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.
Tom Lane [Thu, 6 Oct 2005 16:01:55 +0000 (16:01 +0000)]
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.
Tom Lane [Thu, 6 Oct 2005 02:29:23 +0000 (02:29 +0000)]
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.
Michael Meskes [Tue, 4 Oct 2005 13:28:21 +0000 (13:28 +0000)]
Somehow I missed some parser changes, so this commit comes pretty late. I just synced the parser of ecpg against the backend version, but still have to sync the lexer.
Also I fixed a bug in a bug fix I committed a few weeks ago. he check for a varchar pointer was incomplete.
Tom Lane [Mon, 3 Oct 2005 00:28:43 +0000 (00:28 +0000)]
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.
Tom Lane [Sun, 2 Oct 2005 23:50:16 +0000 (23:50 +0000)]
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).