Tom Lane [Thu, 19 Feb 2004 19:40:09 +0000 (19:40 +0000)]
Re-implement psql's input scanning to use a flex-generated lexer, as per
recent discussion. The lexer is used for both SQL command text and
backslash commands. The purpose of this change is to make it easier to
track the behavior of the backend's SQL lexer --- essentially identical
flex rules are now used by psql. Also, this cleans up a lot of very
squirrelly code in mainloop.c and command.c. The flex code is somewhat
bulkier than the removed code, but should be lots easier to maintain.
Neil Conway [Wed, 18 Feb 2004 00:01:34 +0000 (00:01 +0000)]
Improve the consistency of the error message emitted when rejecting
invalid input to the oid type. Also, remove some long-unused code
from adt/numutils.c
Neil Conway [Tue, 17 Feb 2004 06:28:05 +0000 (06:28 +0000)]
Significant improvements to the documentation for the new cost-based
vacuum delay feature, including updating the docs for Tom's recent
improvements. There is still more work to be done here: for example,
adding some more information on the practical use of cost-based
vacuum delay to the "maintenance" section would probably be a good
idea.
Bruce Momjian [Tue, 17 Feb 2004 03:54:57 +0000 (03:54 +0000)]
This patch brings up to date what I did last year (now unfortunately
bitrotted) to allow the logging of the end of a session, enabled by
the config setting "log_disconnections".
Bruce Momjian [Tue, 17 Feb 2004 03:45:17 +0000 (03:45 +0000)]
Here is an updated version of the win32 readdir patch.
1) Now puts in exactly the same change as the current-cvs mingw code
does. (see
http://cvs.sourceforge.net/viewcvs.py/mingw/runtime/mingwex/dirent.c?r1=
1.3&r2=1.4, second part of the patch).
2) Updates both xlog.c and slru.c in backend/access/transam/
3) Also updates pg_resetxlog, which also uses readdir() and checks the
errno value after the loop.
Bruce Momjian [Tue, 17 Feb 2004 03:35:57 +0000 (03:35 +0000)]
Under Win32, stat() returns an st_ino field, but it has no meaning (on
Win2K, and possibly all Win32 variants, it is always 0). This causes a
number of problems in the dfmgr.c logic, which basically all revolve
around the fact that *any* two files will appear to have the same inode.
Bruce Momjian [Tue, 17 Feb 2004 03:34:35 +0000 (03:34 +0000)]
Please apply this patch to contrib/dbmirror
In incorperates changes from myself and a number of contributors.
This update to dbmirror provides:
-replication of sequence operations via setval/nextval
-DBMirror.pl support for logging to syslog
-changed the names of the tables to dbmirror_* (no quotes required)
-Support for writitng SQL statements to files instead of directly to
a slave database
-More options for DBMirror.pl in the config files.
Tom Lane [Tue, 17 Feb 2004 00:52:53 +0000 (00:52 +0000)]
Make use of statistics on index expressions. There are still some
corner cases that could stand improvement, but it does all the basic
stuff. A byproduct is that the selectivity routines are no longer
constrained to working on simple Vars; we might in future be able to
improve the behavior for subexpressions that don't match indexes.
Michael Meskes [Mon, 16 Feb 2004 07:41:54 +0000 (07:41 +0000)]
- Cleaned up parser a little bit. It does not make sense to allow a
typename to be typedef'ed that cannot be parsed as variable type.
- Allowed some SQL keywords to be used as C variable names.
Tom Lane [Sun, 15 Feb 2004 21:01:39 +0000 (21:01 +0000)]
First steps towards statistics on expressional (nee functional) indexes.
This commit teaches ANALYZE to store such stats in pg_statistic, but
nothing is done yet about teaching the planner to use 'em.
Also, repair longstanding oversight in separate ANALYZE command: it
updated the pg_class.relpages and reltuples counts for the table proper,
but not for indexes.
Tom Lane [Sat, 14 Feb 2004 20:16:18 +0000 (20:16 +0000)]
Create crosstype comparison operators for date vs. timestamp and date
vs. timestamptz. This allows use of indexes for expressions like
datecol >= date 'today' - interval '1 month'
which were formerly not indexable without casting the righthand side
down from timestamp to date.
Tom Lane [Fri, 13 Feb 2004 22:26:30 +0000 (22:26 +0000)]
Repair optimization bug I introduced in a moment of brain fade back in
Nov 2002: when constant-expression simplification removes all the
aggregate function calls from a query, that doesn't mean we can act as
though there never were any aggregates. Per bug report from Gabor Szucs.
Tom Lane [Fri, 13 Feb 2004 06:39:49 +0000 (06:39 +0000)]
After further thought about support for gathering stats on functional
indexes, it seems like we ought to put another layer of indirection
between the compute_stats functions and the actual data storage. This
would allow us to compute the values on-the-fly, for example.
Bruce Momjian [Fri, 13 Feb 2004 04:40:06 +0000 (04:40 +0000)]
Tom Lane wrote:
> momjian@svr1.postgresql.org (Bruce Momjian) writes:
>> someone asked me about the FK deadlock fix, mentioned in the 7.3.3
>> release notes as 3rd change:
>> http://www.postgresql.org/docs/current/static/release-7-3-3.html
>> Actually, that fix was available with 7.4, not 7.3. Don't know if we can
>> retroactively change the release-notes though.
>
> This is completely erroneous, please undo it.
>
> 2003-05-21 14:14 tgl
>
> * src/: backend/utils/adt/ri_triggers.c,
> test/regress/expected/foreign_key.out (REL7_3_STABLE): Back-patch
> Jan's fix to avoid primary key lookup (and lock) if foreign key
> does not change on UPDATE.
Oh ... didn't know that you did a backpatch. Sorry
Tom Lane [Thu, 12 Feb 2004 23:41:04 +0000 (23:41 +0000)]
Add hooks for type-specific calculation of ANALYZE statistics. Idea and
coding by Mark Cave-Ayland, some kibitzing by Tom Lane. initdb forced
due to new column in pg_type.
Bruce Momjian [Thu, 12 Feb 2004 18:09:43 +0000 (18:09 +0000)]
File not needed:
.< * Improve speed with indexes (perhaps recreate index instead) [vacuum]
> * Improve speed with indexes (perhaps recreate index instead) 369c369
< lock and truncate table [vacuum]
> lock and truncate table 371c371
< rather than in /contrib [vacuum]
> rather than in /contrib
Bruce Momjian [Thu, 12 Feb 2004 16:38:04 +0000 (16:38 +0000)]
Fix typo:
On Mon, 2004-01-26 at 21:28, Peter Eisentraut wrote:
> Christophe Combelles wrote:
> > At the bottom of this doc file :
> > file:///usr/share/doc/postgresql-doc/html/tutorial-createdb.html
> > "and it also happens that that user always has permission"
> > ---- x2
> The first "that" serves as a conjuction, the second one serves as an
> article. Looks correct to me.
A better workaround for the sentence would be something like:
"and it also happens that the user always has permission"
Jan Wieck [Thu, 12 Feb 2004 15:06:56 +0000 (15:06 +0000)]
Fixed bug where FlushRelationBuffers() did call StrategyInvalidateBuffer()
for already empty buffers because their buffer tag was not cleard out
when the buffers have been invalidated before.
Also removed the misnamed BM_FREE bufhdr flag and replaced the checks,
which effectively ask if the buffer is unpinned, with checks against the
refcount field.
Tom Lane [Wed, 11 Feb 2004 22:55:26 +0000 (22:55 +0000)]
Commit the reasonably uncontroversial parts of J.R. Nield's PITR patch, to
wit: Add a header record to each WAL segment file so that it can be reliably
identified. Avoid splitting WAL records across segment files (this is not
strictly necessary, but makes it simpler to incorporate the header records).
Make WAL entries for file creation, deletion, and truncation (as foreseen but
never implemented by Vadim). Also, add support for making XLOG_SEG_SIZE
configurable at compile time, similarly to BLCKSZ. Fix a couple bugs I
introduced in WAL replay during recent smgr API changes. initdb is forced
due to changes in pg_control contents.
Tom Lane [Wed, 11 Feb 2004 22:25:02 +0000 (22:25 +0000)]
Repair some problems in bgwriter start/stop logic. In particular, don't
allow the bgwriter to start before the startup subprocess has finished
... it tends to crash otherwise. (The same problem may have existed for
the checkpointer, I'm not entirely sure.) Remove some code that was
redundant because the bgwriter is handled as a member of the backend list.
Tom Lane [Tue, 10 Feb 2004 03:42:45 +0000 (03:42 +0000)]
Centralize implementation of delay code by creating a pg_usleep()
subroutine in src/port/pgsleep.c. Remove platform dependencies from
miscadmin.h and put them in port.h where they belong. Extend recent
vacuum cost-based-delay patch to apply to VACUUM FULL, ANALYZE, and
non-btree index vacuuming.
By the way, where is the documentation for the cost-based-delay patch?
Tom Lane [Tue, 10 Feb 2004 01:55:27 +0000 (01:55 +0000)]
Restructure smgr API as per recent proposal. smgr no longer depends on
the relcache, and so the notion of 'blind write' is gone. This should
improve efficiency in bgwriter and background checkpoint processes.
Internal restructuring in md.c to remove the not-very-useful array of
MdfdVec objects --- might as well just use pointers.
Also remove the long-dead 'persistent main memory' storage manager (mm.c),
since it seems quite unlikely to ever get resurrected.
Neil Conway [Wed, 4 Feb 2004 01:11:47 +0000 (01:11 +0000)]
Use memmove() rather than memcpy() in set_var_from_var(). If this function
is asked to assign a variable to itself, it will result in doing a
memcpy() on an entirely-overlapping memory range, which results in
undefined behavior according to ANSI C. That said, it is unlikely to
actually do anything bad on any sane libc, but this keeps valgrind quiet.
Tom Lane [Tue, 3 Feb 2004 17:34:04 +0000 (17:34 +0000)]
Rename SortMem and VacuumMem to work_mem and maintenance_work_mem.
Make btree index creation and initial validation of foreign-key constraints
use maintenance_work_mem rather than work_mem as their memory limit.
Add some code to guc.c to allow these variables to be referenced by their
old names in SHOW and SET commands, for backwards compatibility.
Joe Conway [Tue, 3 Feb 2004 08:29:57 +0000 (08:29 +0000)]
Add function (actually an int4 and an int8 version) that generates
a series of numbers, optionally using an explicit step size other
than the default value (one). Use function in the information_schema
to replace hard-wired knowledge of INDEX_MAX_KEYS. initdb forced due
to pg_proc change. Documentation update still needed -- will be
committed separately.