Commit Graph

25158 Commits

Author SHA1 Message Date
Tom Lane 6bc12a4aca Get dirmod.c on the same page as port.h about whether we use pgsymlink
on Cygwin (answer: we don't).  Also try to unwind the #ifdef spaghetti
a little bit.  Untested but hopefully I didn't break anything.
2007-07-12 23:28:49 +00:00
Neil Conway ad44c95825 Fixup the indentation of a comment that was mangled by pgindent, and
add dashes to the start/end of the comment block to try to prevent
this happening in the future.
2007-07-12 23:25:26 +00:00
Tom Lane 4f09b55dc3 Simplify overly-cute array coding to avoid an apparent gcc bug, which
may or may not be harmless.  Report from Stefan, patch from Heikki.
2007-07-12 23:10:57 +00:00
Tom Lane 4bbb7f9469 Suppress Sun Studio warnings, per Stefan. 2007-07-12 21:27:09 +00:00
Tom Lane 4dbbef2845 Suppress an integer-overflow warning. 2007-07-12 21:17:09 +00:00
Tom Lane 292e4c6190 Some of our port-specific dynloader implementations are careful to
define pg_dlsym() as returning a PGFunction pointer, not just any
pointer-to-function.  But many are not.  Suppress compiler warnings
on platforms that aren't careful by inserting explicit casts at the
two call sites that didn't have a cast already.  Per Stefan.
2007-07-12 21:13:27 +00:00
Tom Lane 706754c16b Compute max and min int8 values using unsigned arithmetic, in hopes of
suppressing Sun Studio compiler warnings.  Per Stefan.
2007-07-12 21:04:45 +00:00
Tom Lane 72c7badbab Fix some warnings (probably actual bugs) generated by new GSSAPI code
when built on a 64-bit machine.  Per buildfarm results extracted by Stefan.
2007-07-12 20:36:11 +00:00
Tom Lane bc8d164d06 Fix mistaken Assert in adjust_appendrel_attr_needed, per Greg Stark. 2007-07-12 18:27:01 +00:00
Magnus Hagander 017f2d2f18 Silence compile warning on win32, per Stefan and Buildfarm. 2007-07-12 18:15:52 +00:00
Magnus Hagander 784fd04940 Enable GSSAPI to build using MSVC. Always build GSSAPI when Kerberos is
enabled, because the only Kerberos library supported always contains it.
2007-07-12 14:43:21 +00:00
Magnus Hagander 65a513c249 Support GSSAPI builds where the header is <gssapi.h> and not <gssapi/gssapi.h>,
such as OpenBSD (possibly all Heimdal).

Stefan Kaltenbrunner
2007-07-12 14:36:52 +00:00
Magnus Hagander 6771994058 Fix freenig of names in Kerberos when using MIT - need to use the
free function provided in the Kerberos library.
This fixes a very hard to track down heap corruption on windows
when using debug runtimes.
2007-07-12 14:10:39 +00:00
Tom Lane 05c4d8f783 Suppress a warning that some versions of gcc emit about %x in strftime.
Per suggestion from Alvaro.
2007-07-11 23:15:38 +00:00
Magnus Hagander 31013db0a1 A bunch of GSSAPI fixes per comments from Tom:
* use elog not ereport for debug
* fix debug levels for some output
* properly check for memory allocation errors in a couple of missed places
2007-07-11 08:27:33 +00:00
Tom Lane bf75e2a3c7 Add note that building from CVS requires bison and flex, whereas
building from a distribution tarball does not.
2007-07-10 23:03:18 +00:00
Tom Lane e27a8df1bf Fix misspelling. 2007-07-10 16:41:01 +00:00
Magnus Hagander 6160106c74 Add support for GSSAPI authentication.
Documentation still being written, will be committed later.

Henry B. Hotz and Magnus Hagander
2007-07-10 13:14:22 +00:00
Tom Lane ff481ca0d4 Adjust processSQLNamePattern() so that $ within the pattern is always matched
literally, whether quoted or not.  Since we allow $ as a character within
identifiers, this behavior is useful, whereas the previous behavior of
treating it as the regexp ending anchor was nearly useless given that the
pattern is automatically anchored anyway.  This affects the arguments of
psql's \d commands as well as pg_dump's -n and -t switches.  Per discussion.
2007-07-10 00:21:31 +00:00
Tom Lane 6244c2dfff Fix stddev_pop(numeric) and var_pop(numeric), which were incorrectly producing
the same outputs as stddev_samp() and var_samp() respectively.
2007-07-09 16:13:57 +00:00
Tom Lane 9e09e3b15e Fix single-user mode so that interrupts (particularly SIGTERM and
SIGQUIT) will be recognized and processed while waiting for input,
rather than only after something has been typed.  Also make SIGQUIT
do the same thing as SIGTERM in single-user mode, ie, do a normal
shutdown and exit.  Since it's relatively easy to provoke SIGQUIT
from the keyboard, people may try that instead of control-D, and we'd
rather this leads to orderly shutdown.  Per report from Leon Mergen
and subsequent discussion.
2007-07-09 01:15:14 +00:00
Tom Lane 9b619679a8 Minor copy-editing. 2007-07-09 01:08:09 +00:00
Tom Lane b09cb0cf12 Remove the pgstat_drop_relation() call from smgr_internal_unlink(), because
we don't know at that point which relation OID to tell pgstat to forget.
The code was passing the relfilenode, which is incorrect, and could possibly
cause some other relation's stats to be zeroed out.  While we could try to
clean this up, it seems much simpler and more reliable to let the next
invocation of pgstat_vacuum_tabstat() fix things; which indeed is how it
worked before I introduced the buggy code into 8.1.3 and later :-(.
Problem noticed by Itagaki Takahiro, fix is per subsequent discussion.
2007-07-08 22:23:16 +00:00
Tom Lane 8331c11f3f Get rid of client-code dependencies on the exact text of the no-password
error message, by using PQconnectionUsedPassword() instead.  Someday
we might be able to localize that error message, but not until this
coding technique has disappeared everywhere.
2007-07-08 19:07:38 +00:00
Tom Lane 5f7b1f8d9d Closer code review for PQconnectionUsedPassword() patch: in particular,
not OK to include postgres_fe.h into libpq-fe.h, hence declare it as
returning int not bool.
2007-07-08 18:28:56 +00:00
Tom Lane 3f33d7bcb6 Fix broken markup. 2007-07-08 17:47:38 +00:00
Joe Conway d92583f88e Restrict non-superusers to password authenticated connections
to prevent possible escalation of privilege. Provide new SECURITY
DEFINER functions with old behavior, but initially REVOKE ALL
from public for these functions. Per list discussion and design
proposed by Tom Lane. A different approach will be used for
back-branches, committed separately.
2007-07-08 17:12:38 +00:00
Joe Conway 51bc3dfe4b Arrange for the authentication request type to be preserved in
PGconn. Invent a new libpq connection-status function,
PQconnectionUsedPassword() that returns true if the server
demanded a password during authentication, false otherwise.
This may be useful to clients in general, but is immediately
useful to help plug a privilege escalation path in dblink.
Per list discussion and design proposed by Tom Lane.
2007-07-08 17:11:51 +00:00
Bruce Momjian 8c69d881ce Remove TODO.detail/win32intr, no longer needed. 2007-07-08 00:42:07 +00:00
Bruce Momjian 5b67de17ee Remove, per Magnus:
< 	o Check WSACancelBlockingCall() for interrupts [win32intr]
2007-07-08 00:41:11 +00:00
Tom Lane 48d9d8e131 Fix a couple of planner bugs introduced by the new ability to discard
ORDER BY <constant> as redundant.  One is that this means query_planner()
has to canonicalize pathkeys even when the query jointree is empty;
the canonicalization was always a no-op in such cases before, but no more.
Also, we have to guard against thinking that a set-returning function is
"constant" for this purpose.  Add a couple of regression tests for these
evidently under-tested cases.  Per report from Greg Stark and subsequent
experimentation.
2007-07-07 20:46:45 +00:00
Magnus Hagander d5eaa637ce Move parse.h into src/backend on msvc, which is where it is on Unix.
Fixes builds from tarballs where the file is pre-generated.

Yoshiyuki Asaba
2007-07-07 07:43:21 +00:00
Jan Wieck 9fbcf6625e Changed new \usleep command into \sleep with an optional time unit
argument to specify us, ms or s. As per suggestion by Peter E.

Jan
2007-07-06 20:17:02 +00:00
Jan Wieck 0f17da9b3e Added a new scripting meta command
\usleep [milliseconds|:variable]

which can be used in -f scripts to insert a thinking time between
other commands.

Jan
2007-07-06 13:36:55 +00:00
Tom Lane 7af3a6fc6f Fix up hash functions for datetime datatypes so that they don't take
unwarranted liberties with int8 vs float8 values for these types.
Specifically, be sure to apply either hashint8 or hashfloat8 depending
on HAVE_INT64_TIMESTAMP.  Per my gripe of even date.
2007-07-06 04:16:00 +00:00
Tom Lane ad9a99c24f Improve description of SPI_scroll_cursor_move's return values, per a
gripe by Pavel Stehule awhile ago.
2007-07-05 19:15:12 +00:00
Tom Lane 83aaebba63 Fix incorrect comment about the timing of AbsorbFsyncRequests() during
checkpoint.  The comment claimed that we could do this anytime after
setting the checkpoint REDO point, but actually BufferSync is relying
on the assumption that buffers dumped by other backends will be fsync'd
too.  So we really could not do it any sooner than we are doing it.
2007-07-03 14:51:24 +00:00
Neil Conway a55898131e Add ALTER VIEW ... RENAME TO, and a RENAME TO clause to ALTER SEQUENCE.
Sequences and views could previously be renamed using ALTER TABLE, but
this was a repeated source of confusion for users. Update the docs,
and psql tab completion. Patch from David Fetter; various minor fixes
by myself.
2007-07-03 01:30:37 +00:00
Magnus Hagander a1587e41ae - Fix the -w (wait) option to work in Windows service mode, per bug #3382.
- Prevent the -w option being passed to the postmaster.
- Read the postmaster options file when starting as a Windows service.

Dave Page
2007-07-02 21:58:31 +00:00
Tom Lane 1c7fe33fdb Fix failure to restart Postgres when Linux kernel returns EIDRM for shmctl().
This is a Linux kernel bug that apparently exists in every extant kernel
version: sometimes shmctl() will fail with EIDRM when EINVAL is correct.
We were assuming that EIDRM indicates a possible conflict with pre-existing
backends, and refusing to start the postmaster when this happens.  Fortunately,
there does not seem to be any case where Linux can legitimately return EIDRM
(it doesn't track shmem segments in a way that would allow that), so we can
get away with just assuming that EIDRM means EINVAL on this platform.

Per reports from Michael Fuhr and Jon Lapham --- it's a bit surprising
we have not seen more reports, actually.
2007-07-02 20:11:55 +00:00
Magnus Hagander 454333a687 Add notes about configuring Visual Studio Express for use with the
Platform SDK.
2007-07-01 18:40:37 +00:00
Tom Lane bce7bacdf2 Reduce the maximum sleep interval in the autovac launcher to 1 second,
so that it responds to SIGQUIT reasonably promptly even on machines where
SA_RESTART signals restart a sleep from scratch.  (This whole area could
stand some rethinking, but for now make it work like the other processes
do.)  Also some marginal stylistic cleanups.
2007-07-01 18:30:54 +00:00
Tom Lane 421d50273f Treat the autovac launcher more like a regular backend, in that we wait
for it to die before telling the bgwriter to initiate shutdown checkpoint.
Since it's connected to shared memory, this seems more prudent than the
alternative of letting it quit asynchronously.  Resolves my complaint
of yesterday about repeated shutdown checkpoints in CVS HEAD.
2007-07-01 18:28:41 +00:00
Tom Lane 8f55b9a8ba Avoid memory leakage when a series of subtransactions invoke AFTER triggers
that are fired at end-of-statement (as is the normal case for foreign keys,
for example).  In this situation the per-subxact deferred trigger context
is always empty when subtransaction exit is reached; so we could free it,
but were not doing so, leading to an intratransaction leak of 8K or more
per subtransaction.  Per off-list example from Viatcheslav Kalinin
subsequent to bug #3418 (his original bug report omitted a foreign key
constraint needed to cause this leak).

Back-patch to 8.2; prior versions were not using per-subxact contexts
for deferred triggers, so did not have this leak.
2007-07-01 17:45:42 +00:00
Tom Lane beba73763b Fix comments not updated in recent patch. 2007-07-01 02:22:23 +00:00
Tom Lane 070907b241 Add 'volatile' to suppress 'variable might be clobbered by longjmp'
warning emitted by some versions of gcc.
2007-07-01 02:20:59 +00:00
Tom Lane 9fc25c0511 Improve logging of checkpoints. Patch by Greg Smith, worked over
by Heikki and a little bit by me.
2007-06-30 19:12:02 +00:00
Alvaro Herrera 2910ccefb4 Avoid crash in interrupted autovacuum worker, caused by leaving the current
memory context pointing at a context not long lived enough.

Also, create a fake PortalContext where to store the vac_context, if only
to avoid having it be a top-level memory context.
2007-06-30 04:08:05 +00:00
Alvaro Herrera 10af02b912 Arrange for SIGINT in autovacuum workers to cancel the current table and
continue with the schedule.  Change current uses of SIGINT to abort a worker
into SIGTERM, which keeps the old behaviour of terminating the process.

Patch from ITAGAKI Takahiro, with some editorializing of my own.
2007-06-29 17:07:39 +00:00
Tom Lane c786796d0a Fix computation of PG_VERSION_NUM by configure: remove unnecessary and
unportable backslashes in awk script (per Patrick Welche), and add
brackets to prevent autoconf from mangling sed's regexp (the sed call
here never did what was expected).
2007-06-29 16:18:43 +00:00