Commit Graph

32278 Commits

Author SHA1 Message Date
Tom Lane
0c2c2495ad Fix index matching for operators with mixed collatable/noncollatable inputs.
If an indexable operator for a non-collatable indexed datatype has a
collatable right-hand input type, any OpExpr for it will be marked with a
nonzero inputcollid (since having one collatable input is sufficient to
make that happen).  However, an index on a non-collatable column certainly
doesn't have any collation.  This caused us to fail to match such operators
to their indexes, because indxpath.c required an exact match of index
collation and clause collation.  It seems correct to allow a match when the
index is collation-less regardless of the clause's inputcollid: an operator
with both noncollatable and collatable inputs could perhaps depend on the
collation of the collatable input, but it could hardly expect the index for
the noncollatable input to have that same collation.

Per bug #6232 from Pierre Ducroquet.  His example is specifically about
"hstore ? text" but the problem seems quite generic.
2011-09-29 00:44:19 -04:00
Bruce Momjian
2e9633c362 In pg_upgrade, because toast table names can be mismatched with the heap
oid on 8.4, modify the toast name comparison test to only apply to old
9.0+ servers.  (The test was previously 8.4+.)
2011-09-28 22:53:44 -04:00
Tom Lane
39be695772 Take sepgsql regression tests out of the regular regression test mechanism.
Back-port the new "test_sepgsql" script into 9.1 to provide a substitute
test mechanism.
2011-09-27 20:15:54 -04:00
Tom Lane
1679e9fedd Fix window functions that sort by expressions involving aggregates.
In commit c1d9579dd8, I changed things so
that the output of the Agg node that feeds the window functions would not
list any ungrouped Vars directly.  Formerly, for example, the Agg tlist
might have included both "x" and "sum(x)", which is not really valid if
"x" isn't a grouping column.  If we then had a window function ordering on
something like "sum(x) + 1", prepare_sort_from_pathkeys would find no exact
match for this in the Agg tlist, and would conclude that it must recompute
the expression.  But it would break the expression down to just the Var
"x", which it would find in the tlist, and then rebuild the ORDER BY
expression using a reference to the subplan's "x" output.  Now, after the
above-referenced changes, "x" isn't in the Agg tlist if it's not a grouping
column, so that prepare_sort_from_pathkeys fails with "could not find
pathkey item to sort", as reported by Bricklen Anderson.

The fix is to not break down Aggrefs into their component parts, but just
treat them as irreducible expressions to be sought in the subplan tlist.
This is definitely OK for the use with respect to window functions in
grouping_planner, since it just built the tlist being used on the same
basis.  AFAICT it is safe for other uses too; most of the other call sites
couldn't encounter Aggrefs anyway.
2011-09-26 23:49:12 -04:00
Tom Lane
be64ba6230 Un-break compression of plain-text output format in pg_dump.
pg_dump has historically understood -Z with no -F switch to mean that
it should emit a gzip-compressed version of its plain text output.
This got broken through a misunderstanding in the 9.1 patch that added
directory output format.  Restore the former behavior.

Per complaint from Roger Niederland and diagnosis by Adrian Klaver.
2011-09-25 13:59:35 -04:00
Magnus Hagander
3f75cecfbb Fix typo 2011-09-24 14:34:58 +02:00
Magnus Hagander
2b250fb077 Note that sslmode=require verifies the CA if root cert is present
This mode still exists for backwards compatibility, making
sslmode=require the same as sslmode=verify-ca when the file is present,
but not causing an error when it isn't.

Per bug 6189, reported by Srinivas Aji
2011-09-24 14:26:55 +02:00
Tom Lane
c7f144b643 Fix our mapping of Windows timezones for Central America.
We were mapping "Central America Standard Time" to "CST6CDT", which seems
entirely wrong, because according to the Olson timezone database noplace
in Central America observes daylight savings time on any regular basis ---
and certainly not according to the USA DST rules that are implied by
"CST6CDT".  (Mexico is an exception, but they can be disregarded since
they have a separate timezone name in Windows.)  So, map this zone name to
plain "CST6", which will provide a fixed UTC offset.

As written, this patch will also result in mapping "Central America
Daylight Time" to CST6.  I considered hacking things so that would still
map to CST6CDT, but it seems it would confuse win32tzlist.pl to put those
two names in separate entries.  Since there's little evidence that any
such zone name is used in the wild, much less that CST6CDT would be a good
match for it, I'm not too worried about what we do with it.

Per complaint from Pratik Chirania.
2011-09-23 22:12:36 -04:00
Simon Riggs
8ab067da91 synchronous_commit is an enum not a boolean.
Jaime Casanova
2011-09-23 08:34:10 +01:00
Tom Lane
8da4007a4d Stamp 9.1.1. 2011-09-22 17:57:57 -04:00
Tom Lane
7f70f35031 Update release notes for 9.1.1, 9.0.5, 8.4.9, 8.3.16, 8.2.22.
Man, we fixed a lotta bugs since April.
2011-09-22 17:40:16 -04:00
Peter Eisentraut
f992679318 Translation updates 2011-09-22 23:24:25 +03:00
Robert Haas
c67bba9925 Fix another bit of unlogged-table-induced breakage.
Per bug #6205, reported by Abel Abraham Camarillo Ojeda.  This isn't a
particularly elegant fix, but I'm trying to minimize the chances of
causing yet another round of breakage.

Adjust regression tests to exercise this case.
2011-09-21 10:48:29 -04:00
Tom Lane
c47e629498 Suppress "unused function" warning when not HAVE_LOCALE_T.
Forgot to consider this case ...
2011-09-20 17:47:43 -04:00
Tom Lane
226bc87c2d Improve reporting of newlocale() failures in CREATE COLLATION.
The standardized errno code for "no such locale" failures is ENOENT, which
we were just reporting at face value, viz "No such file or directory".
Per gripe from Thom Brown, this might confuse users, so add an errdetail
message to clarify what it means.  Also, report newlocale() failures as
ERRCODE_INVALID_PARAMETER_VALUE rather than using
errcode_for_file_access(), since newlocale()'s errno values aren't
necessarily tied directly to file access failures.
2011-09-20 13:23:55 -04:00
Tom Lane
e5b86c93b6 Avoid unnecessary page-level SSI lock check in heap_insert().
As observed by Heikki, we need not conflict on heap page locks during an
insert; heap page locks are only aggregated tuple locks, they don't imply
locking "gaps" as index page locks do.  So we can avoid some unnecessary
conflicts, and also do the SSI check while not holding exclusive lock on
the target buffer.

Kevin Grittner, reviewed by Jeff Davis.  Back-patch to 9.1.
2011-09-16 14:47:27 -04:00
Tom Lane
57d3dc2035 gistendscan() forgot to free so->giststate.
This oversight led to a massive memory leak --- upwards of 10KB per tuple
--- during creation-time verification of an exclusion constraint based on a
GIST index.  In most other scenarios it'd just be a leak of 10KB that would
be recovered at end of query, so not too significant; though perhaps the
leak would be noticeable in a situation where a GIST index was being used
in a nestloop inner indexscan.  In any case, it's a real leak of long
standing, so patch all supported branches.  Per report from Harald Fuchs.
2011-09-16 04:27:56 -04:00
Heikki Linnakangas
f6950429da Teach the makefile used to build stand-alone libpq on Windows that libpq
needs win32setlocale.c now. The cygwin and MSVC build scripts were changed
earlier, but this was neglected. This should fix bug report #6203 by Steve.
2011-09-14 17:59:25 +03:00
Heikki Linnakangas
7334135310 In the manual section on primary_conninfo, recommend using a role with
REPLICATION privileges, not SUPERUSER.

Fujii Masao
2011-09-14 09:32:54 +03:00
Tom Lane
663bee0d5c deflist_to_tuplestore dumped core on an option with no value.
Make it return NULL for the option_value, instead.

Per report from Frank van Vugt.  Back-patch to 8.4 where this code was
added.
2011-09-13 11:36:53 -04:00
Tom Lane
1f43001424 Stamp 9.1.0. 2011-09-08 17:13:27 -04:00
Peter Eisentraut
bd6db68f71 Translation updates for 9.1.0 2011-09-08 23:10:40 +03:00
Peter Eisentraut
ba7ef09a3b Add missing format argument to ecpg_log() call 2011-09-08 22:10:11 +03:00
Tom Lane
c7d60312fb 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:24 -04:00
Tom Lane
5df20a6e4f 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:33 -04:00
Bruce Momjian
60765d86c3 Allow bcc32 and win32 batch files to compile libpq.
Backpatch to 9.1.

By Hiroshi Saito
2011-09-07 15:43:52 -04:00
Bruce Momjian
8cdd62068d 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:07 -04:00
Tom Lane
673dfe9690 Fix typo in error message.
Per Euler Taveira de Oliveira.
2011-09-07 13:29:37 -04:00
Tom Lane
9039813241 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:02:06 -04:00
Bruce Momjian
d5d94e1601 Revert documentation patch about NEW/OLD and triggers.
Backpatch to 9.0 and 9.1.

Patch from Josh Kupershmidt.
2011-09-07 09:24:02 -04:00
Bruce Momjian
e4d59f3536 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:18 -04:00
Bruce Momjian
6117526b5b Fix spelling mistake in pgpass documentation change.
Per Peter.
2011-09-06 19:42:48 -04:00
Bruce Momjian
2b3e86d475 Add documentation suggestion about adding a comment to the top of
pgpass.

Backpatch to 9.1.
2011-09-06 17:32:16 -04:00
Bruce Momjian
3430ab5986 Fix plpgsql "PERFORM" markup.
Backpatch to 9.0 and 9.1.
2011-09-06 15:20:54 -04:00
Tom Lane
8b81b99b89 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:44 -04:00
Tom Lane
460bfd07b3 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:37 -04:00
Bruce Momjian
94bf47db8f Document PERFORM limitation when using WITH queries.
Backpatch to 9.0 and 9.1.

Report from depstein@alliedtesting.com.
2011-09-06 13:42:04 -04:00
Tom Lane
a3850a5f75 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:50 -04:00
Tom Lane
95a07c1ebe 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:15:02 -04:00
Bruce Momjian
f85adb65bf 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:34 -04:00
Bruce Momjian
0603ba3415 Add documentation link to strftime supported options. 2011-09-05 22:58:13 -04:00
Alvaro Herrera
7dc956fee3 Adjust translator comment format to xgettext expectations 2011-09-05 19:03:51 -03:00
Alvaro Herrera
c729082da4 Mark some untranslatable messages with errmsg_internal 2011-09-05 17:49:44 -03:00
Bruce Momjian
082befb516 Add mention that UTC really means UT1.
Backpatch to 9.1.
2011-09-05 15:38:33 -04:00
Tom Lane
33c371b4f5 Update time zone data files to tzdata release 2011i.
DST law changes in Canada, Egypt, Russia, Samoa, South Sudan.
2011-09-05 14:46:50 -04:00
Bruce Momjian
2c62b5bb63 Document that contrib/pgtrgm only processes ASCII alphanumeric
characters.

Backpatch to 9.0 and 9.1.
2011-09-05 13:24:46 -04:00
Tom Lane
eed7dcfcee 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:38 -04:00
Tom Lane
1ae019f04b Fix #include problems in 9.1 branch.
Remove unnecessary and circular #include of syncrep.h from proc.h.
Add htup.h to tablecmds.h so it will compile without prerequisites.
2011-09-04 19:10:09 -04:00
Tom Lane
b6cfede8b6 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:39 -04:00
Michael Meskes
7c0e1a28ac Fix brace indentation of commit 5ad0e899f0 to fit PostgreSQL style. 2011-09-02 10:44:14 +02:00