Commit Graph

6932 Commits

Author SHA1 Message Date
Tom Lane fae7ce83fe Make locale_messages_assign() really work on Windows; the prior hack
only covered the case of assigning "", and failed to recognize that
actually setlocale(LC_MESSAGES,...) does not work at all on this platform.
Magnus Hagander, some code prettification by Tom Lane.
2004-10-17 20:02:26 +00:00
Tom Lane dc19aaa12f Give a more user-friendly error message in case where a table is created
in a schema whose default tablespace has been dropped.
2004-10-16 21:16:36 +00:00
Tom Lane f68d05d5ec Limit NBuffers and some related values to INT_MAX / BLCKSZ, to prevent
arithmetic overflow during initial sizing calculations.  This is not
water-tight but it should avoid the grossest sorts of failures.
2004-10-16 19:08:38 +00:00
Tom Lane fdd13f1568 Give the ResourceOwner mechanism full responsibility for releasing buffer
pins at end of transaction, and reduce AtEOXact_Buffers to an Assert
cross-check that this was done correctly.  When not USE_ASSERT_CHECKING,
AtEOXact_Buffers is a complete no-op.  This gets rid of an O(NBuffers)
bottleneck during transaction commit/abort, which recent testing has shown
becomes significant above a few tens of thousands of shared buffers.
2004-10-16 18:57:26 +00:00
Tom Lane 1c2de47746 Remove BufferLocks[] array in favor of a single pointer to the buffer
(if any) currently waited for by LockBufferForCleanup(), which is all
that we were using it for anymore.  Saves some space and eliminates
proportional-to-NBuffers slowdown in UnlockBuffers().
2004-10-16 18:05:07 +00:00
Tom Lane 9ffc8ed58b Repair possible failure to update hint bits back to disk, per
http://archives.postgresql.org/pgsql-hackers/2004-10/msg00464.php.
This fix is intended to be permanent: it moves the responsibility for
calling SetBufferCommitInfoNeedsSave() into the tqual.c routines,
eliminating the requirement for callers to test whether t_infomask changed.
Also, tighten validity checking on buffer IDs in bufmgr.c --- several
routines were paranoid about out-of-range shared buffer numbers but not
about out-of-range local ones, which seems a tad pointless.
2004-10-15 22:40:29 +00:00
Bruce Momjian a1ce88a59c Have log_duration only output when log_statement has printed the query.
This handles the new multiple log_statement values.

Ed L.
2004-10-15 16:50:31 +00:00
Bruce Momjian 8613eac6c4 Fix pg_ctl -D handling for Win32:
C:\msys\1.0\home\y-asaba>pg_ctl -D data restart
	waiting for postmaster to shut down...LOG:  received smart shutdown
	request.
	LOG:  shutting down
	LOG:  database system is shut down
	done
	postmaster stopped

	postmaster starting

	C:\msys\1.0\home\y-asaba>postmaster.exe: invalid argument: "'-D'"
	Try "postmaster.exe --help" for more information.

Yoshiyuki Asaba
2004-10-15 04:54:33 +00:00
Bruce Momjian 5c267325ec Add 'int' cast for getpid() because some Solaris releases return long
for getpid().
2004-10-14 20:23:46 +00:00
Neil Conway 7069dbcc31 More minor cosmetic improvements:
- remove another senseless "extern" keyword that was applied to a
function definition
- change a foo more function signatures from "some_type foo()" to
"some_type foo(void)"
- rewrite another K&R style function definition
- make the type of the "action" function pointer in the KeyWord struct
in src/backend/utils/adt/formatting.c more precise
2004-10-13 01:25:13 +00:00
Peter Eisentraut 0fd37839d9 Message style revisions 2004-10-12 21:54:45 +00:00
Peter Eisentraut 7656e55639 Translation update 2004-10-12 17:57:14 +00:00
Neil Conway d709964779 Fix a copy-and-paste error: give a distinct memory context a distinct
name, mainly for debugging purposes.
2004-10-12 01:50:04 +00:00
Tom Lane 26112850ec Fix OR-index-scan planner to recognize that a partial index is usable
for scanning one term of an OR clause if the index's predicate is implied
by that same OR clause term (possibly in conjunction with top-level WHERE
clauses).  Per recent example from Dawid Kuroczko,
http://archives.postgresql.org/pgsql-performance/2004-10/msg00095.php
Also, fix a very long-standing bug in index predicate testing, namely the
bizarre ordering of decomposition of predicate and restriction clauses.
AFAICS the correct way is to break down the predicate all the way, and
then for each component term see if you can prove it from the entire
restriction set.  The original coding had a purely-implementation-artifact
distinction between ANDing at the top level and ANDing below that, and
proceeded to get the decomposition order wrong everywhere below the top
level, with the result that even slightly complicated AND/OR predicates
could not be proven.  For instance, given
create index foop on foo(f2) where f1=42 or f1=1
    or (f1 = 11 and f2 = 55);
the old code would fail to match this index to the query
select * from foo where f1 = 11 and f2 = 55;
when it obviously ought to match.
2004-10-11 22:57:00 +00:00
Tom Lane e5d30091e6 Fix pg_indexes view so that it shows the index's tablespace not the
parent table's tablespace, as per gripe from Michael Kleiser.  Choose
a more plausible column order for this view and pg_tables.  Update
documentation of these views, which was missed in original patch.
2004-10-11 17:24:41 +00:00
Neil Conway 5340a988c8 Fix typo in comment. 2004-10-11 02:02:41 +00:00
Neil Conway 0e72b9d440 Cosmetic improvements/code cleanup:
- replace some function signatures of the form "some_type foo()" with
"some_type foo(void)"
- replace a few instances of a literal 0 being used as a NULL pointer;
there are more instances of this in the code, but I just fixed a few
- in src/backend/utils/mb/wstrncmp.c, replace K&R style function
declarations with ANSI style, remove use of 'register' keyword
- remove an "extern" modifier that was applied to a function definition
(rather than a declaration)
2004-10-10 23:37:45 +00:00
Tom Lane 337ffcddba Adjust configuration-files GUC behavior as per my recent proposal.
The vars are renamed to data_directory, config_file, hba_file, and
ident_file, and are guaranteed to be set to accurate absolute paths
during postmaster startup.
This commit does not yet do anything about hiding path values from
non-superusers.
2004-10-09 23:13:22 +00:00
Bruce Momjian 67608a393b Make getpid() use %d consistently for printing. 2004-10-09 02:46:42 +00:00
Bruce Momjian abc1d28ba7 Suppress timezone output on log_line_prefix %t on Win32, because it is
too long.
2004-10-09 01:24:47 +00:00
Tom Lane 7ca3a0f3e2 Whack some sense into the configuration-file-location patch.
Refactor code into something reasonably understandable, cause
use of the feature to not fail in standalone backends or in
EXEC_BACKEND case, fix sloppy guc.c table entries, make the
documentation minimally usable.
2004-10-08 01:36:36 +00:00
Bruce Momjian f4f6caa9b0 Do proper testing of CIDR bits against network mask, e.g. don't allow:
test=# select '204.248.199.1/31'::cidr;

Previous releases erroneously accepted such addresses.

WARN IN RELEASE NOTES

Kevin Brintnall
2004-10-08 01:10:31 +00:00
Tom Lane 4b10271037 Change get_rule_expr so that when the input is a List, it displays the
list elements comma-separated instead of barfing.  This allows elimination
of half a dozen redundant copies of that behavior, and also makes the
world safe again for pg_get_expr() applied to pg_index.indexprs, per gripe
from Alexander Zhiltsov.
2004-10-07 20:36:52 +00:00
Tom Lane a8487e15ed Fix problems with SQL functions returning rowtypes that have dropped
columns.  The returned tuple needs to have appropriate NULL columns
inserted so that it actually matches the declared rowtype.  It seemed
convenient to use a JunkFilter for this, so I made some cleanups and
simplifications in the JunkFilter code to allow it to support this
additional functionality.  (That in turn exposed a latent bug in
nodeAppend.c, which is that it was returning a tuple slot whose
descriptor didn't match its data.)  Also, move check_sql_fn_retval
out of pg_proc.c and into functions.c, where it seems to more naturally
belong.
2004-10-07 18:38:51 +00:00
Bruce Momjian 9fb5c757b8 Remove unneeded dash. 2004-10-07 17:04:54 +00:00
Bruce Momjian 00f184a83f Update comment to fix nibble mention:
* We are not sure how much precision is in tv_usec, so we
	 * swap the high and low 16 bits of 'later' and XOR them with
	 * 'earlier'. On the off chance that the result is 0, we
	 * loop until it isn't.

Greg Stark
2004-10-07 17:03:50 +00:00
Bruce Momjian a5d7ba773d Adjust comments previously moved to column 1 by pgident. 2004-10-07 15:21:58 +00:00
Bruce Momjian 9da50e1f53 Back out unindented modification to file. 2004-10-07 14:19:58 +00:00
Bruce Momjian cdc84adbdb Indent comment pushed to new line by else so it is indented by BSD
indent.
2004-10-07 14:15:50 +00:00
Neil Conway 0683a47556 Allow the spinlock test to be compiled successfully in a vpath build. 2004-10-07 00:08:04 +00:00
Tom Lane 52a45818a1 XOR process PID into a backend's initial random seed, to ensure that
different backends get a reasonably wide set of initial seeds even if
gettimeofday returns tv_usec values with only a few bits of precision.
Per recent discussion.
2004-10-07 00:03:15 +00:00
Bruce Momjian 902ca3e225 Here is a patch to fix win32 ssl builds. Summary of changes:
* Links with -leay32 and -lssleay32 instead of crypto and ssl. On win32,
"crypto and ssl" is only used for static linking.

* Initializes SSL in the backend and not just in the postmaster. We
cannot pass the SSL context from the postmaster through the parameter
file, because it contains function pointers.

* Split one error check in be-secure.c. Previously we could not tell
which of three calls actually failed. The previous code also returned
incorrect error messages if SSL_accept() failed - that function needs to
use SSL_get_error() on the return value, can't just use the error queue.

* Since the win32 implementation uses non-blocking sockets "behind the
scenes" in order to deliver signals correctly, implements a version of
SSL_accept() that can handle this. Also, add a wait function in case
SSL_read or SSL_write() needs more data.

Magnus Hagander
2004-10-06 09:35:23 +00:00
Bruce Momjian 4542581bf1 Adjustment to test on unix domain socket variable for pg_hba.conf
default settings, rather than just Win32.
2004-10-06 09:13:10 +00:00
Bruce Momjian c93872d891 Remove pg_hba.conf 'local' line for Win32 because it doesn't support unix domain
connections.

Andrew Dunstan
2004-10-06 09:01:18 +00:00
Bruce Momjian da67c919d9 Add Win32 version info to client binaries.
Magnus Hagander
2004-10-05 19:30:25 +00:00
Tom Lane 6c61af6654 Remove arithmetic operators on the 1-byte-char datatype, as per proposals
made several times in the past.  Add coercion functions between "char"
and integer so that a workaround is possible if needed.

Initdb forced.
2004-10-04 22:49:59 +00:00
Tom Lane 4c77cbb272 PortalRun must guard against the possibility that the portal it's
running contains VACUUM or a similar command that will internally start
and commit transactions.  In such a case, the original caller values of
CurrentMemoryContext and CurrentResourceOwner will point to objects that
will be destroyed by the internal commit.  We must restore these pointers
to point to the newly-manufactured transaction context and resource owner,
rather than possibly pointing to deleted memory.
Also tweak xact.c so that AbortTransaction and AbortSubTransaction
forcibly restore a sane value for CurrentResourceOwner, much as they
have always done for CurrentMemoryContext.  I'm not certain this is
necessary but I'm feeling paranoid today.
Responds to Sean Chittenden's bug report of 4-Oct.
2004-10-04 21:52:15 +00:00
Tom Lane 9a31c9b7b8 Suppress getppid test on WIN32, per Dave Page. 2004-10-04 14:55:17 +00:00
Tom Lane 4171bb869f Detect overflow in integer arithmetic operators (integer, smallint, and
bigint variants).  Clean up some inconsistencies in error message wording.
Fix scanint8 to allow trailing whitespace in INT64_MIN case.  Update
int8-exp-three-digits.out, which seems to have been ignored by the last
couple of people to modify the int8 regression test, and remove
int8-exp-three-digits-win32.out which is thereby exposed as redundant.
2004-10-04 14:42:48 +00:00
Bruce Momjian 24201b4bc6 Make libpgport be front-end only and make libpgport_srv be a backend
library that uses palloc, ereport, etc.  This simplifies the makefiles
for client applications.
2004-10-04 13:43:59 +00:00
Peter Eisentraut 8d5ff6bad1 Translation update 2004-10-03 20:29:24 +00:00
Tom Lane 47aa95e951 Clean up handling of inherited-table update queries, per bug report
from Sebastian Böck.  The fix involves being more consistent about
when rangetable entries are copied or modified.  Someday we really
need to fix this stuff to not scribble on its input data structures
in the first place...
2004-10-02 22:39:49 +00:00
Tom Lane 125bf342fd Convert pg_stat_get_backend_idset to use the existing SRF support.
This seems the cleanest way of fixing its lack of a shutdown callback,
which was preventing it from working correctly in a query that didn't
run it to completion.  Per bug report from Szima GÄbor.
2004-10-01 21:03:42 +00:00
Tom Lane b62aa83f0e fmgr_security_definer had better do a PG_TRY to ensure the outer userid
is restored on error exit.
2004-10-01 20:39:54 +00:00
Tom Lane c8196c87a7 Adjust postmaster to recognize that a lockfile containing its parent's PID
must be stale.  Tweak example startup scripts to not use pg_ctl but launch
the postmaster directly, thereby ensuring that only the postmaster's direct
parent shell will be a postgres-owned process.  In combination these should
fix the longstanding problem of the postmaster sometimes refusing to start
during reboot because it thinks the old lockfile is not stale.
2004-10-01 18:30:25 +00:00
Tom Lane b1f8a37aa7 Fallout from changing index locking rules: we can reduce the strength
of locking used by REINDEX.  REINDEX needs only ShareLock on the parent
table, same as CREATE INDEX, plus an exclusive lock on the specific index
being processed.
2004-10-01 17:11:50 +00:00
Tom Lane 4c5e810fcd Code review for NOWAIT patch: downgrade NOWAIT from fully reserved keyword
to unreserved keyword, use ereport not elog, assign a separate error code
for 'could not obtain lock' so that applications will be able to detect
that case cleanly.
2004-10-01 16:40:05 +00:00
Tom Lane d2af5f8a3e Adjust index locking rules as per my proposal of earlier today. You
now are supposed to take some kind of lock on an index whenever you
are going to access the index contents, rather than relying only on a
lock on the parent table.
2004-09-30 23:21:26 +00:00
Tom Lane abc6441d60 Remove unnecessary use of index_open just to get the index name. 2004-09-30 17:42:42 +00:00
Tom Lane f065957062 Come to think of it, functions in FROM have the same syntactic restriction
as CREATE INDEX did, and can be fixed the same way, for another small
improvement in usability and reduction in grammar size.
2004-09-30 00:24:27 +00:00