Commit Graph

1215 Commits

Author SHA1 Message Date
Jan Wieck cfeca62148 Background writer process
This first part of the background writer does no syncing at all.
It's only purpose is to keep the LRU heads clean so that regular
backends seldom to never have to call write().

Jan
2003-11-19 15:55:08 +00:00
Jan Wieck 6b86d62b00 2nd try for the ARC strategy.
I added a couple more Assertions while tracking down the exact
cause of the former bug.

All 93 regression tests pass now.

Jan
2003-11-13 14:57:15 +00:00
Jan Wieck 923e994d79 ARC strategy backed out ... sorry
Jan
2003-11-13 05:34:58 +00:00
Jan Wieck 48adc0b34b Replacement of the buffer replacement strategy with an ARC
algorithm adopted for PostgreSQL.

Jan
2003-11-13 00:40:02 +00:00
Tom Lane fa5c8a055a Cross-data-type comparisons are now indexable by btrees, pursuant to my
pghackers proposal of 8-Nov.  All the existing cross-type comparison
operators (int2/int4/int8 and float4/float8) have appropriate support.
The original proposal of storing the right-hand-side datatype as part of
the primary key for pg_amop and pg_amproc got modified a bit in the event;
it is easier to store zero as the 'default' case and only store a nonzero
when the operator is actually cross-type.  Along the way, remove the
long-since-defunct bigbox_ops operator class.
2003-11-12 21:15:59 +00:00
Tom Lane c1d62bfd00 Add operator strategy and comparison-value datatype fields to ScanKey.
Remove the 'strategy map' code, which was a large amount of mechanism
that no longer had any use except reverse-mapping from procedure OID to
strategy number.  Passing the strategy number to the index AM in the
first place is simpler and faster.
This is a preliminary step in planned support for cross-datatype index
operations.  I'm committing it now since the ScanKeyEntryInitialize()
API change touches quite a lot of files, and I want to commit those
changes before the tree drifts under me.
2003-11-09 21:30:38 +00:00
Peter Eisentraut 96889392e9 Implement isolation levels read uncommitted and repeatable read as acting
like the next higher one.
2003-11-06 22:08:15 +00:00
Tom Lane c02036b1d8 Simplify loop test to avoid bug in AIX compiler, per Andreas. 2003-10-18 15:38:06 +00:00
Tom Lane fe1b5034dd Adjust display of actual runtimes in EXPLAIN output to use three fractional
digits, and label it 'ms' not 'msec', for consistency with psql's \timing
display.  Per recent discussions.
2003-10-17 01:14:26 +00:00
Tom Lane 90b2202975 Fix bad interaction between NOTIFY processing and V3 extended query
protocol, per report from Igor Shevchenko.  NOTIFY thought it could
do its thing if transaction blockState is TBLOCK_DEFAULT, but in
reality it had better check the low-level transaction state is
TRANS_DEFAULT as well.  Formerly it was not possible to wait for the
client in a state where the first is true and the second is not ...
but now we can have such a state.  Minor cleanup in StartTransaction()
as well.
2003-10-16 16:50:41 +00:00
Bruce Momjian 4a39057e59 Back out makeNode() patch to fix gcc 3.3.1 warning. 2003-10-13 22:47:15 +00:00
Tom Lane e7261c46aa Adjust setRelhassubclassInRelation() to not perform actual heap_update
when the pg_class.relhassubclass value is already correct.  This should
avoid most cases of the 'tuple concurrently updated' problem that
Robert Creager recently complained about.  Also remove a bunch of dead
code in StoreCatalogInheritance() --- it was still computing the complete
list of direct and indirect inheritance ancestors, though that list has
not been needed since we got rid of the pg_ipl catalog.
2003-10-13 20:02:52 +00:00
Bruce Momjian 4a2c34d4a0 Use makeNode() to allocate structures that have to be cast to Node *,
rather than allocating them on the stack.

Fixes complaint from gcc 3.3.1.
2003-10-12 23:19:21 +00:00
Bruce Momjian 7fb9893f42 Back out -fstrict-aliasing void* casting. 2003-10-11 18:04:26 +00:00
Bruce Momjian d51368dbbd This patch will stop gcc from issuing warnings about type-punned objects
when -fstrict-aliasing is turned on, as it is in the latest gcc when you
use -O2

Andrew Dunstan
2003-10-11 16:30:55 +00:00
Tom Lane fec58f6c3f During ALTER TABLE ADD FOREIGN KEY, try to check the existing rows using
a single LEFT JOIN query instead of firing the check trigger for each
row individually.  Stephan Szabo, with some kibitzing from Tom Lane and
Jan Wieck.
2003-10-06 16:38:28 +00:00
Tom Lane 0eceaaf9b7 Modify COPY FROM to match the null-value string against the column value
before it is de-backslashed, not after.  This allows the null string \N
to be reliably distinguished from the data value \N (which must be
represented as \\N).  Per bug report from Manfred Koizar ... but it's
amazing this hasn't been reported before ...
Also, be consistent about encoding conversion for null string: the form
specified in the command is in the server encoding, but what is sent
to/from client must be in client encoding.  This never worked quite
right before either.
2003-10-06 02:38:53 +00:00
Tom Lane 19c90bcc25 Add a bit more locking to vac_update_relstats and vac_update_dbstats
to make them comparable to what UpdateStats does in the same situation.
I'm not certain two instances of vac_update_relstats could run in
parallel for the same relation, but parallel invocations of vac_update_dbstats
do seem possible.
2003-10-02 23:19:44 +00:00
Peter Eisentraut 14528ffe6b String fixes/improvements found by Alvaro Herrera 2003-10-02 06:36:37 +00:00
Peter Eisentraut e78b0079a2 Change some notices to warnings and vice versa according to criteria
developed on -hackers.
2003-10-02 06:34:04 +00:00
Tom Lane 55d85f42a8 Repair RI trigger visibility problems (this time for sure ;-)) per recent
discussion on pgsql-hackers: in READ COMMITTED mode we just have to force
a QuerySnapshot update in the trigger, but in SERIALIZABLE mode we have
to run the scan under a current snapshot and then complain if any rows
would be updated/deleted that are not visible in the transaction snapshot.
2003-10-01 21:30:53 +00:00
Tom Lane 0e319c7ad7 Improve context display for failures during COPY IN, as recently
discussed on pghackers.
2003-09-29 22:06:40 +00:00
Peter Eisentraut 2d480b92cf Eliminate another gratuitous message wording difference. 2003-09-29 16:37:29 +00:00
Peter Eisentraut 7438af96fa More message editing, some suggested by Alvaro Herrera 2003-09-29 00:05:25 +00:00
Peter Eisentraut d84b6ef56b Various message fixes, among those fixes for the previous round of fixes 2003-09-26 15:27:37 +00:00
Tom Lane c63a5452d8 Get rid of ReferentialIntegritySnapshotOverride by extending Executor API
to allow es_snapshot to be set to SnapshotNow rather than a query snapshot.
This solves a bug reported by Wade Klaver, wherein triggers fired as a
result of RI cascade updates could misbehave.
2003-09-25 18:58:36 +00:00
Peter Eisentraut feb4f44d29 Message editing: remove gratuitous variations in message wording, standardize
terms, add some clarifications, fix some untranslatable attempts at dynamic
message building.
2003-09-25 06:58:07 +00:00
Tom Lane a56a016ceb Repair some REINDEX problems per recent discussions. The relcache is
now able to cope with assigning new relfilenode values to nailed-in-cache
indexes, so they can be reindexed using the fully crash-safe method.  This
leaves only shared system indexes as special cases.  Remove the 'index
deactivation' code, since it provides no useful protection in the shared-
index case.  Require reindexing of shared indexes to be done in standalone
mode, but remove other restrictions on REINDEX.  -P (IgnoreSystemIndexes)
now prevents using indexes for lookups, but does not disable index updates.
It is therefore safe to allow from PGOPTIONS.  Upshot: reindexing system catalogs
can be done without a standalone backend for all cases except
shared catalogs.
2003-09-24 18:54:02 +00:00
Hiroshi Inoue f5c5c3c6f7 Putting back the previous change must be the first thing.
ALso put back a #ifndef ENABLE_REINDEX_NAILED_RELATIONS
which was removed about a year ago.
2003-09-23 01:51:09 +00:00
Tom Lane a13b018530 Disallow foreign-key references from temp tables to permanent tables.
Per recent discussion, this does not work because other backends can't
reliably see tuples in a temp table and so cannot run the RI checks
correctly.  Seems better to disallow this case than go back to accessing
temp tables through shared buffers.  Also, disallow FK references to
ON COMMIT DELETE ROWS tables.  We already caught this problem for normal
TRUNCATE, but the path used by ON COMMIT didn't check.
2003-09-19 21:04:20 +00:00
Tom Lane 28847ae77d Seems like a bad idea that REINDEX TABLE supports (or thinks it does)
reindexing system tables without ignoring system indexes, when the
other two varieties of REINDEX disallow it.  Make all three act the same,
and simplify downstream code accordingly.
2003-09-19 19:57:42 +00:00
Tom Lane db18703b5a Fix LISTEN/NOTIFY race condition reported by Gavin Sherry. While a
really general fix might be difficult, I believe the only case where
AtCommit_Notify could see an uncommitted tuple is where the other guy
has just unlistened and not yet committed.  The best solution seems to
be to just skip updating that tuple, on the assumption that the other
guy does not want to hear about the notification anyway.  This is not
perfect --- if the other guy rolls back his unlisten instead of committing,
then he really should have gotten this notify.  But to do that, we'd have
to wait to see if he commits or not, or make UNLISTEN hold exclusive lock
on pg_listener until commit.  Either of these answers is deadlock-prone,
not to mention horrible for interactive performance.  Do it this way
for now.  (What happened to that project to do LISTEN/NOTIFY in memory
with no table, anyway?)
2003-09-15 23:33:43 +00:00
Peter Eisentraut a07c5a1225 Remove warnings for operations that have no effect when executed repeatedly. 2003-09-15 00:26:31 +00:00
Tom Lane 8ff2005c67 Message in the other exit from acquire_sample_rows(), as per update
from Mark Kirkwood.  Also show the sample size.
2003-09-11 23:12:31 +00:00
Tom Lane 47c7f9ef1c Try to make recently-added analyze log message look something like
the others in style.
2003-09-11 22:59:28 +00:00
Tom Lane fdd93470fa Fix missed message update, per Alvaro Herrera. 2003-09-11 02:40:13 +00:00
Tom Lane 9cb4a28f47 Improve error message for cp or rm failur during create/drop database,
per recent discussions.
2003-09-10 20:24:09 +00:00
Bruce Momjian d16b877612 Add HINT if CREATE FUNCTION specifies a valid language, but the language
isn't loaded into the database.
2003-09-10 19:59:23 +00:00
Peter Eisentraut 33d4c828fd Some "feature not supported" errors are better syntax errors, because the
feature they complain about isn't a feature or cannot be implemented without
definitional changes.
2003-09-09 23:22:21 +00:00
Bruce Momjian 5a288903b9 Guard against pgindent changing =- to = -. 2003-08-30 14:59:34 +00:00
Tom Lane ce2ab4131a Fix stupid typo (mine I suppose) in CopyGetData. Per report from Dave Cramer. 2003-08-28 13:52:34 +00:00
Bruce Momjian cd0f42e87c Attached is a (very small) patch to make analyze display some
interesting info in verbose mode about the analyzed relation (pages,
rows per block and rows).

Mark Kirkwood
2003-08-26 15:38:42 +00:00
Peter Eisentraut 693aad413b Change warnings for non-existing or pre-existing cursors to errors. 2003-08-24 21:02:43 +00:00
Tom Lane ec646dbc65 Create a 'type cache' that keeps track of the data needed for any particular
datatype by array_eq and array_cmp; use this to solve problems with memory
leaks in array indexing support.  The parser's equality_oper and ordering_oper
routines also use the cache.  Change the operator search algorithms to look
for appropriate btree or hash index opclasses, instead of assuming operators
named '<' or '=' have the right semantics.  (ORDER BY ASC/DESC now also look
at opclasses, instead of assuming '<' and '>' are the right things.)  Add
several more index opclasses so that there is no regression in functionality
for base datatypes.  initdb forced due to catalog additions.
2003-08-17 19:58:06 +00:00
Tom Lane c01641f8ae libpq failed to cope with COPY FROM STDIN if the command was issued
via extended query protocol, because it sends Sync right after Execute
without realizing that the command to be executed is COPY.  There seems
to be no reasonable way for it to realize that, either, so the best fix
seems to be to make the backend ignore Sync during copy-in mode.  Bit of
a wart on the protocol, but little alternative.  Also, libpq must send
another Sync after terminating the COPY, if the command was issued via
Execute.
2003-08-13 18:56:21 +00:00
Tom Lane 88381ade63 Code cleanup inspired by recent resname bug report (doesn't fix the bug
yet, though).  Avoid using nth() to fetch tlist entries; provide a
common routine get_tle_by_resno() to search a tlist for a particular
resno.  This replaces a couple uses of nth() and a dozen hand-coded
search loops.  Also, replace a few uses of nth(length-1, list) with
llast().
2003-08-11 20:46:47 +00:00
Bruce Momjian 46785776c4 Another pgindent run with updated typedefs. 2003-08-08 21:42:59 +00:00
Tom Lane 338aa57be0 Rename fields of DestReceiver to avoid collisions with (ill-considered)
macros in some platforms' sys/socket.h.
2003-08-06 17:46:46 +00:00
Tom Lane 2f9c859ea1 Fix some copyright notices that weren't updated. Improve copyright tool
so it won't miss 'em again.
2003-08-04 23:59:41 +00:00
Bruce Momjian f3c3deb7d0 Update copyrights to 2003. 2003-08-04 02:40:20 +00:00