Commit Graph

21538 Commits

Author SHA1 Message Date
Tom Lane da27c0a1ef Teach tid-scan code to make use of "ctid = ANY (array)" clauses, so that
"ctid IN (list)" will still work after we convert IN to ScalarArrayOpExpr.
Make some minor efficiency improvements while at it, such as ensuring that
multiple TIDs are fetched in physical heap order.  And fix EXPLAIN so that
it shows what's really going on for a TID scan.
2005-11-26 22:14:57 +00:00
Tom Lane a66e2c8885 Teach push_nots() how to negate a ScalarArrayOpExpr. In passing, save
a palloc or two in the OpExpr case.
2005-11-26 18:07:40 +00:00
Tom Lane 4c4eb57154 Some marginal additional hacking to shave a few more cycles off
heapgettup.
2005-11-26 05:03:06 +00:00
Tom Lane 70f1482de3 Change seqscan logic so that we check visibility of all tuples on a page
when we first read the page, rather than checking them one at a time.
This allows us to take and release the buffer content lock just once
per page, instead of once per tuple.  Since it's a shared lock the
contention penalty for holding the lock longer shouldn't be too bad.
We can safely do this only when using an MVCC snapshot; else the
assumption that visibility won't change over time is uncool.  Therefore
there are now two code paths depending on the snapshot type.  I also
made the same change in nodeBitmapHeapscan.c, where it can be done always
because we only support MVCC snapshots for bitmap scans anyway.
Also make some incidental cleanups in the APIs of these functions.
Per a suggestion from Qingqing Zhou.
2005-11-26 03:03:07 +00:00
Tom Lane 290166f934 Teach planner and executor to handle ScalarArrayOpExpr as an indexable
qualification when the underlying operator is indexable and useOr is true.
That is, indexkey op ANY (ARRAY[...]) is effectively translated into an
OR combination of one indexscan for each array element.  This only works
for bitmap index scans, of course, since regular indexscans no longer
support OR'ing of scans.  There are still some loose ends to clean up
before changing 'x IN (list)' to translate as a ScalarArrayOpExpr;
for instance predtest.c ought to be taught about it.  But this gets the
basic functionality in place.
2005-11-25 19:47:50 +00:00
Tom Lane dab52ab13d Improve ExecStoreTuple to be smarter about replacing the contents of
a TupleTableSlot: instead of calling ExecClearTuple, inline the needed
operations, so that we can avoid redundant steps.  In particular, when
the old and new tuples are both on the same disk page, avoid releasing
and re-acquiring the buffer pin --- this saves work in both the bufmgr
and ResourceOwner modules.  To make this improvement actually useful,
partially revert a change I made on 2004-04-21 that caused SeqNext
et al to call ExecClearTuple before ExecStoreTuple.  The motivation
for that, to avoid grabbing the BufMgrLock separately for releasing
the old buffer and grabbing the new one, no longer applies.  My
profiling says that this saves about 5% of the CPU time for an
all-in-memory seqscan.
2005-11-25 04:24:48 +00:00
Bruce Momjian c0a2f8cc4d Add space. 2005-11-24 04:40:27 +00:00
Bruce Momjian 3f69c4193f Add item:
<
> 	o Add -f to pg_dumpall
2005-11-24 04:28:40 +00:00
Tom Lane 4dd2048a47 Get rid of ExecAssignResultTypeFromOuterPlan() and make all plan node types
generate their output tuple descriptors from their target lists (ie, using
ExecAssignResultTypeFromTL()).  We long ago fixed things so that all node
types have minimally valid tlists, so there's no longer any good reason to
have two different ways of doing it.  This change is needed to fix bug
reported by Hayden James: the fix of 2005-11-03 to emit the correct column
names after optimizing away a SubqueryScan node didn't work if the new
top-level plan node used ExecAssignResultTypeFromOuterPlan to generate its
tupdesc, since the next plan node down won't have the correct column labels.
2005-11-23 20:27:58 +00:00
Tom Lane 19ff959bff Fix problems with rewriter failing to set Query.hasSubLinks when inserting
a SubLink expression into a rule query.  Pre-8.1 we essentially did this
unconditionally; 8.1 tries to do it only when needed, but was missing a
couple of cases.  Per report from Kyle Bateman.  Add some regression test
cases covering this area.
2005-11-23 17:21:04 +00:00
Tatsuo Ishii baa6b22fcb Having blank lines in -f scripts was causing silent failures.
per David Fetter
2005-11-23 12:19:12 +00:00
Bruce Momjian aac96b8994 Fix pgindent of libpq-fe.h by hacking pgindent script.
Remove pgbench comment that was causing problems.
2005-11-23 04:23:30 +00:00
Bruce Momjian ce1d8293f0 Done:
> 	o -Allow NULLs in arrays
2005-11-22 23:22:38 +00:00
Bruce Momjian c28c00ecc8 Add:
>
> * Add estimated_count(*) to return an estimate of COUNT(*)
>
>   This would use the planner ANALYZE statistatics to return an estimated
>   count.
2005-11-22 23:06:56 +00:00
Tom Lane e96925fba7 Fix up comment munged by pg_indent. (Not pg_indent's fault; should have
protected comment with dashes the first time round.)
2005-11-22 22:30:33 +00:00
Bruce Momjian 436a2956d8 Re-run pgindent, fixing a problem where comment lines after a blank
comment line where output as too long, and update typedefs for /lib
directory.  Also fix case where identifiers were used as variable names
in the backend, but as typedefs in ecpg (favor the backend for
indenting).

Backpatch to 8.1.X.
2005-11-22 18:17:34 +00:00
Bruce Momjian e196eedd8a Update most recent version number. 2005-11-22 16:27:00 +00:00
Bruce Momjian b621efbbb8 Update wording and cleanup for new items. 2005-11-22 15:31:23 +00:00
Andrew Dunstan 5b352d8e12 DROP DATABASE IF EXISTS variant 2005-11-22 15:24:18 +00:00
Bruce Momjian 179211a683 Markup TODO as a URL. 2005-11-22 15:21:54 +00:00
Bruce Momjian d2f568dc6c Fix markup italics problem. 2005-11-22 15:17:57 +00:00
Bruce Momjian 2a69a0e147 Update item tags. 2005-11-22 15:17:06 +00:00
Bruce Momjian 508f96f529 Change to using "id=" HTML tags instead of "name=" tags. 2005-11-22 15:13:02 +00:00
Bruce Momjian 1ab96739be Update FAQ to explain process of submitting bug and feature requests. 2005-11-22 15:04:25 +00:00
Teodor Sigaev 3c6cd8a113 Fixes motivated by snake and spoonbill pgbuildfarm members 2005-11-22 09:01:35 +00:00
Bruce Momjian 725ace44f9 Reorder "who controls PostgreSQL" to near the top. 2005-11-21 21:01:16 +00:00
Bruce Momjian afae55720c Reorder version FAQ item to be right after "how do I get the software". 2005-11-21 20:54:26 +00:00
Bruce Momjian ba14edbd5c Clarify copyright wording. 2005-11-21 20:51:39 +00:00
Bruce Momjian d253c79a52 Reorder bug items. 2005-11-21 20:44:11 +00:00
Teodor Sigaev 62699337bc remove forgotten // comments 2005-11-21 18:00:52 +00:00
Alvaro Herrera cec3b0a9e6 Implement DROP OWNED and REASSIGN OWNED. These new commands facilitate the
process of dropping roles by dropping objects owned by them and privileges
granted to them, or giving the owned objects to someone else, through the
use of the data stored in the new pg_shdepend catalog.

Some refactoring of the GRANT/REVOKE code was needed, as well as ALTER OWNER
code.  Further cleanup of code duplication in the GRANT code seems necessary.

Implemented by me after an idea from Tom Lane, who also provided various kind
of implementation advice.

Regression tests pass.  Some tests for the new functionality are also added,
as well as rudimentary documentation.
2005-11-21 12:49:33 +00:00
Teodor Sigaev c52795d18a Text parser rewritten:
- supports multibyte encodings
        - more strict rules for lexemes
        - flex isn't used
Add:
        - tsquery plainto_tsquery(text)
          Function makes tsquery from plain text.
        - &&, ||, !! operation for tsquery for combining
          tsquery from it's parts:  'foo & bar' || 'asd' => 'foo & bar | asd'
2005-11-21 12:27:57 +00:00
Tom Lane b91e6ed93e Clean up after DROP IF EXISTS patch. 2005-11-20 23:24:12 +00:00
Tom Lane dd218ae7b0 Remove the t_datamcxt field of HeapTupleData. This was introduced for
the convenience of tuptoaster.c and is no longer needed, so may as well
get rid of some small amount of overhead.
2005-11-20 19:49:08 +00:00
Tom Lane 40314f2dac Modify tuptoaster's API so that it does not try to modify the passed
tuple in-place, but instead passes back an all-new tuple structure if
any changes are needed.  This is a much cleaner and more robust solution
for the bug discovered by Alexey Beschiokov; accordingly, revert the
quick hack I installed yesterday.
With this change, HeapTupleData.t_datamcxt is no longer needed; will
remove it in a separate commit in HEAD only.
2005-11-20 18:38:20 +00:00
Tom Lane 33a9af738d Stopgap solution for problem reported by Alexey Beschiokov: after
doing heap_insert or heap_update, wipe out any extracted fields in
the TupleTableSlot containing the tuple, because they might not be valid
anymore if tuptoaster.c changed the tuple.  Safe because slot must be
in the materialized state, but mighty ugly --- find a better answer!
2005-11-19 20:57:44 +00:00
Tom Lane 659f681638 Change array comparison rules to consider dimensionality information,
not only the array contents, before claiming two arrays are equal.
Per recent discussion.
2005-11-19 19:44:55 +00:00
Andrew Dunstan daea4d8eae DROP objecttype IF EXISTS for the following objects:
table view index sequence schema type domain conversion
2005-11-19 17:39:45 +00:00
Tom Lane 8ef289dba1 Defend against nulls-in-arrays in contrib/intarray. I may have put in
more tests than strictly necessary, but did not feel like tracing call
paths in detail ...
2005-11-19 03:00:09 +00:00
Tom Lane 25c00833cb Add defenses against nulls-in-arrays to contrib/ltree. Possibly it'd
be useful to actually do something with nulls, rather than reject them,
but I'll just close the hole for now.
2005-11-19 02:08:45 +00:00
Tom Lane 1e9a1a70ad Change array_push and array_cat so that they retain the lower bound of
the array (for array_push) or higher-dimensional array (for array_cat)
rather than decrementing it as before.  This avoids generating lower
bounds other than one for any array operation within the SQL spec.  Per
recent discussion.
Interestingly, this seems to have been the original behavior, because
while updating the docs I noticed that a large fraction of relevant
examples were *wrong* for the old behavior and are now right.  Is it
worth correcting this in the back-branch docs?
2005-11-19 01:50:08 +00:00
Tom Lane 8685c47223 Fix performance issue in exprTypmod(): for a COALESCE expression, it
recursed twice on its first argument, leading to exponential time spent
on a deep nest of COALESCEs ... such as a deeply nested FULL JOIN would
produce.  Per report from Matt Carter.
2005-11-18 23:08:00 +00:00
Andrew Dunstan b410475672 translate undef to NULL for result arrayref, now that we allow NULLs in arrays. Update plperl regression test accordingly. 2005-11-18 17:00:28 +00:00
Alvaro Herrera 33e9f2c3d4 Add tab completion for RESET SESSION AUTHORIZATION. 2005-11-18 16:31:11 +00:00
Neil Conway 7871b7defc Update obsolete comment describing ExecDelete(), per Simon Riggs. 2005-11-18 12:26:20 +00:00
Tom Lane 1d0d8d3c38 Mop-up for nulls-in-arrays patch: fix some places that access array
contents directly.
2005-11-18 02:38:24 +00:00
Bruce Momjian 3201b7f3d0 Update Japanese FAQ.
J.Kuwamura
2005-11-18 00:40:46 +00:00
Andrew Dunstan b7a9e3ceb4 make psql honor explicit database parameter in -l mode, in case "postgres" database is missing - per complaint from Philip Yarra. 2005-11-17 23:42:26 +00:00
Tom Lane cecb607559 Make SQL arrays support null elements. This commit fixes the core array
functionality, but I still need to make another pass looking at places
that incidentally use arrays (such as ACL manipulation) to make sure they
are null-safe.  Contrib needs work too.
I have not changed the behaviors that are still under discussion about
array comparison and what to do with lower bounds.
2005-11-17 22:14:56 +00:00
Tom Lane c859308aba DropRelFileNodeBuffers failed to fix the state of the lookup hash table
that was added to localbuf.c in 8.1; therefore, applying it to a temp table
left corrupt lookup state in memory.  The only case where this had a
significant chance of causing problems was an ON COMMIT DELETE ROWS temp
table; the other possible paths left bogus state that was unlikely to
be used again.  Per report from Csaba Nagy.
2005-11-17 17:42:02 +00:00