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.
Tom Lane [Fri, 22 Oct 2004 00:24:18 +0000 (00:24 +0000)]
Prevent pg_ctl from being run as root. Since it uses configuration files
owned by postgres, doing "pg_ctl start" as root could allow a privilege
escalation attack, as pointed out by iDEFENSE. Of course the postmaster would
fail, but we ought to fail a little sooner to protect sysadmins unfamiliar
with Postgres. The chosen fix is to disable root use of pg_ctl in all cases,
just to be confident there are no other holes.
Tom Lane [Thu, 21 Oct 2004 21:33:59 +0000 (21:33 +0000)]
Disallow referential integrity actions from being deferred; only the
NO ACTION check is deferrable. This seems to be a closer approximation
to what the SQL spec says than what we were doing before, and it prevents
some anomalous behaviors that are possible now that triggers can fire
during the execution of PL functions.
Stephan Szabo.
Tom Lane [Thu, 21 Oct 2004 20:23:19 +0000 (20:23 +0000)]
Set the close-on-exec flag for libpq's socket to the backend, to avoid
any possible problems from child programs executed by the client app.
Per suggestion from Elliot Lee of Red Hat.
Tom Lane [Thu, 21 Oct 2004 19:28:36 +0000 (19:28 +0000)]
Standardize on using the Min, Max, and Abs macros that are in our c.h file,
getting rid of numerous ad-hoc versions that have popped up in various
places. Shortens code and avoids conflict with Windows min() and max()
macros.
Tom Lane [Wed, 20 Oct 2004 16:04:50 +0000 (16:04 +0000)]
Allow functions returning void or cstring to appear in FROM clause,
to make life cushy for the JDBC driver. Centralize the decision-making
that affects this by inventing a get_type_func_class() function, rather
than adding special cases in half a dozen places.
Tom Lane [Mon, 18 Oct 2004 23:23:19 +0000 (23:23 +0000)]
Add some code to ensure that we don't lose communication sync due to
an oversize message, per suggestion from Oliver Jowett. I'm a bit
dubious that this is a real problem, since the client likely doesn't
have any more space available than the server, but it's not hard to
make it behave according to the protocol intention.
Tom Lane [Mon, 18 Oct 2004 22:00:42 +0000 (22:00 +0000)]
Add PQprepare/PQsendPrepared functions to libpq to support preparing
statements without necessarily specifying the datatypes of their parameters.
Abhijit Menon-Sen with some help from Tom Lane.