Commit Graph

7249 Commits

Author SHA1 Message Date
Tom Lane cbd8913245 Remove unportable assumption that it's okay to use the target buffer
of an sprintf() as a source string.  Demonstrably does not work with
recent gcc and/or glibc on some platforms.
2005-01-13 01:40:13 +00:00
Tom Lane 40f32f351a Add conditional inclusion of <com_err.h> to support old 'heimdal'
version of Kerberos.  Per report from Reinhard Max.
2005-01-12 21:37:54 +00:00
Tom Lane 2ec1aa4cb8 Re-allow an untyped literal as the test expression of a CASE, ie
CASE 'a' WHEN 'a' THEN 1 ELSE 2 END.  This worked in 7.4 and before
but had been broken due to premature freezing of the type of the test
expression.  Per gripe from GÄbor SzÃcs.
2005-01-12 17:32:36 +00:00
Tom Lane 8251e0b2fb Increase MAXLISTEN to a more generous value, and add an error message
telling when it has been exceeded.  Per trouble report from
Jean-GÅrard Pailloncy.
2005-01-12 16:38:17 +00:00
Tom Lane d3d00715e2 interval_out failed to mention 'ago' for negative intervals in SQL and
GERMAN datestyles.  Ancient bug reported by Terry Lee Tucker.
2005-01-11 18:33:46 +00:00
Tom Lane fc299179df Separate the functions of relcache entry flush and smgr cache entry flush
so that we can get the size of a shared inval message back down to what it
was in 7.4 (and simplify the logic too).  Phase 2 of fixing the
'SMgrRelation hashtable corrupted' problem.
2005-01-10 21:57:19 +00:00
Tom Lane 0ce4d56924 Phase 1 of fix for 'SMgrRelation hashtable corrupted' problem. This
is the minimum required fix.  I want to look next at taking advantage of
it by simplifying the message semantics in the shared inval message queue,
but that part can be held over for 8.1 if it turns out too ugly.
2005-01-10 20:02:24 +00:00
Peter Eisentraut c2719ae503 Translation updates 2005-01-10 08:14:35 +00:00
Tom Lane 521e8888e9 Undo an unadvertised change in the API of pg_atoi. In all previous
releases, a nonzero 'c' argument meant that the input string could be
terminated by either that character or \0.  Recent refactoring broke
that, causing the thing to scan for 'c' only.  This went undetected
because no part of the main code actually passes nonzero 'c'.  However
it broke tsearch2 and possibly other user-written code that assumed
the old definition.  Per report from Tom Hebbron.
2005-01-09 21:03:19 +00:00
Peter Eisentraut a58e738cd7 Translation updates 2005-01-09 17:32:05 +00:00
Peter Eisentraut 8511a1b734 New translation 2005-01-09 17:10:29 +00:00
Tom Lane 8afe005f42 Consistently use geteuid() not getuid(); there were a few places deviating
from our long-established standard.
2005-01-08 22:51:15 +00:00
Tom Lane 3b5152cac6 Improve comments in sample config files. 2005-01-07 23:59:17 +00:00
Tom Lane a3f98d5795 Adjust lookup of client-side profile files (.pgpass and so on) as per
discussion on pgsql-hackers-win32 list.  Documentation still needs to
be tweaked --- I'm not sure how to refer to the APPDATA folder in
user documentation.
2005-01-06 18:29:11 +00:00
Peter Eisentraut 381de28eb0 Translation updates 2005-01-06 09:07:17 +00:00
Peter Eisentraut c43bd11683 Translation updates 2005-01-06 08:46:07 +00:00
Peter Eisentraut 073149c6b2 Translation update 2005-01-04 19:42:01 +00:00
Peter Eisentraut 852b4ae5c2 Fix typo 2005-01-04 07:06:01 +00:00
Peter Eisentraut a2a5526ecb Translation updates 2005-01-03 22:39:24 +00:00
Tom Lane c9d8edc906 Repair bufmgr deadlock problem reported by Michael Wildpaner. Must take
share lock on a buffer being written out before releasing BufMgrLock in
the BufferAlloc code path; if we do it later we might block on someone
who's re-pinned the buffer.  I believe this is only an issue for BufferAlloc
and not the other places that call FlushBuffer.  BufferSync must continue
to do it the old way since it may well be trying to write buffers that
other backends have pinned; but it should not be holding any conflicting
locks.  FlushRelationBuffers is okay since it's got exclusive lock at the
relation level.
2005-01-03 18:49:41 +00:00
Tom Lane a17e589046 Adjust a few more copyright notices to match the format expected by
the src/tools/copyright script.
2005-01-01 22:14:33 +00:00
Tom Lane 7e1c8ef4fc Some more missed copyright notices. Many of these look like they
should have been caught by the src/tools/copyright script ... why
weren't they?
2005-01-01 20:44:34 +00:00
Bruce Momjian 2daed8c5b3 Update copyrights that were missed. 2005-01-01 05:43:09 +00:00
PostgreSQL Daemon 2ff501590b Tag appropriate files for rc3
Also performed an initial run through of upgrading our Copyright date to
extend to 2005 ... first run here was very simple ... change everything
where: grep 1996-2004 && the word 'Copyright' ... scanned through the
generated list with 'less' first, and after, to make sure that I only
picked up the right entries ...
2004-12-31 22:04:05 +00:00
Tom Lane 7cd25199a9 Clean up win32ver.o on Windows, per Magnus. 2004-12-31 19:09:37 +00:00
Tom Lane 96ecf9d5aa Support Sun's compiler on SunOS4 (a/k/a Solaris 9). Per ayan@ayan.net 2004-12-29 23:47:40 +00:00
Tom Lane eee5abce46 Refactor EXEC_BACKEND code so that postmaster child processes reattach
to shared memory as soon as possible, ie, right after read_backend_variables.
The effective difference from the original code is that this happens
before instead of after read_nondefault_variables(), which loads GUC
information and is apparently capable of expanding the backend's memory
allocation more than you'd think it should.  This should fix the
failure-to-attach-to-shared-memory reports we've been seeing on Windows.
Also clean up a few bits of unnecessarily grotty EXEC_BACKEND code.
2004-12-29 21:36:09 +00:00
Tom Lane 370f90970d Cause pg_hba.conf file inclusion (@file stuff) to behave as documented,
that is, files are sought in the same directory as the referencing file.
Also allow absolute paths in @file constructs.  Improve documentation
to actually say what is allowed in an included file.
2004-12-27 19:19:24 +00:00
Tom Lane 42f167f8b1 Fix func_ptr declaration for netbsd-mac68k, per Rémi Zara. 2004-12-26 23:20:12 +00:00
Tom Lane 08457504f0 Avoid memory leakage during VACUUM FULL when an index expression or
index predicate uses temporary memory for evaluation.  Per example
from Jean-Gerard Pailloncy.
2004-12-23 22:42:15 +00:00
Tom Lane bfa5f30481 Awhile back I added some code to StartupCLOG() to forcibly zero out
the remainder of the current clog page during system startup.  While
this was a good idea, it turns out the code fails if nextXid is
exactly at a page boundary, because we won't have created the "current"
clog page yet in that case.  Since the page will be correctly zeroed
when we execute the first transaction on it, the solution is just to
do nothing when exactly at a page boundary.  Per trouble report from
Dave Hartwig.
2004-12-22 18:45:49 +00:00
Tom Lane 6cd2c9f752 Ensure that 'disabling statistics collector' is logged in all failure
paths of pgstat_init.  Responds to confusion exhibited by Christoph Haller.
2004-12-20 19:17:56 +00:00
Tom Lane ed06824978 Add support for Latin9 encoding in to_ascii(). Jaime Casanova 2004-12-20 19:00:37 +00:00
Tom Lane b5ae0d69da Mark the TimeZone parameter as GUC_REPORT, so that JDBC can find out
when it changes.  Per request from Kris Jurka.
2004-12-20 18:15:07 +00:00
Tom Lane da59a70c09 Remove direct inclusions of <com_err.h> as well as configure test for
its presence.  This amounts to desupporting Kerberos 5 releases 1.0.*,
which is small loss, and simplifies use of our Kerberos code on platforms
with Red-Hat-style include file layouts.  Per gripe from John Gray and
followup discussion.
2004-12-20 17:13:41 +00:00
Bruce Momjian 08690d0688 Allow NetBSD, m64k to compile the ASM spinlock code.
R?mi Zara
2004-12-18 22:12:52 +00:00
Tom Lane d0a6042f9f Make array_cat more paranoid about checking datatypes in empty arrays. 2004-12-17 20:59:58 +00:00
Tom Lane bd3bc4076e array_map failed to insert correct result type in an empty array.
Per example from Florian Pflug.
2004-12-17 20:58:26 +00:00
Tom Lane ff5a354ece Fix is-it-time-for-a-checkpoint logic so that checkpoint_segments can
usefully be larger than 255.  Per gripe from Simon Riggs.
2004-12-17 00:10:36 +00:00
Peter Eisentraut cd380b99cd Translation updates 2004-12-16 11:31:55 +00:00
Tom Lane dd29fc2f61 Fix another place broken by new List implementation :-(. Per example
from goranpop@nspoint.net.  I think this escaped notice because in
simple cases the list is NIL on entry.
2004-12-15 21:13:34 +00:00
Tom Lane 84dbd5a8f6 Disallow SETOF in the input of parseTypeString(). Formerly it was
silently ignored, allowing one to write bizarre things like
	DECLARE x setof int;
in plpgsql.  This has misled at least one novice into thinking that
plpgsql variables could be sets ...
2004-12-15 20:15:17 +00:00
Tom Lane c3d6c7d8f9 Calculation of keys_are_unique flag was wrong for cases involving
redundant cross-datatype comparisons.  Per example from Merlin Moncure.
2004-12-15 19:16:39 +00:00
Peter Eisentraut b8bbd15892 Translation update 2004-12-15 17:14:11 +00:00
Peter Eisentraut 93c4a14e5c New translation 2004-12-13 22:54:20 +00:00
Peter Eisentraut 6ccb04f341 Translation updates 2004-12-13 21:49:10 +00:00
Peter Eisentraut 965dd791f4 Translation updates 2004-12-13 16:28:23 +00:00
Tom Lane d4b49b4bd4 Avoid generating excess (and illegal) parentheses around an aliased JOIN
in prettyprint mode.  Andreas Pflug
2004-12-13 00:33:06 +00:00
Tom Lane c604ed56e3 PREPARE and EXPLAIN need to copy the source query just like we recently
had to do in DECLARE CURSOR.  AFAICS these are all the places affected.
PREPARE case per example from Michael Fuhr, EXPLAIN case located by
grepping for planner calls ...
2004-12-12 20:17:06 +00:00
Peter Eisentraut 373825c9cd Translation updates 2004-12-12 18:09:18 +00:00
Tom Lane 984791e0e1 Upgrade formrdesc() so that it can correctly initialize the tupledesc
(rd_att) field of a nailed-in-cache relcache entry.  This fixes the bug
reported by Alvaro 8-Dec-2004; I believe it probably also explains
Grant Finnemore's report of 10-Sep-2004.

In an unrelated change in the same file, put back 7.4's response to
failure to rename() the relcache init file, ie, unlink the useless
temp file.  I did not put back the warning message, since there might
actually be some reason not to have that.
2004-12-12 05:07:50 +00:00
Tom Lane 12b1b5d837 Instead of supposing (wrongly, in the general case) that the rowtype
of an inheritance child table is binary-compatible with the rowtype of
its parent, invent an expression node type that does the conversion
correctly.  Fixes the new bug exhibited by Kris Shannon as well as a
lot of old bugs that would only show up when using multiple inheritance
or after altering the parent table.
2004-12-11 23:26:51 +00:00
Peter Eisentraut b89df8fe60 Translation updates 2004-12-11 20:19:24 +00:00
Peter Eisentraut a31ec86ebe Translation updates 2004-12-11 20:10:14 +00:00
Peter Eisentraut e82cd783a1 Translation updates 2004-12-11 19:56:07 +00:00
Peter Eisentraut 4de679c710 Translation updates 2004-12-11 19:45:34 +00:00
Peter Eisentraut 10e960fb39 Translation updates 2004-12-11 19:09:08 +00:00
Peter Eisentraut 022a00b5f3 Translation updates 2004-12-11 19:03:49 +00:00
Tom Lane d5df606cb2 ActiveSnapshot must be set to something valid while running deferred
triggers during COMMIT.  Per trouble report from Frank van Vugt.
2004-12-06 23:57:17 +00:00
Bruce Momjian e09567d850 Back out addition of Win1252 encoding. 2004-12-04 18:19:33 +00:00
Tom Lane 8090616847 Use StrNCpy not strncpy to fill hash key, to ensure the resulting key
is null-terminated.  I think this is not a real bug because the parser
would always have truncated the identifier to NAMEDATALEN-1 already,
but let's be safe.  Per report from Klocwork.
2004-12-03 21:26:31 +00:00
Bruce Momjian cb99679aad > If it bothers you that much. I'd make a flag, cleared at the start of
> each COPY, and then where we test for CR or LF in CopyAttributeOutCSV,
> if the flag is not set then set it and issue the warning.

Andrew Dunstan
2004-12-03 17:13:28 +00:00
Bruce Momjian 08e0b34bad Back out fix for Unicode characters above 0x10000 2004-12-03 01:20:33 +00:00
Bruce Momjian 1d006ce95e > I have installed your patch and adjusted the names of the standards
> throughout to the spellings suggested by your book.

Great.

A follow-up patch for current CVS HEAD is attached, and available at
http://troels.arvin.dk/db/pgsql/conformance/pgsql-sql-conformance-
followup.patch

The patch
 - includes a core feature ID that had been left
   out by mistake (C011)
 - updates the sql_feature_packages.txt table to
   reflect changes in SQL:2003 which were not
   covered properly in my last patch

Troels Arvin
2004-12-02 22:51:28 +00:00
Bruce Momjian 12e678201d > I enclose a short patch to reduce the PGARCH_RESTART_INTERVAL from 60
> seconds to 10 seconds. The original number was plucked from thin air
> some months ago, and I'd like to review that now based upon further
> thought, observation and experience.
>
> This change has little or no effect on performance, since the interval
> is there mainly to avoid repeated respawn attempts if archiver fails at
> startup. Archiver start-up time is very quick, so there is little danger
> of exceeding 10 seconds.
>
> On a busy system, if the archiver does die, then many files can build up
> in the 60 seconds before respawning. That xlog file backlog could take
> some time to clear. This then leaves a larger than normal window of data
> loss for a possibly long period.
>
> It's a minor change only, with no other effect on function.

Simon Riggs
2004-12-02 22:40:18 +00:00
Bruce Momjian 4ea4f8bd06 Fix for Unicode characters above 0x10000.
John Hansen
2004-12-02 22:37:14 +00:00
Bruce Momjian 917c8bb407 On win32, there is currently no way to get the equivalent function of
the "ps" argument list on Unix - meaning that there is no way to
identify for example the stats processors or the bgwriter.

This patch adds this functionality, in a bit of a crufty way. It creates
a kernel Event object with the name of what would be in the title. This
can be viewed using for example Process Explorer.

It's been very handy for me during both debugging and using. I haven't
figured a better way, but perhaps someone has one that's less crufty? If
not, here is at least a working patch :-)

Magnus Hagander
2004-12-02 22:28:22 +00:00
Bruce Momjian 7af770d005 Add Charset WIN1252 support.
Roland Volkmann
2004-12-02 22:14:38 +00:00
Bruce Momjian d76589114d Change Win32 dlerror message to:
return "dynamic loading error";
2004-12-02 19:38:50 +00:00
Tom Lane e9c03c3b1b Disallow the combination VACUUM FULL FREEZE for safety's sake, for the
reasons I outlined in pghackers a few days ago.

Also, undo someone's overly optimistic decision to reduce tuple state
checks from if (...) elog() to Asserts.  If I trusted this code more,
I might think it was a good idea to disable these checks in production
installations.  But I don't.
2004-12-02 19:28:49 +00:00
Tom Lane 76e8a87f15 Teach regex_fixed_prefix() the correct handling of advanced regex
escapes --- they aren't simply quoted characters.  Problem noted by
Antti Salmela.  Also fix problem with incorrect handling of multibyte
characters when followed by a quantifier.
2004-12-02 02:45:07 +00:00
Tom Lane 4e91824b94 Make some adjustments to reduce platform dependencies in plan selection.
In particular, there was a mathematical tie between the two possible
nestloop-with-materialized-inner-scan plans for a join (ie, we computed
the same cost with either input on the inside), resulting in a roundoff
error driven choice, if the relations were both small enough to fit in
sort_mem.  Add a small cost factor to ensure we prefer materializing the
smaller input.  This changes several regression test plans, but with any
luck we will now have more stability across platforms.
2004-12-02 01:34:18 +00:00
Tom Lane 1e6457dfce Fix timestamptz_age() to do calculation in local timezone not GMT, per bug 1332. 2004-12-01 19:57:49 +00:00
Tom Lane 5374d097de Change planner to use the current true disk file size as its estimate of
a relation's number of blocks, rather than the possibly-obsolete value
in pg_class.relpages.  Scale the value in pg_class.reltuples correspondingly
to arrive at a hopefully more accurate number of rows.  When pg_class
contains 0/0, estimate a tuple width from the column datatypes and divide
that into current file size to estimate number of rows.  This improved
methodology allows us to jettison the ancient hacks that put bogus default
values into pg_class when a table is first created.  Also, per a suggestion
from Simon, make VACUUM (but not VACUUM FULL or ANALYZE) adjust the value
it puts into pg_class.reltuples to try to represent the mean tuple density
instead of the minimal density that actually prevails just after VACUUM.
These changes alter the plans selected for certain regression tests, so
update the expected files accordingly.  (I removed join_1.out because
it's not clear if it still applies; we can add back any variant versions
as they are shown to be needed.)
2004-12-01 19:00:56 +00:00
Tom Lane 839484f9f5 Avoid scribbling on original parsetree during DECLARE CURSOR. This
prevents problems when the DECLARE is in a portal and is executed
repeatedly, as is possible in v3 protocol.  Per analysis by Oliver
Jowett, though I didn't use his patch exactly.
2004-11-28 22:16:31 +00:00
Peter Eisentraut 99b735cc03 Work around lack of NLS support in libpgport by making those components
who use it scan the relevant source files for their own catalog.  It
creates a bit of duplicate work for translators, but it gets the job done
for now.
2004-11-27 22:44:15 +00:00
Peter Eisentraut 49cbef7947 Update of conformance information to SQL:2003
by Troels Arvin, Simon Riggs, Elein Mustain

Make spelling of SQL standard names uniform.
2004-11-27 21:27:08 +00:00
Tom Lane d4c4d28427 Install Tcl regex fixes to sync our regex engine with Tcl 8.4.8 (up from
8.4.1).  This corrects some curious regex bugs, though not the greediness
issue I was hoping to find a solution for :-(
2004-11-24 22:56:54 +00:00
Tom Lane 236404fcd1 Our interface code for Spencer's regexp package was checking for regexp
error conditions during regexp compile, but not during regexp execution;
any sort of "can't happen" errors would be treated as no-match instead
of being reported as they should be.  Noticed while trying to duplicate
a reported Tcl bug.
2004-11-24 22:44:07 +00:00
Tom Lane cf796cc702 A client_encoding specification coming from the connection request has
to be processed by GUC before InitPostgres, because any required lookup
of the encoding conversion function has to be done during InitializeClientEncoding.
So, I broke this last week by moving GUC processing to after InitPostgres :-(.
What we can do as a compromise is process non-SUSET variables during
command line scanning (the same as before), and postpone the processing
of only SUSET variables.  None of the SUSET variables need to be set
before InitPostgres.
2004-11-24 19:51:05 +00:00
Neil Conway 4acc97d7e4 Assert that BufferIsPinned() in IncrBufferRefCount(), rather than using
a home-brewed combination of assertions that boiled down to the same
thing.
2004-11-24 02:56:17 +00:00
Tom Lane 294c34bb9d Fix rounding problem in dynahash.c's decision about when the target
fill factor has been exceeded.  We usually run with ffactor == 1, but
the way the test was coded, it wouldn't split a bucket until the actual
fill factor reached 2.0, because of use of integer division.  Change
from > to >= so that it will split more aggressively when the table
starts to get full.
2004-11-21 22:57:00 +00:00
Tom Lane 7f1711f29d Reduce the default size of the PortalHashTable in order to save a
few cycles during transaction exit.  A typical session probably
wouldn't have as many as half a dozen portals open at once, so the
original value of 64 seems far larger than needed.
2004-11-21 22:48:01 +00:00
Tom Lane c584103f56 Patch of 2004-03-30 corrected date_part(timestamp) for extracting
the year from a BC date, but failed to make the same fix in
date_part(timestamptz).
2004-11-20 22:12:44 +00:00
Tom Lane 3e3f283e31 Avoid scanning the relcache during AtEOSubXact_RelationCache when there
is nothing to do, which is most of the time.  This is another simple
improvement to cut subtransaction entry/exit overhead.
2004-11-20 20:19:52 +00:00
Tom Lane 8ecbc46bdb Reduce the default size of the local lock hash table. There's usually
no need for it to be nearly as big as the global hash table, and since
it's not in shared memory it can grow if it does need to be bigger.
By reducing the size, we speed up hash_seq_search(), which saves a
significant fraction of subtransaction entry/exit overhead.
2004-11-20 20:16:54 +00:00
Tom Lane d5013ab50f Fix one more place where we were expecting lcons() to be nondestructive
to the original List; per report from Sebastian BÎck.  I think this is
the last such bug --- I examined every lcons() call in the backend and
the rest seem OK --- but it's nervous-making that we're still finding
'em so many months after the List rewrite went in.
2004-11-20 17:59:31 +00:00
Tom Lane 83fea34b5b Fix unportable isdigit() call --- must cast arg to unsigned char. 2004-11-20 02:09:47 +00:00
Tom Lane 8a7025f0bb Move pgstat_report_tabstat() call so that stats are not reported to the
collector until the transaction commits.  Per recent discussion, this
should avoid confusing autovacuum when an updating transaction runs for
a long time.
2004-11-20 00:48:58 +00:00
Tom Lane 7506677b62 Improve error reporting for SSL connection failures. Remove redundant
free operations in client_cert_cb --- openssl will also attempt to free
these structures, resulting in core dumps.
2004-11-20 00:18:18 +00:00
Tom Lane da1c19aa57 Whoops, missed converting the other sleep() call to pg_usleep(). 2004-11-18 17:13:38 +00:00
Tom Lane b2a2f4cef7 Force pg_database updates out to disk immediately after ALTER DATABASE;
this is to avoid scenarios where incoming backends find no live copies
of a database's row because the only live copy is in an as-yet-unwritten
shared buffer, which they can't see.  Also, use FlushRelationBuffers()
for forcing out pg_database, instead of the much more expensive BufferSync().
There's no need to write out pages belonging to other relations.
2004-11-18 01:14:26 +00:00
Tom Lane edcaa8f691 Fix off-by-one memory allocation, as reported by Rod Taylor. Also
avoid repalloc'ing twice when once is sufficient.
2004-11-17 19:54:24 +00:00
Tom Lane 77fe4fd656 Use pg_usleep() not sleep(), per Andrew Dunstan. 2004-11-17 17:50:20 +00:00
Tom Lane 37d693033d Minor adjustment of message style. 2004-11-17 16:26:59 +00:00
Neil Conway 2fa36d7e41 Win32 build cleanups, from Andrew Dunstan. 2004-11-17 08:30:11 +00:00
Neil Conway ffe130f52e Remove debugging printf from #ifdef WIN32 section. 2004-11-17 04:05:42 +00:00
Neil Conway 5d1dd2bc55 Micro-optimization of markpos() and restrpos() in btree and hash indexes.
Rather than using ReadBuffer() to increment the reference count on an
already-pinned buffer, we should use IncrBufferRefCount() as it is
faster and does not require acquiring the BufMgrLock.
2004-11-17 03:13:38 +00:00
Neil Conway b25d23e1e6 Don't allow pg_start_backup() to be invoked if archive_command has not
been defined. Patch from Gavin Sherry, editorializing by Neil Conway.
2004-11-17 02:22:54 +00:00
Tom Lane 0021ae06be Fix Win32 problems with signals and sockets, by making the forkexec code
even uglier than it was already :-(.  Also, on Windows only, use temporary
shared memory segments instead of ordinary files to pass over critical
variable values from postmaster to child processes.  Magnus Hagander
2004-11-17 00:14:14 +00:00
Neil Conway e1bf6527f6 Prevent a backend crash when processing CREATE TABLE commands with
more than 65K columns, or when the created table has more than 65K columns
due to adding inherited columns from parent relations. Fix a similar
crash when processing SELECT queries with more than 65K target list
entries. In all three cases we would eventually detect the error and
elog, but the check was being made too late.
2004-11-16 23:34:26 +00:00
Peter Eisentraut 8a1821ab5b Translation update 2004-11-16 22:58:44 +00:00
Tom Lane 6beb6fa495 Use dynamically-sized buffers in pgwin32_is_service().
Magnus Hagander
2004-11-16 19:52:22 +00:00
Tom Lane 7efa8411cc Rethink plpgsql's way of handling SPI execution during an exception block.
We don't really want to start a new SPI connection, just keep using the old
one; otherwise we have memory management problems as illustrated by
John Kennedy's bug report of today.  This requires a bit of a hack to
ensure the SPI stack state is properly restored, but then again what we
were doing before was a hack too, strictly speaking.  Add a regression
test to cover this case.
2004-11-16 18:10:16 +00:00
Tom Lane ea23ec82c2 Remove GUC USERLIMIT variable category, making the affected variables
plain SUSET instead.  Also delay processing of options received in
client connection request until after we know if the user is a superuser,
so that SUSET values can be set that way by legitimate superusers.
Per recent discussion.
2004-11-14 19:35:35 +00:00
Neil Conway a236dd9536 There is no need for ReadBuffer() call sites to check that the returned
buffer is valid, as ReadBuffer() will elog on error. Most of the call
sites of ReadBuffer() got this right, but this patch fixes those call
sites that did not.
2004-11-14 02:04:14 +00:00
Bruce Momjian 03b12ef987 > I think in addition the system global name "sharemem.1" should be made more
> pg specific, like "PostgreSQL.1". I have not done this since a new compile
> would not detect a running old beta. But now would be the time (or never).

Zeugswetter Andreas
2004-11-12 17:59:42 +00:00
Tom Lane 5666485aa8 Remember to close the file on failure (pretty much redundant, really,
since this path will lead to postmaster exit anyway...)
2004-11-12 00:08:23 +00:00
Tom Lane 664f93ce18 Un-break custom_variable_classes kluge ... mea culpa. 2004-11-11 23:45:13 +00:00
Neil Conway 4d0f669f3c Remove obsolete comment from btbuild() and hashbuild(): we no longer use
a global variable to control building indexes.
2004-11-11 00:32:50 +00:00
Tom Lane 9a633cbb6c Allow planner to fold "stable" functions to constants when forming
selectivity estimates, per recent discussion.
2004-11-09 21:42:53 +00:00
Tom Lane 8f6278d907 Put in place some defenses against being fooled by accidental match of
shared memory segment ID.  If we can't access the existing shmem segment,
it must not be relevant to our data directory.  If we can access it,
then attach to it and check for an actual match to the data directory.
This should avoid some cases of failure-to-restart-after-boot without
introducing any significant risk of failing to detect a still-running
old backend.
2004-11-09 21:30:18 +00:00
Peter Eisentraut 1813d94664 Translation updates 2004-11-09 14:46:37 +00:00
Peter Eisentraut 3c093ff151 Clarify some error messages 2004-11-09 13:01:27 +00:00
Peter Eisentraut 5c398e6e70 Translation update 2004-11-09 13:00:05 +00:00
Tom Lane 547bb4a7f2 Use a hopefully-more-reliable method of detecting default selectivity
estimates when combining the estimates for a range query.  As pointed out
by Miquel van Smoorenburg, the existing check for an impossible combined
result would quite possibly fail to detect one default and one non-default
input.  It seems better to use the default range query estimate in such
cases.  To do so, add a check for an estimate of exactly DEFAULT_INEQ_SEL.
This is a bit ugly because it introduces additional coupling between
clauselist_selectivity and scalarltsel/scalargtsel, but it's not like
there wasn't plenty already...
2004-11-09 00:34:46 +00:00
Tom Lane 3a372d61d0 Kris Jurka pointed out that the qualified_name production wasn't
working as intended --- for some reason, FROM a.b.c was getting
parsed as if it were a function name and not a qualified name.
I think there must be a bug in bison, because it should have
complained that the grammar was ambiguous.  Anyway, fix it along
the same lines previously used for func_name vs columnref, and get
rid of the right-recursion in attrs that seems to have confused
bison.
2004-11-08 04:02:20 +00:00
Tom Lane 0d1ca2a474 Fix unportable code in SockAddr_cidr_mask: you can't assume that
shifting left by full word width gives zero.  Per bug report from
Tyson Thomson.
2004-11-08 01:54:40 +00:00
Peter Eisentraut 22aef89cbf Translation update 2004-11-07 23:29:35 +00:00
Tom Lane f245c4eb1a When implementing a coercion to a domain type with a combined
type-and-length coercion function, make sure that the coercion function
is told the correct typmod.  Fixes Kris Jurka's example of a domain
over bit(N).
2004-11-06 17:46:38 +00:00
Bruce Momjian fa00650d8a Now that we advertize only CIDR address in pg_hba.conf, remove
duplicates sample entries from comments.
2004-11-06 05:32:05 +00:00
Tom Lane 3d6e538edf pred_test() logic was being too narrow-minded about where it might find
RestrictInfo nodes in the query expression.  Per example from James Robinson.
2004-11-05 20:45:10 +00:00
Tom Lane 98e8b48053 Create 'default_tablespace' GUC variable that supplies a TABLESPACE
clause implicitly whenever one is not given explicitly.  Remove concept
of a schema having an associated tablespace, and simplify the rules for
selecting a default tablespace for a table or index.  It's now just
(a) explicit TABLESPACE clause; (b) default_tablespace if that's not an
empty string; (c) database's default.  This will allow pg_dump to use
SET commands instead of tablespace clauses to determine object locations
(but I didn't actually make it do so).  All per recent discussions.
2004-11-05 19:17:13 +00:00
Peter Eisentraut 0ed3c7665e Small message clarifications 2004-11-05 17:11:34 +00:00
Peter Eisentraut a23db90ce0 Translation update 2004-11-05 17:08:11 +00:00
Tom Lane e48b9b5570 Minor documentation updates from Simon Riggs. 2004-11-04 19:08:42 +00:00
Peter Eisentraut 005b1b5fc8 Translation updates 2004-11-02 09:20:22 +00:00
Bruce Momjian 0c3663b47d Add comment to postmaster.c that get_progname() will call exit if it
can't strdup().
2004-11-02 03:34:50 +00:00
Tom Lane c4acbb843b 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.)
2004-11-01 22:00:30 +00:00
Tom Lane 5ba04cd9f1 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.)
2004-11-01 21:34:44 +00:00
Bruce Momjian 9c3d654a16 Update comment to point to proper file. 2004-11-01 14:33:10 +00:00
Tom Lane 80559fa9e9 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.
2004-10-30 20:53:06 +00:00
Tom Lane 88868d4fbc 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
2004-10-30 20:44:43 +00:00
Tom Lane 23f264d125 Rearrange order of pre-commit operations: must close cursors before doing
ON COMMIT actions.  Per bug report from Michael Guerin.
2004-10-29 22:19:53 +00:00
Tom Lane f05cfd2c73 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.
2004-10-29 19:18:22 +00:00
Tom Lane ee69be44d5 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.
2004-10-29 00:16:08 +00:00
Tom Lane 319902dc8c Fix to_number for the case of a trailing S.
Karel Zak
2004-10-28 18:55:08 +00:00
Peter Eisentraut 5fef3c6ef0 Translation update 2004-10-28 09:38:27 +00:00
Neil Conway 6f1b3cf19c 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.
2004-10-28 01:38:41 +00:00
Tom Lane e6f9bf9b7f 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.
2004-10-28 00:39:59 +00:00
Tom Lane b2b0673e4b 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.
2004-10-27 18:09:41 +00:00
Peter Eisentraut 118bd91809 Translation update 2004-10-27 11:52:28 +00:00
Peter Eisentraut 979b0be4c3 Translation updates 2004-10-27 10:22:47 +00:00
Peter Eisentraut eb7fc3eb1f Translation updates 2004-10-27 10:13:49 +00:00
Tom Lane 83cd2d8b0f 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.
2004-10-26 16:05:03 +00:00
Tom Lane 2c66dcf684 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 :-( ...
2004-10-25 15:42:02 +00:00
Neil Conway ea7f2f6a58 Remove three unnecessary casts from a pointer type to char * when calling
pfree().
2004-10-25 06:27:21 +00:00
Neil Conway 86bcfc788b Fix tyop in comment. 2004-10-25 03:23:02 +00:00
Tom Lane 02ca529dd8 Make error message more verbose, in hopes of avoiding misunderstandings
such as bug #1293.
2004-10-25 03:08:29 +00:00
Neil Conway 8ec05b28b7 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().
2004-10-25 00:46:43 +00:00
Dennis Bjorklund 1b9c10275a Translation update 2004-10-24 14:55:04 +00:00
Tom Lane 529db99c6e Avoid overflow in cost_sort when work_mem exceeds 1Gb. 2004-10-23 00:05:27 +00:00
Tom Lane 9e83d73b6c 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?
2004-10-22 19:48:19 +00:00
Tom Lane 9309d5f2ba 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.
2004-10-22 17:20:05 +00:00
Dennis Bjorklund 7e62f0578a Translation updates. 2004-10-22 12:04:13 +00:00
Neil Conway 121aca39ba 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.
2004-10-22 07:21:06 +00:00
Tom Lane 12a47c6aca 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.
2004-10-21 21:33:59 +00:00
Tom Lane 380bd04c16 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.
2004-10-21 19:28:36 +00:00
Tom Lane fb22b32095 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.
2004-10-20 16:04:50 +00:00
Tom Lane a1bc728cf9 Add a HINT about the likely reason for 'invalid multibyte character for locale' failure. 2004-10-19 15:04:17 +00:00
Tom Lane c77d06633a 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.
2004-10-18 23:23:19 +00:00
Neil Conway 301d6e419c Trivial fix: remove a pointless cast. 2004-10-18 01:45:38 +00:00
Bruce Momjian 1311667b5c Fix some typos. 2004-10-17 23:39:22 +00:00
Tom Lane 4347cc2392 Allow background writing to be shut down by setting limit values to zero.
This does not disable the bgwriter process: it still has to wake up often
enough to collect fsync requests from backends in a timely fashion.  But
it responds to the recent gripe about not being able to prevent the disk
from being spun up constantly.
2004-10-17 22:01:51 +00:00
Tom Lane bdbe9c9f06 pg_get_indexdef() didn't do quite the right thing with identifying
an index's tablespace.
2004-10-17 21:17:27 +00:00
Peter Eisentraut 2ae65595cc Translation update 2004-10-17 21:08:22 +00:00
Tom Lane 830c168e5c Give a more user-friendly error message in situation where CREATE DATABASE
specifies a new default tablespace and the template database already has
some tables in that tablespace.  There isn't any way to solve this fully
without modifying the clone database's pg_class contents, so for now the
best we can do is issue a better error message.
2004-10-17 20:47:21 +00:00
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