Commit Graph

6800 Commits

Author SHA1 Message Date
Bruce Momjian da9a8649d8 Update copyright to 2004. 2004-08-29 04:13:13 +00:00
Bruce Momjian 466c1290df Fix for postmaster.c function win32_waitpid(int *exitstatus) call to
Win32 WaitForMultipleObjects:

	ret = WaitForMultipleObjects(win32_numChildren, win32_childHNDArray,
	FALSE, 0);

Problem is 'win32_numChildren' could be more then 64 ( function supports
), problem basically arise ( kills postgres ) when you create more then
64 connections and terminate some of them sill leaving more then 64.

Claudio Natoli
2004-08-29 03:16:30 +00:00
Bruce Momjian 61384de6f9 Add hint about using GRANT with non-trusted languages.
James William Pye
2004-08-29 03:04:15 +00:00
Bruce Momjian 0476bbbc9b Several Cygwin fixes pointed out by Reini Urban. 2004-08-29 02:58:50 +00:00
Bruce Momjian 704ff0b2f2 >>> I understand your disliking of non-posix stuff. OTOH,
>>GetLastError will
>>> give much more details than errno.
>>
>>How much more, really?  That mapping table gave me the impression that
>>the win32 error codes aren't all that much more detailed than errno...
>
>The mapping table is not complete. My winerror.h from the SDK
>lists 2209
>error codes, whereas errno.h lists 42...
>
>I still don't think we'll get that much more stuff. Right now,
>the Win32
>code paths that actually use the more advanced functions already write
>out the error number in case something happens. We can keep doing that
>for the other paths (ereport the error *number* when the mapping does
>not have a match). The map to errno will catch almost all cases, I
>think. And in the corner cases we can do with just the number, and use
>"net helpmsg" to get the actual message when checking...

Here's an attempt on this. new file goes in backend/port/win32.

Magnus Hagander
2004-08-29 00:38:03 +00:00
Tom Lane f78ecbf20e Now that TransactionIdDidAbort doesn't think it should try to modify
pg_clog, there's no reason to do abort marking of subtransactions in a
nonintuitive order.
2004-08-28 22:04:12 +00:00
Tom Lane 7531d2fd85 Add missing Assert to make TransactionIdDidAbort more consistent with
TransactionIdDidCommit.
2004-08-28 21:58:59 +00:00
Tom Lane 448eb0837f Rearrange order of operations in heap_drop_with_catalog and index_drop
so that we close and flush the doomed relation's relcache entry before
we start to delete the underlying catalog rows, rather than afterwards.
For awhile yesterday I thought that an unexpected relcache entry rebuild
partway through this sequence might explain the infrequent parallel
regression failures we were chasing.  It doesn't, mainly because there's
no CommandCounterIncrement in the sequence and so the deletions aren't
"really" done yet.  But it sure seems like trouble waiting to happen.
2004-08-28 21:05:26 +00:00
Bruce Momjian cc28a275cb Use dynamic buffer for token buffer in win32 admin check
Magnus Hagander
2004-08-28 21:00:35 +00:00
Tom Lane 1c72d0dec1 Fix relcache to account properly for subtransaction status of 'new'
relcache entries.  Also, change TransactionIdIsCurrentTransactionId()
so that if consulted during transaction abort, it will not say that
the aborted xact is still current.  (It would be better to ensure that
it's never called at all during abort, but I'm not sure we can easily
guarantee that.)  In combination, these fix a crash we have seen
occasionally during parallel regression tests of 8.0.
2004-08-28 20:31:44 +00:00
Joe Conway f900af7961 Further tightening of the array literal parser. Prevent junk
from being accepted after the outer right brace. Per report from
Markus Bertheau.

Also add regression test cases for this change, and for previous
recent array literal parser changes.
2004-08-28 19:31:29 +00:00
Tom Lane f444dafab0 Can't truncate pg_subtrans during a recovery checkpoint --- subtrans
module isn't fully initialized yet.
2004-08-28 18:18:03 +00:00
Tom Lane 3e3f70a28a Fix Windows emulation of kill(pid, 0). This will now succeed, but only
if the target PID is a PG postmaster or backend --- for our purposes that
is actually better than the Unix behavior.  Per Dave Page and Andrew Dunstan.
2004-08-27 18:31:48 +00:00
Tom Lane 1785acebf2 Introduce local hash table for lock state, as per recent proposal.
PROCLOCK structs in shared memory now have only a bitmask for held
locks, rather than counts (making them 40 bytes smaller, which is a
good thing).  Multiple locks within a transaction are counted in the
local hash table instead, and we have provision for tracking which
ResourceOwner each count belongs to.  Solves recently reported problem
with memory leakage within long transactions.
2004-08-27 17:07:42 +00:00
Tom Lane 337b513e07 Fix user locks. Broken some time ago for all platforms by Windows-related
changes.
2004-08-26 17:23:30 +00:00
Bruce Momjian 32142e2a60 Update documentation to prefer CIDR format for pg_hba.conf and use new
CIDR column in examples first.
2004-08-26 16:50:05 +00:00
Bruce Momjian 8ec3221d32 Update Win32 wording. 2004-08-26 13:44:38 +00:00
Tom Lane fe455ee1d4 Revise ResourceOwner code to avoid accumulating ResourceOwner objects
for every command executed within a transaction.  For long transactions
this was a significant memory leak.  Instead, we can delete a portal's
or subtransaction's ResourceOwner immediately, if we physically transfer
the information about its locks up to the parent owner.  This does not
fully solve the leak problem; we need to do something about counting
multiple acquisitions of the same lock in order to fix it.  But it's a
necessary step along the way.
2004-08-25 18:43:43 +00:00
Peter Eisentraut b662311db0 Translation update 2004-08-24 21:45:40 +00:00
Tom Lane 3cb1ffa653 Allow second and subsequent names in a qualified (dotted) name to be
ColLabel instead of just ColId --- that is, any keyword can appear after
a dot and it will be taken as an identifier.  Fixes problems with names
that are okay as standalone function names but fail when qualified.
2004-08-24 20:41:40 +00:00
Tom Lane 4dbb880d3c Rearrange pg_subtrans handling as per recent discussion. pg_subtrans
updates are no longer WAL-logged nor even fsync'd; we do not need to,
since after a crash no old pg_subtrans data is needed again.  We truncate
pg_subtrans to RecentGlobalXmin at each checkpoint.  slru.c's API is
refactored a little bit to separate out the necessary decisions.
2004-08-23 23:22:45 +00:00
Tom Lane f009c316ba Tweak code so that pg_subtrans is never consulted for XIDs older than
RecentXmin (== MyProc->xmin).  This ensures that it will be safe to
truncate pg_subtrans at RecentGlobalXmin, which should largely eliminate
any fear of bloat.  Along the way, eliminate SubTransXidsHaveCommonAncestor,
which isn't really needed and could not give a trustworthy result anyway
under the lookback restriction.
In an unrelated but nearby change, #ifdef out GetUndoRecPtr, which has
been dead code since 2001 and seems unlikely to ever be resurrected.
2004-08-22 02:41:58 +00:00
Tom Lane 37d937ea2c Code review for ALTER INDEX patch. 2004-08-22 00:08:28 +00:00
Bruce Momjian d21eabc61a Remove Solaris bug mention in pg_hba.conf. 2004-08-21 03:21:57 +00:00
Bruce Momjian 009b0d1a85 >>At this stage of the game I would just change pg_hba.conf.sample to use
>>'127.0.0.1/32' instead of '127.0.0.1 255.255.255.255'.
>>
>>
>
>Yeah, that's probably the path of least resistance.  Note that the
>comments and possibly the SGML docs need to be adjusted to match,
>however, so it's not quite a one-liner.

Andrew Dunstan
2004-08-20 20:23:06 +00:00
Bruce Momjian 09d4e96d7e Add ALTER INDEX, particularly for moving tablespaces.
Gavin Sherry
2004-08-20 04:29:33 +00:00
Bruce Momjian 46be0c18f1 > After all that about numbering centuries and millenia correctly,
> why does CVS tip still give me
>
> regression=# select extract(century from now());
>  date_part
> -----------
>         20
> (1 row)
> [ ... looks in code ... ]
>
> Apparently it's because you fixed only timestamp_part, and not
> timestamptz_part.  I'm not too sure about what timestamp_trunc or
> timestamptz_trunc should do, but they may be wrong as well.

Sigh... as usual, what is not tested does not work:-(


> Could we have a more complete patch?

Please find a submission attached. I hope it really fixes all decade,
century and millenium issues for extract and *_trunc functions on
interval
and other timestamp types. If someone could check that the results
are reasonnable, it would be great.

I indeed overlooked the fact that there were two functions. The patch
fixes the code so that both variants agree.

I added comments to interval extractions, because it relies on the C
division to have a negative remainder: -7/10 = 0 and remains -7.

As for *_trunc functions, I have chosen to put the first year of the
century or millennium: -100, 1, 101... 1001 2001 etc. Indeed, I don't
think it would make sense to put 2000 (last year of the 2nd millennium)
for rounding all years of the third millenium.

I also fixed the code so that all decades last 10 years and decade 199
means the 1990's.

I have added some tests that are relevant to deal with tricky cases. The
formula may be simplified, but all these cases must pass. Please keep
them.

Fabien Coelho
2004-08-20 03:45:14 +00:00
Tom Lane bbd6eb5b95 Repair some issues with column aliases and RowExpr construction in the
presence of dropped columns.  Document the already-presumed fact that
eref aliases in relation RTEs are supposed to have entries for dropped
columns; cause the user alias structs to have such entries too, so that
there's always a one-to-one mapping to the underlying physical attnums.
Adjust expandRTE() and related code to handle the case where a column
that is part of a JOIN has been dropped.  Generalize expandRTE()'s API
so that it can be used in a couple of places that formerly rolled their
own implementation of the same logic.  Fix ruleutils.c to suppress
display of aliases for columns that were dropped since the rule was made.
2004-08-19 20:57:41 +00:00
Tom Lane 19cd31b068 Fix bug introduced into _bt_getstackbuf() on 2003-Feb-21: the initial
value of 'start' could be past the end of the page, if the page was
split by some concurrent inserting process since we visited it.  In
this situation the code could look at bogus entries and possibly find
a match (since after all those entries still contain what they had
before the split).  This would lead to 'specified item offset is too large'
followed by 'PANIC: failed to add item to the page', as reported by Joe
Conway for scenarios involving heavy concurrent insertion activity.
2004-08-17 23:15:33 +00:00
Tom Lane fcaad7e2c1 Standardize on the assumption that the arguments of a RowExpr correspond
to the physical layout of the rowtype, ie, there are dummy arguments
corresponding to any dropped columns in the rowtype.  We formerly had a
couple of places that did it this way and several others that did not.
Fixes Gaetano Mendola's "cache lookup failed for type 0" bug of 5-Aug.
2004-08-17 18:47:09 +00:00
Tom Lane e617fe729d Mark server_encoding and integer_datetimes as GUC_REPORT, per previous
proposals by Oliver Jowett.  Update documentation.
2004-08-16 02:12:29 +00:00
Tom Lane 1a3de15a3a Dept. of further reflection: I looked around to see if any other callers
of XLogInsert had the same sort of checkpoint interlock problem as
RecordTransactionCommit, and indeed I found some.  Btree index build
and ALTER TABLE SET TABLESPACE write data outside the friendly confines
of the buffer manager, and therefore they have to take their own
responsibility for checkpoint interlock.  The easiest solution seems to
be to force smgrimmedsync at the end of the index build or table copy,
even when the operation is being WAL-logged.  This is sufficient since
the new index or table will be of interest to no one if we don't get
as far as committing the current transaction.
2004-08-15 23:44:46 +00:00
Tom Lane 057ea3471f Xmin calculations should consider only top transaction IDs, and
therefore starting with GetCurrentTransactionId is wrong.  Fixes
miscomputation of RecentGlobalXmin leading to bizarre behavior
reported by Gavin Sherry.
2004-08-15 17:03:36 +00:00
Tom Lane 2820f05ef9 Specify SA_NOCLDSTOP when enabling SIGCHLD, per suggestion from
Oliver Jowett.
2004-08-15 05:25:10 +00:00
Peter Eisentraut 3ea6d6d4d5 Translation updates 2004-08-14 19:16:07 +00:00
Peter Eisentraut 3458a380d3 Translation update 2004-08-13 16:43:06 +00:00
Tom Lane 79f9ee9d15 Fix core dumps, inability to count, etc associated with canonicalize_path
patches.
2004-08-13 14:47:23 +00:00
Tom Lane d785841f83 Change order of operations in ALTER TABLE SET TABLESPACE so that we
don't hold an open file reference to the original table at the end.
This is a good thing in any case, particularly so on Windows which
cannot drop the table file otherwise.
2004-08-13 04:50:28 +00:00
Tom Lane 7f7e8cc3f2 Allow commas in BEGIN, START TRANSACTION, and SET TRANSACTION, as required
by the SQL standard.  For backwards compatibility, however, continue to
accept the syntax without.  Minor editorialization in the reference pages
for these commands, too.
2004-08-12 21:00:34 +00:00
Tom Lane a583675108 Allow optional SAVEPOINT keyword in RELEASE and ROLLBACK TO, for greater
compliance with SQL2003 spec syntax.

Oliver Jowett
2004-08-12 19:12:21 +00:00
Bruce Momjian 10249abfa1 Cleanup Win32 COPY handling, and move archive examples to SGML. 2004-08-12 19:03:44 +00:00
Bruce Momjian 43ea65a0dc Add mention of "WIN32" COPY. 2004-08-12 18:34:45 +00:00
Bruce Momjian 6525b42b10 Add make_native_path() because Win32 COPY is an internal CMD.EXE command
and doesn't process forward slashes in the same way as external
commands.  Quoting the first argument to COPY does not convert forward
to backward slashes, but COPY does properly process quoted forward
slashes in the second argument.

Win32 COPY works with quoted forward slashes in the first argument only if the
current directory is the same as the directory of the first argument.
2004-08-12 18:32:52 +00:00
Tom Lane aff700a160 Avoid crashing when restoring a saved GUC session_authorization value
that refers to a now-deleted userid.  Per gripe from Chris Ochs.
2004-08-11 21:10:37 +00:00
Tom Lane b2d9fbeef2 Work around broken strtod() that's present in many Solaris releases.
Thanks to Michael Fuhr for identifying the problem.
2004-08-11 17:20:50 +00:00
Peter Eisentraut 3ae6531673 Add translation from 7.4 branch to head. 2004-08-11 09:00:27 +00:00
Tom Lane 3fdf649f4f Fix failure to guarantee that a checkpoint will write out pg_clog updates
for transaction commits that occurred just before the checkpoint.  This is
an EXTREMELY serious bug --- kudos to Satoshi Okada for creating a
reproducible test case to prove its existence.
2004-08-11 04:07:16 +00:00
Peter Eisentraut a2ec3fe817 New translation 2004-08-10 19:10:21 +00:00
Peter Eisentraut e21e121999 Translation update 2004-08-10 18:38:19 +00:00
Tom Lane 8cf8b47a21 syslogger.c needs <sys/time.h> on some platforms, per Greg Mullane. 2004-08-09 20:28:48 +00:00