Bruce Momjian [Mon, 26 Apr 2004 15:24:42 +0000 (15:24 +0000)]
Please find attached a small patch against current cvs head, so that
'information_schema' is considered a system schema by various
pg_stat*_*_{tables,sequences} views.
Bruce Momjian [Mon, 26 Apr 2004 15:06:49 +0000 (15:06 +0000)]
Please find a attached a small patch that adds accessor functions
for "aclitem" so that it is not an opaque datatype.
I needed these functions to browse aclitems from user land. I can load
them when necessary, but it seems to me that these accessors for a
backend type belong to the backend, so I submit them.
Neil Conway [Sun, 25 Apr 2004 23:50:58 +0000 (23:50 +0000)]
Tiny assorted fixes: correct a typo in a comment in vacuumlazy.c, remove
some unused #include directives from bufmgr.c, and clarify comments in
bufmgr.h and buf.h
Neil Conway [Sat, 24 Apr 2004 22:53:44 +0000 (22:53 +0000)]
Document that PQoidValue(), PQcmdTuples(), and PQoidStatus() now work
when the command that generated the PGresult was an EXECUTE of an
appropriate prepared statement.
Neil Conway [Fri, 23 Apr 2004 20:32:20 +0000 (20:32 +0000)]
Add ceiling() as an alias for ceil(), and power() as an alias for pow().
Regression tests and documentation have both been updated.
SQL2003 requires that both ceiling() and ceil() be present, so I have
documented both spellings. SQL2003 doesn't mention pow() as far as I
can see, so I decided to replace pow() with power() in the documentation:
there is little reason to encourage the continued usage of a function
that isn't compliant with the standard, given a standard-compliant
alternative.
RELEASE NOTES: should state that pow() is considered deprecated
(although I don't see the need to ever remove it.)
Bruce Momjian [Thu, 22 Apr 2004 03:48:38 +0000 (03:48 +0000)]
Attached is are a few small fixes for dbmirror.
1. Fixed bug where sequences were being mirrored incorrectly if they
exceeded 127
2. Fixed a bug in the perl script with mirroring sequences(John
Burtenshaw sent an email to patches describing the bug in March but I
htink he forgot to attach his patch)
3. The dates/times in the transaction files will always use 2 digits.
Bruce Momjian [Thu, 22 Apr 2004 02:58:21 +0000 (02:58 +0000)]
This patch makes the EXECUTE command's completion tag return the
completion tag of the actual statement executed. This allows the
correct update count to be returned for UPDATE/INSERT/DELETE
statements.
Bruce Momjian [Thu, 22 Apr 2004 02:39:10 +0000 (02:39 +0000)]
Please find attached a small patch so that "pg_restore" ignores some sql
errors. This is the second submission, which integrates Tom comments about
localisation and exit code. I also added some comments about one sql
command which is not ignored.
Tom Lane [Wed, 21 Apr 2004 18:24:26 +0000 (18:24 +0000)]
Tweak indexscan and seqscan code to arrange that steps from one page to
the next are handled by ReleaseAndReadBuffer rather than separate
ReleaseBuffer and ReadBuffer calls. This cuts the number of acquisitions
of the BufMgrLock by a factor of 2 (possibly more, if an indexscan happens
to pull successive rows from the same heap page). Unfortunately this
doesn't seem enough to get us out of the recently discussed context-switch
storm problem, but it's surely worth doing anyway.
Tom Lane [Wed, 21 Apr 2004 18:06:30 +0000 (18:06 +0000)]
Another round of code cleanup on bufmgr. Use BM_VALID flag to keep track
of whether we have successfully read data into a buffer; this makes the
error behavior a bit more transparent (IMHO anyway), and also makes it
work correctly for local buffers which don't use Start/TerminateBufferIO.
Collapse three separate functions for writing a shared buffer into one.
This overlaps a bit with cleanups that Neil proposed awhile back, but
seems not to have committed yet.
Bruce Momjian [Tue, 20 Apr 2004 16:56:19 +0000 (16:56 +0000)]
Add doc mention that:
process directly. Some parameters can only be set at server start;
any changes to their entries in the configuration file will be ignored
until the server is restarted.
Bruce Momjian [Tue, 20 Apr 2004 01:00:26 +0000 (01:00 +0000)]
> >> My question is whether postgres can index null values, and if not, do I
> >> have to accept a full table scan when locating records.
> >
> > It indexes them, but "is null" is not an indexable operator, so you
> > can't directly solve the above with a 3-column index. What you can do
> > instead is use a partial index, for instance
> >
> > create index i on CUSTOMER.WCCustOrderStatusLog (WCOrderStatusID)
> > where Acknowledged is null and Processing is null;
>
> That's a very nifty trick and exactly the sort of answer I was after!
Add CREATE INDEX doc mention of using partial indexes for IS NULL
indexing; idea from Tom.
Bruce Momjian [Mon, 19 Apr 2004 23:36:48 +0000 (23:36 +0000)]
In reading the 7.4.2 docs, the sql reference page for PREPARE doesn't
reference DEALLOCATE in any way. It points to EXECUTE, but not to
DEALLOCATE. Suggested fix:
... This also means that a single prepared statement cannot be used by
multiple simultaneous database clients; however, each client can create
their own prepared statement to use. The prepared statement can be
manually cleaned up using the DEALLOCATE command.
Tom Lane [Mon, 19 Apr 2004 23:27:17 +0000 (23:27 +0000)]
Code review for ARC patch. Eliminate static variables, improve handling
of VACUUM cases so that VACUUM requests don't affect the ARC state at all,
avoid corner case where BufferSync would uselessly rewrite a buffer that
no longer contains the page that was to be flushed. Make some minor
other cleanups in and around the bufmgr as well, such as moving PinBuffer
and UnpinBuffer into bufmgr.c where they really belong.
Bruce Momjian [Mon, 19 Apr 2004 21:30:18 +0000 (21:30 +0000)]
The attached patch for contrib/pg_autovacuum/README.pg_autovacuum fixes
one apparent error and makes a minor stylistic change that makes it more
consistent and makes clear something that confused me :-)
Bruce Momjian [Mon, 19 Apr 2004 17:42:59 +0000 (17:42 +0000)]
* Most changes are to fix warnings issued when compiling win32
* removed a few redundant defines
* get_user_name safe under win32
* rationalized pipe read EOF for win32 (UPDATED PATCH USED)
* changed all backend instances of sleep() to pg_usleep
- except for the SLEEP_ON_ASSERT in assert.c, as it would exceed a
32-bit long [Note to patcher: If a SLEEP_ON_ASSERT of 2000 seconds is
acceptable, please replace with pg_usleep(2000000000L)]
I added a comment to that part of the code:
/*
* It would be nice to use pg_usleep() here, but only does 2000 sec
* or 33 minutes, which seems too short.
*/
sleep(1000000);
Tom Lane [Sun, 18 Apr 2004 18:12:58 +0000 (18:12 +0000)]
Tweak findTargetlistEntry so that bare names occurring in GROUP BY clauses
are sought first as local FROM columns, then as local SELECT-list aliases,
and finally as outer FROM columns; the former behavior made outer FROM
columns take precedence over aliases. This does not change spec
conformance because SQL99 allows only the first case anyway, and it seems
more useful and self-consistent. Per gripe from Dennis Bjorklund 2004-04-05.
Bruce Momjian [Mon, 12 Apr 2004 16:19:18 +0000 (16:19 +0000)]
Here's an attempt at new socket and signal code for win32.
It works on the principle of turning sockets into non-blocking, and then
emulate blocking behaviour on top of that, while allowing signals to
run. Signals are now implemented using an event instead of APCs, thus
getting rid of the issue of APCs not being compatible with "old style"
sockets functions.
It also moves the win32 specific code away from pqsignal.h/c into
port/win32, and also removes the "thread style workaround" of the APC
issue previously in place.
In order to make things work, a few things are also changed in pgstat.c:
1) There is now a separate pipe to the collector and the bufferer. This
is required because the pipe will otherwise only be signalled in one of
the processes when the postmaster goes down. The MS winsock code for
select() must have some kind of workaround for this behaviour, but I
have found no stable way of doing that. You really are not supposed to
use the same socket from more than one process (unless you use
WSADuplicateSocket(), in which case the docs specifically say that only
one will be flagged).
2) The check for "postmaster death" is moved into a separate select()
call after the main loop. The previous behaviour select():ed on the
postmaster pipe, while later explicitly saying "we do NOT check for
postmaster exit inside the loop".
The issue was that the code relies on the same select() call seeing both
the postmaster pipe *and* the pgstat pipe go away. This does not always
happen, and it appears that useing WSAEventSelect() makes it even more
common that it does not.
Since it's only called when the process exits, I don't think using a
separate select() call will have any significant impact on how the stats
collector works.
Bruce Momjian [Sat, 10 Apr 2004 18:02:59 +0000 (18:02 +0000)]
Please find a small patch to fix the brain damage "century" and
"millennium" date part implementation in postgresql, both in the code
and the documentation, so that it conforms to the official definition.
If you do not agree with the official definition, please send your
complaint to "pope@vatican.org". I'm not responsible for them;-)
With the previous version, the centuries and millenniums had a wrong
number and started the wrong year. Moreover century number 0, which does
not exist in reality, lasted 200 years. Also, millennium number 0 lasted
2000 years.
If you want postgresql to have it's own definition of "century" and
"millennium" that does not conform to the one of the society, just give
them another name. I would suggest "pgCENTURY" and "pgMILLENNIUM";-)
IMO, if someone may use the options, it means that postgresql is used for
historical data, so it make sense to have an historical definition. Also,
I just want to divide the year by 100 or 1000, I can do that quite easily.