1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-08 22:02:03 +03:00

32665 Commits

Author SHA1 Message Date
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. REL9_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 5ad0e899f08136a00f56bf224a6b9729b2f4c69f to fit PostgreSQL style. 2011-09-02 10:44:14 +02:00
Heikki Linnakangas
8027e4d4be Remove spurious comma. Spotted by Tom. 2011-09-01 19:59:35 +03:00
Heikki Linnakangas
4fcceef0de 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:03:34 +03:00
Michael Meskes
5ad0e899f0 In ecpglib restore LC_NUMERIC in case of an error. 2011-09-01 15:30:01 +02:00
Heikki Linnakangas
6952071450 Fix MinGW build, broken by my previous patch to add a setlocale() wrapper
on Windows. ecpglib doesn't link with libpgport, but picks and compiles
the .c files it needs individually. To cope with that, move the setlocale()
wrapper from chklocale.c to a separate setlocale.c file, and include that
in ecpglib.
2011-09-01 14:04:19 +03:00
Heikki Linnakangas
83748f3a4e setlocale() on Windows doesn't work correctly if the locale name contains
dots. I previously worked around this in initdb, mapping the known
problematic locale names to aliases that work, but Hiroshi Inoue pointed
out that that's not enough because even if you use one of the aliases, like
"Chinese_HKG", setlocale(LC_CTYPE, NULL) returns back the long form, ie.
"Chinese_Hong Kong S.A.R.". When we try to restore an old locale value by
passing that value back to setlocale(), it fails. Note that you are affected
by this bug also if you use one of those short-form names manually, so just
reverting the hack in initdb won't fix it.

To work around that, move the locale name mapping from initdb to a wrapper
around setlocale(), so that the mapping is invoked on every setlocale() call.

Also, add a few checks for failed setlocale() calls in the backend. These
calls shouldn't fail, and if they do there isn't much we can do about it,
but at least you'll get a warning.

Backpatch to 9.1, where the initdb hack was introduced. The Windows bug
affects older versions too if you set locale manually to one of the aliases,
but given the lack of complaints from the field, I'm hesitent to backpatch.
2011-09-01 11:10:23 +03:00
Heikki Linnakangas
116b67f3ad Move the line to undefine setlocale() macro on Win32 outside USE_REPL_SNPRINTF
ifdef block. It has nothing to do with whether the replacement snprintf
function is used. It caused no live bug, because the replacement snprintf
function is always used on Win32, but it was nevertheless misplaced.
2011-09-01 09:18:16 +03:00
Tom Lane
f759ef139e Further repair of eqjoinsel ndistinct-clamping logic.
Examination of examples provided by Mark Kirkwood and others has convinced
me that actually commit 7f3eba30c9d622d1981b1368f2d79ba0999cdff2 was quite
a few bricks shy of a load.  The useful part of that patch was clamping
ndistinct for the inner side of a semi or anti join, and the reason why
that's needed is that it's the only way that restriction clauses
eliminating rows from the inner relation can affect the estimated size of
the join result.  I had not clearly understood why the clamping was
appropriate, and so mis-extrapolated to conclude that we should clamp
ndistinct for the outer side too, as well as for both sides of regular
joins.  These latter actions were all wrong, and are reverted with this
patch.  In addition, the clamping logic is now made to affect the behavior
of both paths in eqjoinsel_semi, with or without MCV lists to compare.
When we have MCVs, we suppose that the most common values are the ones
that are most likely to survive the decimation resulting from a lower
restriction clause, so we think of the clamping as eliminating non-MCV
values, or potentially even the least-common MCVs for the inner relation.

Back-patch to 8.4, same as previous fixes in this area.
2011-09-01 00:19:54 -04:00
Bruce Momjian
dbb8d4769c Fix pg_upgrade to preserve toast relfrozenxids for old 8.3 servers.
This fixes a pg_upgrade bug that could lead to query errors when
clog files are improperly removed.

Backpatch to 8.4, 9.0, 9.1.
2011-08-31 21:49:59 -04:00
Tom Lane
ca4f70ca77 Improve eqjoinsel's ndistinct clamping to work for multiple levels of join.
This patch fixes an oversight in my commit
7f3eba30c9d622d1981b1368f2d79ba0999cdff2 of 2008-10-23.  That patch
accounted for baserel restriction clauses that reduced the number of rows
coming out of a table (and hence the number of possibly-distinct values of
a join variable), but not for join restriction clauses that might have been
applied at a lower level of join.  To account for the latter, look up the
sizes of the min_lefthand and min_righthand inputs of the current join,
and clamp with those in the same way as for the base relations.

Noted while investigating a complaint from Ben Chobot, although this in
itself doesn't seem to explain his report.

Back-patch to 8.4; previous versions used different estimation methods
for which this heuristic isn't relevant.
2011-08-31 16:06:00 -04:00
Heikki Linnakangas
edf4edae57 The replication status values in pg_stat_replication was changed to
lowercase earlier, but documentation was not updated. Update the docs.

Fujii Masao
2011-08-31 12:38:33 +03:00
Tom Lane
333eb32081 Fix not-backwards-compatible pg_upgrade test for prepared transactions.
There's no reason for this test to use the undocumented pg_prepared_xact()
function, when it can use the stable API pg_prepared_xacts instead.
Fixes breakage against 8.3, as reported by Justin Arnold.
2011-08-30 17:15:13 -04:00
Tom Lane
030cdaf7fb Fix a missed case in code for "moving average" estimate of reltuples.
It is possible for VACUUM to scan no pages at all, if the visibility map
shows that all pages are all-visible.  In this situation VACUUM has no new
information to report about the relation's tuple density, so it wasn't
changing pg_class.reltuples ... but it updated pg_class.relpages anyway.
That's wrong in general, since there is no evidence to justify changing the
density ratio reltuples/relpages, but it's particularly bad if the previous
state was relpages=reltuples=0, which means "unknown tuple density".
We just replaced "unknown" with "zero".  ANALYZE would eventually recover
from this, but it could take a lot of repetitions of ANALYZE to do so if
the relation size is much larger than the maximum number of pages ANALYZE
will scan, because of the moving-average behavior introduced by commit
b4b6923e03f4d29636a94f6f4cc2f5cf6298b8c8.

The only known situation where we could have relpages=reltuples=0 and yet
the visibility map asserts everything's visible is immediately following
a pg_upgrade.  It might be advisable for pg_upgrade to try to preserve the
relpages/reltuples statistics; but in any case this code is wrong on its
own terms, so fix it.  Per report from Sergey Koposov.

Back-patch to 8.4, where the visibility map was introduced, same as the
previous change.
2011-08-30 14:49:52 -04:00
Tom Lane
579577320e Fix concat_ws() to not insert a separator after leading NULL argument(s).
Per bug #6181 from Itagaki Takahiro.  Also do some marginal code cleanup
and improve error handling.
2011-08-29 15:21:15 -04:00