Commit Graph

32465 Commits

Author SHA1 Message Date
Simon Riggs dde70cc313 Emit cascaded standby message on shutdown only when appropriate.
Adds additional test for active walsenders and closes a race
condition for when we failover when a new walsender was connecting.

Reported and fixed bu Fujii Masao. Review by Heikki Linnakangas
2011-09-07 09:09:47 +01:00
Bruce Momjian 39039e6d7a Properly document the existance of OLD/NEW trigger pl/pgsql trigger
fields.

Backpatch to 9.0 and 9.1.

Report from Pavel Stehule, patch from Josh Kupershmidt
2011-09-06 22:54:16 -04:00
Bruce Momjian d858abfdfd Fix spelling mistake in pgpass documentation change.
Per Peter.
2011-09-06 19:42:46 -04:00
Bruce Momjian a25fc9edcb Add documentation suggestion about adding a comment to the top of
pgpass.

Backpatch to 9.1.
2011-09-06 17:32:53 -04:00
Tom Lane db10f01baa Improve comment about handling of temp tables in shared-inval code. 2011-09-06 17:06:54 -04:00
Peter Eisentraut e6d800981e Correct ancient logic mistake in assertion
Found by gcc -Wlogical-op
2011-09-06 23:05:02 +03:00
Bruce Momjian ba3de10c4e Fix plpgsql "PERFORM" markup.
Backpatch to 9.0 and 9.1.
2011-09-06 15:20:59 -04:00
Tom Lane 623f77e9d1 Avoid possibly accessing off the end of memory in SJIS2004 conversion.
The code in shift_jis_20042euc_jis_2004() would fetch two bytes even when
only one remained in the string.  Since conversion functions aren't
supposed to assume null-terminated input, this poses a small risk of
fetching past the end of memory and incurring SIGSEGV.  No such crash has
been identified in the field, but we've certainly seen the equivalent
happen in other code paths, so patch this one all the way back.

Report and patch by Noah Misch.
2011-09-06 14:50:28 -04:00
Tom Lane 780a342c90 Avoid possibly accessing off the end of memory in examine_attribute().
Since the last couple of columns of pg_type are often NULL,
sizeof(FormData_pg_type) can be an overestimate of the actual size of the
tuple data part.  Therefore memcpy'ing that much out of the catalog cache,
as analyze.c was doing, poses a small risk of copying past the end of
memory and incurring SIGSEGV.  No such crash has been identified in the
field, but we've certainly seen the equivalent happen in other code paths,
so patch this one all the way back.

Per valgrind testing by Noah Misch, though this is not his proposed patch.
I chose to use SearchSysCacheCopy1 rather than inventing special-purpose
infrastructure for copying only the minimal part of a pg_type tuple.
2011-09-06 14:37:22 -04:00
Bruce Momjian 6f94280dee Document PERFORM limitation when using WITH queries.
Backpatch to 9.0 and 9.1.

Report from depstein@alliedtesting.com.
2011-09-06 13:42:08 -04:00
Tom Lane ae92eff6b9 Add an "incompatibility" entry to 9.1 release notes about CREATE EXTENSION.
We've now seen more than one gripe from somebody who didn't get the memo
about how to install contrib modules in 9.1.  Try to make it a little more
prominent that you aren't supposed to call the scripts directly anymore.
2011-09-06 12:36:40 -04:00
Tom Lane b7f83e70d9 Update type-conversion documentation for long-ago changes.
This example wasn't updated when we changed the behavior of bpcharlen()
in 8.0, nor when we changed the number of parameters taken by the bpchar()
cast function in 7.3.  Per report from lsliang.
2011-09-06 12:14:51 -04:00
Bruce Momjian d764835bbc Properly document semphore requirements by accounting for worker
processes.

Backpatch to 9.1 and 9.0.

Submitted by Anton Yuzhaninov, confirmed by Robert Haas
2011-09-06 11:08:32 -04:00
Bruce Momjian 5c8676ea71 Add documentation link to strftime supported options. 2011-09-05 22:58:10 -04:00
Bruce Momjian f458c90bff Add C comment about why we send cache invalidation messages for
session-local objects.
2011-09-05 22:09:02 -04:00
Alvaro Herrera 56a9ed92b6 Adjust translator comment format to xgettext expectations 2011-09-05 19:04:30 -03:00
Alvaro Herrera b64f18c583 Mark some untranslatable messages with errmsg_internal 2011-09-05 17:48:07 -03:00
Peter Eisentraut a2a5ce6826 Improve "invalid byte sequence for encoding" message
It used to say

ERROR:  invalid byte sequence for encoding "UTF8": 0xdb24

Change this to

ERROR:  invalid byte sequence for encoding "UTF8": 0xdb 0x24

to make it clear that this is a byte sequence and not a code point.

Also fix the adjacent "character has no equivalent" message that has
the same issue.
2011-09-05 23:38:27 +03:00
Bruce Momjian 7cb99b2696 Add mention that UTC really means UT1.
Backpatch to 9.1.
2011-09-05 15:38:37 -04:00
Tom Lane 0b88af150e Update time zone data files to tzdata release 2011i.
DST law changes in Canada, Egypt, Russia, Samoa, South Sudan.
2011-09-05 14:46:31 -04:00
Bruce Momjian d235f828d7 Document that contrib/pgtrgm only processes ASCII alphanumeric
characters.

Backpatch to 9.0 and 9.1.
2011-09-05 13:24:45 -04:00
Tom Lane 6a24742c1a Guard against using plperl's Makefile without specifying --with-perl.
The $(PERL) macro will be set by configure if it finds perl at all,
but $(perl_privlibexp) isn't configured unless you said --with-perl.
This results in confusing error messages if someone cd's into
src/pl/plperl and tries to build there despite the configure omission,
as reported by Tomas Vondra in bug #6198.  Add simple checks to
provide a more useful report, while not disabling other use of the
makefile such as "make clean".

Back-patch to 9.0, which is as far as the patch applies easily.
2011-09-04 20:07:34 -04:00
Tom Lane 4c2777d0b7 Change get_variable_numdistinct's API to flag default estimates explicitly.
Formerly, callers tested for DEFAULT_NUM_DISTINCT, which had the problem
that a perfectly solid estimate might be mistaken for a content-free
default.
2011-09-04 15:41:49 -04:00
Tom Lane 1cb108efb0 Dig down into sub-selects to look for column statistics.
If a sub-select's output column is a simple Var, recursively look for
statistics applying to that Var, and use them if available.  The need for
this was foreseen ages ago, but we didn't have enough infrastructure to do
it with reasonable speed until just now.

We punt and stick with default estimates if the subquery uses set
operations, GROUP BY, or DISTINCT, since those operations would change the
underlying column statistics (particularly, the relative frequencies of
different values) beyond recognition.  This means that the types of
sub-selects for which this improvement applies are fairly limited, since
most subqueries satisfying those restrictions would have gotten flattened
into the parent query anyway.  But it does help for some cases, such as
subqueries with ORDER BY or LIMIT.
2011-09-04 15:13:46 -04:00
Tom Lane 698df3350d Can't print PlannerGlobal's subroots list in outfuncs.
Since the subroots will surely link back to the same glob struct, this
necessarily leads to infinite recursion.  Doh.  Found while trying to
debug some other code.
2011-09-04 14:43:52 -04:00
Tom Lane 1609797c25 Clean up the #include mess a little.
walsender.h should depend on xlog.h, not vice versa.  (Actually, the
inclusion was circular until a couple hours ago, which was even sillier;
but Bruce broke it in the expedient rather than logically correct
direction.)  Because of that poor decision, plus blind application of
pgrminclude, we had a situation where half the system was depending on
xlog.h to include such unrelated stuff as array.h and guc.h.  Clean up
the header inclusion, and manually revert a lot of what pgrminclude had
done so things build again.

This episode reinforces my feeling that pgrminclude should not be run
without adult supervision.  Inclusion changes in header files in particular
need to be reviewed with great care.  More generally, it'd be good if we
had a clearer notion of module layering to dictate which headers can sanely
include which others ... but that's a big task for another day.
2011-09-04 01:13:16 -04:00
Tom Lane f116b1f5b8 Remove unnecessary and circular #include.
storage/proc.h should not include replication/syncrep.h, especially not
when the latter includes storage/proc.h; but in any case this was a pretty
poor thing from a modular layering standpoint.
2011-09-03 22:14:45 -04:00
Bruce Momjian 5bce637a4b walsender.h doesn't need xlog.h, per Tom. 2011-09-03 21:25:00 -04:00
Bruce Momjian 85e6e1662b Move AllowCascadeReplication() define from xlog.h to replication include
file.

Per suggestion from Alvaro.
2011-09-03 20:46:19 -04:00
Bruce Momjian ca598c18c6 Remove find_lt sgml tool, as it is not needed.
Per suggestion from Peter.
2011-09-03 19:09:39 -04:00
Tom Lane 48e4b8dc08 Fix typo in pg_srand48 (srand48 in older branches).
">" should be ">>".  This typo results in failure to use all of the bits
of the provided seed.

This might rise to the level of a security bug if we were relying on
srand48 for any security-critical purposes, but we are not --- in fact,
it's not used at all unless the platform lacks srandom(), which is
improbable.  Even on such a platform the exposure seems minimal.

Reported privately by Andres Freund.
2011-09-03 16:17:34 -04:00
Tom Lane b3aaf9081a Rearrange planner to save the whole PlannerInfo (subroot) for a subquery.
Formerly, set_subquery_pathlist and other creators of plans for subqueries
saved only the rangetable and rowMarks lists from the lower-level
PlannerInfo.  But there's no reason not to remember the whole PlannerInfo,
and indeed this turns out to simplify matters in a number of places.

The immediate reason for doing this was so that the subroot will still be
accessible when we're trying to extract column statistics out of an
already-planned subquery.  But now that I've done it, it seems like a good
code-beautification effort in its own right.

I also chose to get rid of the transient subrtable and subrowmark fields in
SubqueryScan nodes, in favor of having setrefs.c look up the subquery's
RelOptInfo.  That required changing all the APIs in setrefs.c to pass
PlannerInfo not PlannerGlobal, which was a large but quite mechanical
transformation.

One side-effect not foreseen at the beginning is that this finally broke
inheritance_planner's assumption that replanning the same subquery RTE N
times would necessarily give interchangeable results each time.  That
assumption was always pretty risky, but now we really have to make a
separate RTE for each instance so that there's a place to carry the
separate subroots.
2011-09-03 15:36:24 -04:00
Peter Eisentraut 42ad992fdc Add archive_command example 2011-09-03 01:29:09 +03:00
Peter Eisentraut f1e4f3d44f Whitespace adjustment for consistency in the file 2011-09-03 01:28:05 +03:00
Tom Lane 5b562644fe Teach ANALYZE to clear pg_class.relhassubclass when appropriate.
In the past, relhassubclass always remained true if a relation had ever had
child relations, even if the last subclass was long gone.  While this had
only marginal performance implications in most cases, it was annoying, and
I'm now considering some planner changes that would raise the cost of a
false positive.  It was previously impractical to fix this because of race
condition concerns.  However, given the recent change that made tablecmds.c
take ShareExclusiveLock on relations that are gaining a child (commit
fbcf4b92aa), we can now allow ANALYZE to
clear the flag when it's no longer relevant.  There is no additional
locking cost to do so, since ANALYZE takes ShareExclusiveLock anyway.
2011-09-02 14:29:31 -04:00
Michael Meskes 2f72d5df6a Fix brace indentation of commit 63d06ef591 to fit PostgreSQL style. 2011-09-02 10:03:07 +02:00
Bruce Momjian 418d04ea73 Improve method of avoiding fcinfo compile errors.
Fix pgrminclude C comment marker.
2011-09-01 14:16:13 -04:00
Heikki Linnakangas e4df037330 Remove spurious comma. Spotted by Tom. 2011-09-01 20:08:23 +03:00
Bruce Momjian 10af3ab2b2 Add C comment about needed include. 2011-09-01 12:53:45 -04:00
Heikki Linnakangas 5066e55d61 libpq compiles various pgport files like ecpg does, and needs similar Makefile
changes for the win32 setlocale() wrapper I put into ecpg, to make it compile
on MinGW.
2011-09-01 19:00:27 +03:00
Tom Lane e5b012b788 Put back improperly removed #include. 2011-09-01 11:57:46 -04:00
Bruce Momjian 7805b11856 Add C comment about necessary NetBSD include. 2011-09-01 11:20:47 -04:00
Bruce Momjian 5352bf39ff Add missing hba.h include for NetBSD. 2011-09-01 10:34:04 -04:00
Bruce Momjian b3d32ebac6 In SGML we only need to worry about "<", not ">"; update scripts. 2011-09-01 10:17:04 -04:00
Bruce Momjian 6416a82a62 Remove unnecessary #include references, per pgrminclude script. 2011-09-01 10:04:27 -04:00
Michael Meskes 63d06ef591 In ecpglib restore LC_NUMERIC in case of an error. 2011-09-01 15:46:12 +02:00
Robert Haas 48fb49e394 Minor improvements to mbregress.sh script.
1. Use new dropdb --if-exists option, to avoid alarming the user if
   the database being dropped doesn't already exist.
2. Bail out if createdb fails.
3. exit 1 if the checks fail.
4. Make it executable.

Josh Kupershmidt, with some kibitzing by me.
2011-09-01 09:21:10 -04:00
Robert Haas 4232c4b406 Userspace access vector cache for contrib/sepgsql.
KaiGai Kohei
2011-09-01 08:38:40 -04:00
Robert Haas 3d14bd2563 Fix "is db labeled test?" in chkselinuxenv script.
Don't test whether the number of labels is numerically equal to zero;
count(*) isn't going return zero anyway, and the current coding blows
up if it returns an empty string or an error.
2011-09-01 08:28:26 -04:00
Bruce Momjian d532184252 Remove "fmgr.h" include in cube contrib --- caused crash on a Gentoo
builfarm member.
2011-09-01 07:22:40 -04:00