Commit Graph

32483 Commits

Author SHA1 Message Date
Tom Lane ca4af308c3 Simplify handling of the timezone GUC by making initdb choose the default.
We were doing some amazingly complicated things in order to avoid running
the very expensive identify_system_timezone() procedure during GUC
initialization.  But there is an obvious fix for that, which is to do it
once during initdb and have initdb install the system-specific default into
postgresql.conf, as it already does for most other GUC variables that need
system-environment-dependent defaults.  This means that the timezone (and
log_timezone) settings no longer have any magic behavior in the server.
Per discussion.
2011-09-09 17:59:11 -04:00
Tom Lane a7801b62f2 Move Timestamp/Interval typedefs and basic macros into datatype/timestamp.h.
As per my recent proposal, this refactors things so that these typedefs and
macros are available in a header that can be included in frontend-ish code.
I also changed various headers that were undesirably including
utils/timestamp.h to include datatype/timestamp.h instead.  Unsurprisingly,
this showed that half the system was getting utils/timestamp.h by way of
xlog.h.

No actual code changes here, just header refactoring.
2011-09-09 13:23:41 -04:00
Tom Lane d63de337f3 round() is not portable. Use rint(). 2011-09-08 16:38:24 -04:00
Alvaro Herrera 295e7dc929 Tweak string for uniformity 2011-09-08 16:39:58 -03:00
Peter Eisentraut cf15fb5cab Add missing format argument to ecpg_log() call 2011-09-08 22:09:08 +03:00
Heikki Linnakangas 86ab71d58d Fix typo and reword the sentence. 2011-09-08 18:17:57 +03:00
Heikki Linnakangas 5edb24a898 Buffering GiST index build algorithm.
When building a GiST index that doesn't fit in cache, buffers are attached
to some internal nodes in the index. This speeds up the build by avoiding
random I/O that would otherwise be needed to traverse all the way down the
tree to the find right leaf page for tuple.

Alexander Korotkov
2011-09-08 17:51:23 +03:00
Tom Lane 09b68c70af One last round of copy-editing for the 9.1 release notes.
Also set the documented release date to 2011-09-12.
2011-09-08 00:53:11 -04:00
Tom Lane f0bedf3e45 Fix corner case bug in numeric to_char().
Trailing-zero stripping applied by the FM specifier could strip zeroes
to the left of the decimal point, for a format with no digit positions
after the decimal point (such as "FM999.").

Reported and diagnosed by Marti Raudsepp, though I didn't use his patch.
2011-09-07 17:07:20 -04:00
Bruce Momjian 7b8e10f2be Allow bcc32 and win32 batch files to compile libpq.
Backpatch to 9.1.

By Hiroshi Saito
2011-09-07 15:43:50 -04:00
Bruce Momjian 3ced32d24e In pg_upgrade, disallow migration of 8.3 clusters using contrib/ltree
because its internal format was changed in 8.4.

Backpatch to 9.0 and 9.1.

Report by depesz, diagnosis by Tom.
2011-09-07 14:43:12 -04:00
Tom Lane 99155aaa33 Fix typo in error message.
Per Euler Taveira de Oliveira.
2011-09-07 13:29:26 -04:00
Tom Lane a7d9203cc4 Fix get_name_for_var_field() to deal with RECORD Params.
With 9.1's use of Params to pass down values from NestLoop join nodes
to their inner plans, it is possible for a Param to have type RECORD, in
which case the set of fields comprising the value isn't determinable by
inspection of the Param alone.  However, just as with a Var of type RECORD,
we can find out what we need to know if we can locate the expression that
the Param represents.  We already knew how to do this in get_parameter(),
but I'd overlooked the need to be able to cope in get_name_for_var_field(),
which led to EXPLAIN failing with "record type has not been registered".

To fix, refactor the search code in get_parameter() so it can be used by
both functions.

Per report from Marti Raudsepp.
2011-09-07 13:01:36 -04:00
Bruce Momjian f19593754a Have pgrminclude skip files that use CppAsString2 because CppAsString2
will expaned undefined identifiers.
2011-09-07 12:59:17 -04:00
Bruce Momjian f81fb4f690 Fix bug introduced by pgrminclude where the tablespace version name was
not expanded.

Bump catalog version number to force initdb for all tablespaces.
2011-09-07 12:41:16 -04:00
Bruce Momjian 029dfdf115 Fix to_date() and to_timestamp() to handle year masks of length < 4 so
they wrap toward year 2020, rather than the inconsistent behavior we had
before.
2011-09-07 09:47:51 -04:00
Bruce Momjian 8eacb25cbe Revert documentation patch about NEW/OLD and triggers.
Backpatch to 9.0 and 9.1.

Patch from Josh Kupershmidt.
2011-09-07 09:24:34 -04:00
Simon Riggs df383b03e6 Partially revoke attempt to improve performance with many savepoints.
Maintain difference between subtransaction release and commit introduced
by earlier patch.
2011-09-07 12:11:26 +01:00
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