Commit Graph

20611 Commits

Author SHA1 Message Date
Bruce Momjian c7c012ce56 Update comment about why postmaster doesn't get an icon. 2010-05-12 23:48:36 +00:00
Bruce Momjian 0c6b9308de Remove Makefile PGFILEDESC tag that the postmaster is an executable. 2010-05-12 21:42:21 +00:00
Simon Riggs 66035734ec Give most recovery conflict errors a retryable error code. From recent
requests and discussions with Yeb Havinga and Kevin Grittner.
2010-05-12 19:45:02 +00:00
Bruce Momjian 395d1259ad Add PGFILEDESC description to Makefiles for all /contrib executables.
Add PGAPPICON to all executable makefiles.
2010-05-12 11:33:10 +00:00
Tom Lane 28e1742217 Update time zone data files to tzdata release 2010j: DST law changes in
Argentina, Australian Antarctic, Bangladesh, Mexico, Morocco, Pakistan,
Palestine, Russia, Syria, Tunisia.  Historical corrections for Taiwan.
2010-05-11 23:01:27 +00:00
Tom Lane af9a54b663 Add PKST to the default set of timezone abbreviations.
Per discussion, if we have PKT in there then PKST should be too.
Also, fix mistaken claim that these abbrevs are not known to zic.
2010-05-11 22:36:52 +00:00
Robert Haas dd6fcd35e3 Change typedef for rb_appendator to avoid conflict with C++ reserved words.
Fixes a complaint from src/tools/pginclude/cpluspluscheck reported by
Peter Eisentraut.
2010-05-11 18:14:01 +00:00
Tom Lane 4a69624f49 Cause the archiver process to adopt new postgresql.conf settings (particularly
archive_command) as soon as possible, namely just before issuing a new call
of archive_command, even when there is a backlog of files to be archived.
The original coding would only absorb new settings after clearing the backlog
and returning to the outer loop.  Per discussion.

Back-patch to 8.3.  The logic in prior versions is a bit different and it
doesn't seem worth taking any risks of breaking it.
2010-05-11 16:42:28 +00:00
Tom Lane b7987f8a94 Fix incorrect patch that removed permission checks on inheritance child
tables --- the parent table no longer got checked, either.  Per bug #5458
from Takahiro Itagaki.
2010-05-11 15:31:37 +00:00
Itagaki Takahiro 5d6d037822 Set per-function GUC settings during validating the function.
Now validators work properly even when the settings contain
parameters that affect behavior of the function, like search_path.

Reported by Erwin Brandstetter.
2010-05-11 04:52:28 +00:00
Tom Lane ed83f6e382 When adding a "target IS NOT NULL" indexqual to the plan for an index-optimized
MIN or MAX, we must take care to insert the added qual in a legal place among
the existing indexquals, if any.  The btree index AM requires the quals to
appear in index-column order.  We didn't have to worry about this before
because "target IS NOT NULL" was just treated as a plain scan filter condition;
but as of 9.0 it can be an index qual and then it has to follow the rule.
Per report from Ian Barwick.
2010-05-10 16:25:46 +00:00
Tom Lane 7fdbb8e353 Suppress signed-vs-unsigned-char warning. 2010-05-09 18:17:47 +00:00
Tom Lane 2ea56cbda6 Fix missing static declaration for XLogRead(). 2010-05-09 18:11:55 +00:00
Tom Lane ed437e2b27 Adjust comments about avoiding use of printf's %.*s.
My initial impression that glibc was measuring the precision in characters
(which is what the Linux man page says it does) was incorrect.  It does take
the precision to be in bytes, but it also tries to truncate the string at a
character boundary.  The bottom line remains the same: it will mess up
if the string is not in the encoding it expects, so we need to avoid %.*s
anytime there's a significant risk of that.  Previous code changes are still
good, but adjust the comments to reflect this knowledge.  Per research by
Hernan Gonzalez.
2010-05-09 02:16:00 +00:00
Tom Lane 54cd4f0457 Work around a subtle portability problem in use of printf %s format.
Depending on which spec you read, field widths and precisions in %s may be
counted either in bytes or characters.  Our code was assuming bytes, which
is wrong at least for glibc's implementation, and in any case libc might
have a different idea of the prevailing encoding than we do.  Hence, for
portable results we must avoid using anything more complex than just "%s"
unless the string to be printed is known to be all-ASCII.

This patch fixes the cases I could find, including the psql formatting
failure reported by Hernan Gonzalez.  In HEAD only, I also added comments
to some places where it appears safe to continue using "%.*s".
2010-05-08 16:39:53 +00:00
Michael Meskes 71a185a24d ECPG connect routine only checked for NULL to find empty parameters, but user and password can also be "". 2010-05-07 19:35:03 +00:00
Tom Lane cd86869a9a On Linux, use --enable-new-dtags when specifying -rpath to linker.
This should allow LD_LIBRARY_PATH to work as desired.  Per trouble
report from Andy Colson.
2010-05-06 19:28:25 +00:00
Itagaki Takahiro 72ee670323 Code page for EUC-KR is surely 51949. 2010-05-06 02:12:38 +00:00
Tom Lane 93dc6a1b39 Fix psql to not go into infinite recursion when expanding a variable that
refers to itself (directly or indirectly).  Instead, print a message when
recursion is detected, and don't expand the repeated reference.  Per bug
#5448 from Francis Markham.

Back-patch to 8.0.  Although the issue exists in 7.4 as well, it seems
impractical to fix there because of the lack of any state stack that
could be used to track active expansions.
2010-05-05 22:18:56 +00:00
Heikki Linnakangas ffe8c7c677 Need to hold ControlFileLock while updating control file. Update
minRecoveryPoint in control file when replaying a parameter change record,
to ensure that we don't allow hot standby on WAL generated without
wal_level='hot_standby' after a standby restart.
2010-05-03 11:17:52 +00:00
Tom Lane 609a63fd85 Improve printing of XLOG_HEAP_NEWPAGE records to include the forknum. 2010-05-02 22:37:43 +00:00
Tom Lane e55e6ecfe4 Fix replay of XLOG_HEAP_NEWPAGE WAL records to pay attention to the forknum
field of the WAL record.  The previous coding always wrote to the main fork,
resulting in data corruption if the page was meant to go into a non-default
fork.

At present, the only operation that can produce such WAL records is
ALTER TABLE/INDEX SET TABLESPACE when executed with archive_mode = on.
Data corruption would be observed on standby slaves, and could occur on the
master as well if a database crash and recovery occurred after committing
the ALTER and before the next checkpoint.  Per report from Gordon Shannon.

Back-patch to 8.4; the problem doesn't exist in earlier branches because
we didn't have a concept of multiple relation forks then.
2010-05-02 22:28:05 +00:00
Simon Riggs 3a0939eda2 Update standbycheck test output with new ERROR message changes. No changes
to tests and no changes in accepted server behaviour.
2010-05-02 12:28:43 +00:00
Tom Lane f9ed327f76 Clean up some awkward, inaccurate, and inefficient processing around
MaxStandbyDelay.  Use the GUC units mechanism for the value, and choose more
appropriate timestamp functions for performing tests with it.  Make the
ps_activity manipulation in ResolveRecoveryConflictWithVirtualXIDs have
behavior similar to ps_activity code elsewhere, notably not updating the
display when update_process_title is off and not truncating the display
contents at an arbitrarily-chosen length.  Improve the docs to be explicit
about what MaxStandbyDelay actually measures, viz the difference between
primary and standby servers' clocks, and the possible hazards if their clocks
aren't in sync.
2010-05-02 02:10:33 +00:00
Tom Lane 154163238e Add code to InternalIpcMemoryCreate() to handle the case where shmget()
returns EINVAL for an existing shared memory segment.  Although it's not
terribly sensible, that behavior does meet the POSIX spec because EINVAL
is the appropriate error code when the existing segment is smaller than the
requested size, and the spec explicitly disclaims any particular ordering of
error checks.  Moreover, it does in fact happen on OS X and probably other
BSD-derived kernels.  (We were able to talk NetBSD into changing their code,
but purging that behavior from the wild completely seems unlikely to happen.)
We need to distinguish collision with a pre-existing segment from invalid size
request in order to behave sensibly, so it's worth some extra code here to get
it right.  Per report from Gavin Kistner and subsequent investigation.

Back-patch to all supported versions, since any of them could get used
with a kernel having the debatable behavior.
2010-05-01 22:46:30 +00:00
Tom Lane f5c23ca208 Fix leakage of proc-related storage in plpython's inline handler.
Per report from Andres Freund.
2010-05-01 17:04:38 +00:00
Tom Lane b1bc2f0425 Fix multiple memory leaks in PLy_spi_execute_fetch_result: it would leak
memory if the result had zero rows, and also if there was any sort of error
while converting the result tuples into Python data.  Reported and partially
fixed by Andres Freund.

Back-patch to all supported versions.  Note: I haven't tested the 7.4 fix.
7.4's configure check for python is so obsolete it doesn't work on my
current machines :-(.  The logic change is pretty straightforward though.
2010-04-30 19:15:45 +00:00
Tom Lane 0954358047 Fix a couple of places where the result of fgets() wasn't checked.
This is mostly to suppress compiler warnings, although in principle
the cases could result in undesirable behavior.

Martin Pitt
2010-04-30 17:09:13 +00:00
Heikki Linnakangas 21992dd4f5 Fix handling of b-tree reuse WAL records when hot standby is disabled,
and add missing code in btree_desc for them. This fixes the bug
with "tree_redo: unknown op code 208" error reported by Jaime Casanova.
2010-04-30 06:34:29 +00:00
Marc G. Fournier f9d9b2b34a tag for 9.0beta1 2010-04-30 03:16:58 +00:00
Tom Lane 69f7a4d8e3 Adjust error checks in pg_start_backup and pg_stop_backup to make it possible
to perform a backup without archive_mode being enabled.  This gives up some
user-error protection in order to improve usefulness for streaming-replication
scenarios.  Per discussion.
2010-04-29 21:49:03 +00:00
Tom Lane f0488bd57c Rename the parameter recovery_connections to hot_standby, to reduce possible
confusion with streaming-replication settings.  Also, change its default
value to "off", because of concern about executing new and poorly-tested
code during ordinary non-replicating operation.  Per discussion.

In passing do some minor editing of related documentation.
2010-04-29 21:36:19 +00:00
Tom Lane f4ec2fabbf Modify information_schema._pg_keysequal() to avoid search path risk when
contrib/intarray is loaded.  Per bug #5417 from Kenaniah Cerny.

Not forcing initdb since backend doesn't directly depend on this,
and few people have run into it.
2010-04-28 21:18:07 +00:00
Tom Lane c80a85e3cd Minor editorializing on pg_controldata and pg_resetxlog: adjust some message
wording, deal explicitly with some fields that were being silently left zero.
2010-04-28 19:38:49 +00:00
Tom Lane 82e38abaf1 pg_controldata needs #define FRONTEND, same as pg_resetxlog.
Per buildfarm results from dawn_bat.
2010-04-28 17:35:35 +00:00
Tom Lane 77acab75df Modify ShmemInitStruct and ShmemInitHash to throw errors internally,
rather than returning NULL for some-but-not-all failures as they used to.
Remove now-redundant tests for NULL from call sites.

We had to do something about this because many call sites were failing to
check for NULL; and changing it like this seems a lot more useful and
mistake-proof than adding checks to the call sites without them.
2010-04-28 16:54:16 +00:00
Heikki Linnakangas 9b8a73326e Introduce wal_level GUC to explicitly control if information needed for
archival or hot standby should be WAL-logged, instead of deducing that from
other options like archive_mode. This replaces recovery_connections GUC in
the primary, where it now has no effect, but it's still used in the standby
to enable/disable hot standby.

Remove the WAL-logging of "unlogged operations", like creating an index
without WAL-logging and fsyncing it at the end. Instead, we keep a copy of
the wal_mode setting and the settings that affect how much shared memory a
hot standby server needs to track master transactions (max_connections,
max_prepared_xacts, max_locks_per_xact) in pg_control. Whenever the settings
change, at server restart, write a WAL record noting the new settings and
update pg_control. This allows us to notice the change in those settings in
the standby at the right moment, they used to be included in checkpoint
records, but that meant that a changed value was not reflected in the
standby until the first checkpoint after the change.

Bump PG_CONTROL_VERSION and XLOG_PAGE_MAGIC. Whack XLOG_PAGE_MAGIC back to
the sequence it used to follow, before hot standby and subsequent patches
changed it to 0x9003.
2010-04-28 16:10:43 +00:00
Magnus Hagander 81fb51732e Fix typo that had the code check the same thing twice.
Fujii Masao
2010-04-28 13:46:23 +00:00
Tom Lane 2c265adea3 Modify the built-in text search parser to handle URLs more nearly according
to RFC 3986.  In particular, these characters now terminate the path part
of a URL: '"', '<', '>', '\', '^', '`', '{', '|', '}'.  The previous behavior
was inconsistent and depended on whether a "?" was present in the path.
Per gripe from Donald Fraser and spec research by Kevin Grittner.

This is a pre-existing bug, but not back-patching since the risks of
breaking existing applications seem to outweigh the benefits.
2010-04-28 02:04:16 +00:00
Tom Lane d64b110a64 Fix stupid typo in refnameRangeTblEntry() --- mea maxima culpa.
Per report from Josh.
2010-04-28 00:46:33 +00:00
Itagaki Takahiro 7780c4124b Add CP949 as an alias for UHC encoding. pg_get_encoding_from_locale()
with kor locale on Windows can use the path.

Reported by Hiroshi Inoue.
2010-04-28 00:29:16 +00:00
Tom Lane 2871b4618a Replace the KnownAssignedXids hash table with a sorted-array data structure,
and be more tense about the locking requirements for it, to improve performance
in Hot Standby mode.  In passing fix a few bugs and improve a number of
comments in the existing HS code.

Simon Riggs, with some editorialization by Tom
2010-04-28 00:09:05 +00:00
Heikki Linnakangas 3efba16d56 If a base backup is cancelled by server shutdown or crash, throw an error
in WAL recovery when it sees the shutdown checkpoint record. It's more
user-friendly to find out about it at that point than at the end of
recovery, and you're not left wondering why your hot standby server never
opens up for read-only connections.
2010-04-27 09:25:18 +00:00
Tom Lane 8f0ab2298f Add missing newlines in WPARSER_TRACE output. 2010-04-26 17:10:18 +00:00
Bruce Momjian 75c5738177 Reorder pg_stat_activity columns to be more consistent, using layout
suggested by Tom Lane.

Catalog version bumped due to system view change.
2010-04-26 14:22:37 +00:00
Bruce Momjian 7eb6e6b48a Add comments about why we set LC_CTYPE in WIN32 for time when we don't
actually access it, per information from Hiroshi.
2010-04-26 14:17:52 +00:00
Robert Haas ab93cd9b05 When we're restricting who can connect, don't allow new walsenders.
Normal superuser processes are allowed to connect even when the database
system is shutting down, or when fewer than superuser_reserved_connection
slots remain.  This is intended to make sure an administrator can log in
and troubleshoot, so don't extend these same courtesies to users connecting
for replication.
2010-04-26 10:52:00 +00:00
Bruce Momjian 22da73198f Add C comments for recent to_char('L') fix for Win32. 2010-04-24 22:54:56 +00:00
Simon Riggs 90e04bab39 Patch revoked because of objections. 2010-04-24 16:20:32 +00:00
Robert Haas 33980a0640 Fix various instances of "the the".
Two of these were pointed out by Erik Rijkers; the rest I found.
2010-04-23 23:21:44 +00:00