Bruce Momjian [Tue, 2 Nov 2004 14:49:27 +0000 (14:49 +0000)]
Update:
< * Add a GUC variable to control the tablespace for temporary objects
> * Add a GUC variable to control the tablespace for temporary objects and
> sort files
>
> This perhaps should use a round-robin allocation system where several
> tablespaces are used in a cycle. The cycle pointer should be global.
>
Tom Lane [Mon, 1 Nov 2004 22:00:30 +0000 (22:00 +0000)]
timestamptz_trunc() should only recalculate the timezone when truncating
to DAY precision or coarser; leave the timezone alone when precision is
HOUR or less. This avoids surprises for inputs near a DST transition
time, as per example from Matthew Gabeler-Lee. (The only reason we
recalculate at all is so that outputs that are supposed to represent
days will come out as local midnight, and that's not relevant for sub-day
precision.)
Tom Lane [Mon, 1 Nov 2004 21:34:44 +0000 (21:34 +0000)]
Invent pg_next_dst_boundary() and rewrite DetermineLocalTimeZone() to
use it, as per my proposal of yesterday. This gives us a means of
determining the zone offset to impute to an unlabeled timestamp that
is both efficient and reliable, unlike all our previous tries involving
mktime() and localtime(). The behavior for invalid or ambiguous times
at a DST transition is fixed to be really and truly "assume standard
time", fixing a bug that has come and gone repeatedly but was back
again in 7.4. (There is some ongoing discussion about whether we should
raise an error instead, but for the moment I'll make it do what it was
previously intended to do.)
Bruce Momjian [Mon, 1 Nov 2004 19:21:50 +0000 (19:21 +0000)]
That's just the lovely way windows handles a "segfault". Gotta be really
interesting for MS to catch all those dumps...
Anyway. Oops. Seems I ran my regression tests with the old psql, and
just managed to update the backend, when I tested that patch. Turns out
there are codepaths where we'd access the Critical Section before it was
initialized. Attached patch breaks the initializeation off to a separate
part and adds that one to a much earlier position in the program.
Tom Lane [Sun, 31 Oct 2004 19:14:16 +0000 (19:14 +0000)]
Use psql -q option instead of 2>/dev/null during first invocation
of psql; this should make it easier to diagnose client-side problems,
such as library version mismatch. Also, consistently use -X option
to avoid problems from weird .psqlrc settings.
Tom Lane [Sat, 30 Oct 2004 23:11:27 +0000 (23:11 +0000)]
Invent a new, more thread-safe version of PQrequestCancel, called PQcancel.
Use this new function in psql. Implement query cancellation in psql for
Windows. Code by Magnus Hagander, documentation and minor editorialization
by Tom Lane.
Tom Lane [Sat, 30 Oct 2004 20:53:06 +0000 (20:53 +0000)]
I found a corner case in which it is possible for RI_FKey_check's call
of HeapTupleSatisfiesItself() to trigger a hint-bit update on the tuple:
if the row was updated or deleted by a subtransaction of my own transaction
that was later rolled back. This cannot occur in pre-8.0 of course, so
the hint-bit patch applied a couple weeks ago is OK for existing releases.
But for 8.0 it seems we had better fix things so that RI_FKey_check can
pass the correct buffer number to HeapTupleSatisfiesItself. Accordingly,
add fields to the TriggerData struct to carry the buffer ID(s) for the
old and new tuple(s). There are other possible solutions but this one
seems cleanest; it will allow other AFTER-trigger functions to safely
do tqual.c calls if they want to. Put new fields at end of struct so
that there is no API breakage.
Tom Lane [Sat, 30 Oct 2004 20:44:43 +0000 (20:44 +0000)]
Change COMMIT back to the old behavior of emitting command tag COMMIT,
not ROLLBACK, for the case of COMMIT outside a transaction block.
Alvaro Herrera
Tom Lane [Fri, 29 Oct 2004 19:18:22 +0000 (19:18 +0000)]
Fix failure to think clearly about encoding conversion errors in COPY.
We can't regurgitate the unconverted string as I first thought, because
the elog.c mechanisms will assume the error message data is in the server
encoding and attempt a reverse conversion. Eventually it might be worth
providing a short-circuit path to support this, but for now the simplest
solution is to abandon trying to report back the line contents after a
conversion failure. Per bug report from Sil Lee, 27-Oct-2004.
Tom Lane [Fri, 29 Oct 2004 00:16:08 +0000 (00:16 +0000)]
Add DEBUG1-level logging of checkpoint start and end. Also, reduce the
'recycled log files' and 'removed log files' messages from DEBUG1 to
DEBUG2, replacing them with a count of files added/removed/recycled in
the checkpoint end message, as per suggestion from Simon Riggs.
Neil Conway [Thu, 28 Oct 2004 01:38:41 +0000 (01:38 +0000)]
Use AllocateFile(), FreeFile() and palloc() rather than fopen(), fclose()
and malloc() in pgstat.c, respectively. This simplifies error recovery,
as well as being more consistent with the rest of the backend.
Tom Lane [Thu, 28 Oct 2004 00:39:59 +0000 (00:39 +0000)]
On Windows, force a checkpoint just before dropping a database's physical
files and directories. This ensures that the bgwriter will close any open
file references it is holding for files therein, which is needed for the
rmdir() to succeed. Andrew Dunstan and Tom Lane.
Tom Lane [Wed, 27 Oct 2004 18:09:41 +0000 (18:09 +0000)]
When displaying a Var that is a reference to a column of an unnamed join,
try to display it as a reference to the underlying column instead. This
is a legitimate substitution (it wouldn't be for a named join) and it
fixes some cases where the display would otherwise be ambiguous. Per
example from Sim Zacks.
Tom Lane [Tue, 26 Oct 2004 16:05:03 +0000 (16:05 +0000)]
Make heap_fetch API more consistent by having the buffer remain pinned
in all cases when keep_buf = true. This allows ANALYZE's inner loop to
use heap_release_fetch, which saves multiple buffer lookups for the same
page and avoids overestimation of cost by the vacuum cost mechanism.
Tom Lane [Mon, 25 Oct 2004 15:42:02 +0000 (15:42 +0000)]
In the new dispensation where REINDEX doesn't take exclusive lock on
the parent table, it's essential that all index accesses take some kind
of lock on the index. I had missed vacuumlazy.c :-( ...
Neil Conway [Mon, 25 Oct 2004 00:46:43 +0000 (00:46 +0000)]
Modify hash_create() to elog(ERROR) if an error occurs, rather than
returning a NULL pointer (some callers remembered to check the return
value, but some did not -- it is safer to just bail out).
Also, cleanup pgstat.c to use elog(ERROR) rather than elog(LOG) followed
by exit().
Tom Lane [Sun, 24 Oct 2004 00:54:12 +0000 (00:54 +0000)]
If we're going to test for switch validity by observing whether the
compiler emits any warnings, the test program had better be 100%
correct, not only 90% correct. The recent addition of -Wold-style-definition
broke thread-safety detection on every platform that has that switch,
because the test program used an old-style definition.
Tom Lane [Fri, 22 Oct 2004 19:48:19 +0000 (19:48 +0000)]
Add a GUC_SUPERUSER_ONLY flag to mark GUC variables that should not be
examinable by non-superusers, and use it to protect the recently-added
GUC variables for data directory and config files. For now I have only
flagged those variables that could be used to deduce something about
the server's filesystem layout, but possibly we should also mark vars
related to logging settings and other admin-only information?
Tom Lane [Fri, 22 Oct 2004 17:20:05 +0000 (17:20 +0000)]
In ALTER COLUMN TYPE, strip any implicit coercion operations appearing
at the top level of the column's old default expression before adding
an implicit coercion to the new column type. This seems to satisfy the
principle of least surprise, as per discussion of bug #1290.
Neil Conway [Fri, 22 Oct 2004 07:21:06 +0000 (07:21 +0000)]
Minor code cleanup: hdefault() only ever returned "true", so it may as
well be declared to return "void" to save callers the trouble of
checking for errors.