]> granicus.if.org Git - postgresql/log
postgresql
13 years agoFix typo in pg_srand48 (srand48 in older branches).
Tom Lane [Sat, 3 Sep 2011 20:17:39 +0000 (16:17 -0400)]
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.

13 years agoFix brace indentation of commit 5ad0e899f08136a00f56bf224a6b9729b2f4c69f to fit Postg...
Michael Meskes [Fri, 2 Sep 2011 07:45:11 +0000 (09:45 +0200)]
Fix brace indentation of commit 5ad0e899f08136a00f56bf224a6b9729b2f4c69f to fit PostgreSQL style.

13 years agoRemove spurious comma. Spotted by Tom.
Heikki Linnakangas [Thu, 1 Sep 2011 16:59:09 +0000 (19:59 +0300)]
Remove spurious comma. Spotted by Tom.

13 years agolibpq compiles various pgport files like ecpg does, and needs similar Makefile
Heikki Linnakangas [Thu, 1 Sep 2011 15:58:50 +0000 (18:58 +0300)]
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.

13 years agoIn ecpglib restore LC_NUMERIC in case of an error.
Michael Meskes [Thu, 1 Sep 2011 13:27:38 +0000 (15:27 +0200)]
In ecpglib restore LC_NUMERIC in case of an error.

13 years agoFix MinGW build, broken by my previous patch to add a setlocale() wrapper
Heikki Linnakangas [Thu, 1 Sep 2011 11:02:40 +0000 (14:02 +0300)]
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.

13 years agosetlocale() on Windows doesn't work correctly if the locale name contains
Heikki Linnakangas [Thu, 1 Sep 2011 08:08:32 +0000 (11:08 +0300)]
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.

13 years agoMove the line to undefine setlocale() macro on Win32 outside USE_REPL_SNPRINTF
Heikki Linnakangas [Thu, 1 Sep 2011 06:13:37 +0000 (09:13 +0300)]
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.

13 years agoFurther repair of eqjoinsel ndistinct-clamping logic.
Tom Lane [Thu, 1 Sep 2011 04:18:34 +0000 (00:18 -0400)]
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.

13 years agoFix pg_upgrade to preserve toast relfrozenxids for old 8.3 servers.
Bruce Momjian [Thu, 1 Sep 2011 01:49:59 +0000 (21:49 -0400)]
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.

13 years agoImprove eqjoinsel's ndistinct clamping to work for multiple levels of join.
Tom Lane [Wed, 31 Aug 2011 20:04:53 +0000 (16:04 -0400)]
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.

13 years agoThe replication status values in pg_stat_replication was changed to
Heikki Linnakangas [Wed, 31 Aug 2011 09:37:37 +0000 (12:37 +0300)]
The replication status values in pg_stat_replication was changed to
lowercase earlier, but documentation was not updated. Update the docs.

Fujii Masao

13 years agoFix not-backwards-compatible pg_upgrade test for prepared transactions.
Tom Lane [Tue, 30 Aug 2011 21:15:00 +0000 (17:15 -0400)]
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.

13 years agoFix a missed case in code for "moving average" estimate of reltuples.
Tom Lane [Tue, 30 Aug 2011 18:49:52 +0000 (14:49 -0400)]
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.

13 years agoFix concat_ws() to not insert a separator after leading NULL argument(s).
Tom Lane [Mon, 29 Aug 2011 19:20:57 +0000 (15:20 -0400)]
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.

13 years agoActually, all of parallel restore's limitations should be tested earlier.
Tom Lane [Mon, 29 Aug 2011 02:27:48 +0000 (22:27 -0400)]
Actually, all of parallel restore's limitations should be tested earlier.

On closer inspection, whining in restore_toc_entries_parallel is really
much too late for any user-facing error case.  The right place to do it
is at the start of RestoreArchive(), before we've done anything interesting
(suh as trying to DROP all the targets ...)

Back-patch to 8.4, where parallel restore was introduced.

13 years agoBe more user-friendly about unsupported cases for parallel pg_restore.
Tom Lane [Mon, 29 Aug 2011 01:48:58 +0000 (21:48 -0400)]
Be more user-friendly about unsupported cases for parallel pg_restore.

If we are unable to do a parallel restore because the input file is stdin
or is otherwise unseekable, we should complain and fail immediately, not
after having done some of the restore.  Complaining once per thread isn't
so cool either, and the messages should be worded to make it clear this is
an unsupported case not some weird race-condition bug.  Per complaint from
Lonni Friedman.

Back-patch to 8.4, where parallel restore was introduced.

13 years agoDon't assume that "E" response to NEGOTIATE_SSL_CODE means pre-7.0 server.
Tom Lane [Sat, 27 Aug 2011 20:37:02 +0000 (16:37 -0400)]
Don't assume that "E" response to NEGOTIATE_SSL_CODE means pre-7.0 server.

These days, such a response is far more likely to signify a server-side
problem, such as fork failure.  Reporting "server does not support SSL"
(in sslmode=require) could be quite misleading.  But the results could
be even worse in sslmode=prefer: if the problem was transient and the
next connection attempt succeeds, we'll have silently fallen back to
protocol version 2.0, possibly disabling features the user needs.

Hence, it seems best to just eliminate the assumption that backing off
to non-SSL/2.0 protocol is the way to recover from an "E" response, and
instead treat the server error the same as we would in non-SSL cases.

I tested this change against a pre-7.0 server, and found that there
was a second logic bug in the "prefer" path: the test to decide whether
to make a fallback connection attempt assumed that we must have opened
conn->ssl, which in fact does not happen given an "E" response.  After
fixing that, the code does indeed connect successfully to pre-7.0,
as long as you didn't set sslmode=require.  (If you did, you get
"Unsupported frontend protocol", which isn't completely off base
given the server certainly doesn't support SSL.)

Since there seems no reason to believe that pre-7.0 servers exist anymore
in the wild, back-patch to all supported branches.

13 years agoEnsure we discard unread/unsent data when abandoning a connection attempt.
Tom Lane [Sat, 27 Aug 2011 18:16:19 +0000 (14:16 -0400)]
Ensure we discard unread/unsent data when abandoning a connection attempt.

There are assorted situations wherein PQconnectPoll() will abandon a
connection attempt and try again with different parameters (eg, SSL versus
not SSL).  However, the code forgot to discard any pending data in libpq's
I/O buffers when doing this.  In at least one case (server returns E
message during SSL negotiation), there is unread input data which bollixes
the next connection attempt.  I have not checked to see whether this is
possible in the other cases where we close the socket and retry, but it
seems like a matter of good defensive programming to add explicit
buffer-flushing code to all of them.

This is one of several issues exposed by Daniel Farina's report of
misbehavior after a server-side fork failure.

This has been wrong since forever, so back-patch to all supported branches.

13 years agoSpelling improvement
Peter Eisentraut [Sat, 27 Aug 2011 05:07:58 +0000 (08:07 +0300)]
Spelling improvement

13 years agoFix potential memory clobber in tsvector_concat().
Tom Lane [Fri, 26 Aug 2011 20:51:39 +0000 (16:51 -0400)]
Fix potential memory clobber in tsvector_concat().

tsvector_concat() allocated its result workspace using the "conservative"
estimate of the sum of the two input tsvectors' sizes.  Unfortunately that
wasn't so conservative as all that, because it supposed that the number of
pad bytes required could not grow.  Which it can, as per test case from
Jesper Krogh, if there's a mix of lexemes with positions and lexemes
without them in the input data.  The fix is to assume that we might add
a not-previously-present pad byte for each and every lexeme in the two
inputs; which really is conservative, but it doesn't seem worthwhile to
try to be more precise.

This is an aboriginal bug in tsvector_concat, so back-patch to all
versions containing it.

13 years agoIn pg_upgrade, limit schema name filter to include toast tables. Bug
Bruce Momjian [Fri, 26 Aug 2011 04:12:34 +0000 (00:12 -0400)]
In pg_upgrade, limit schema name filter to include toast tables.  Bug
introduced recently when trying to filter out temp tables.

Backpatch to 9.0 and 9.1.

13 years agoAdd expected isolationtester output when prepared xacts are disabled
Alvaro Herrera [Thu, 25 Aug 2011 20:35:57 +0000 (17:35 -0300)]
Add expected isolationtester output when prepared xacts are disabled

This was deemed unnecessary initially but in later discussion it was
agreed otherwise.

Original file from Kevin Grittner, allegedly from Dan Ports.
I had to clean up whitespace a bit per changes from Heikki.

13 years agoFix psql lexer to avoid use of backtracking.
Tom Lane [Thu, 25 Aug 2011 18:33:08 +0000 (14:33 -0400)]
Fix psql lexer to avoid use of backtracking.

Per previous experimentation, backtracking slows down lexing performance
significantly (by about a third).  It's usually pretty easy to avoid, just
need to have rules that accept an incomplete construct and do whatever the
lexer would have done otherwise.

The backtracking was introduced by the patch that added quoted variable
substitution.  Back-patch to 9.0 where that was added.

13 years agoProperly quote SQL/MED generic options in pg_dump output.
Robert Haas [Thu, 25 Aug 2011 16:37:32 +0000 (12:37 -0400)]
Properly quote SQL/MED generic options in pg_dump output.

Shigeru Hanada

13 years agoRevert "Tweak postgresql.conf.sample's comments on listen_addresess."
Robert Haas [Thu, 25 Aug 2011 13:41:00 +0000 (09:41 -0400)]
Revert "Tweak postgresql.conf.sample's comments on listen_addresess."

This reverts commit 1bde67c0b9adce8b7ed2a2d1fcb2788cf96cea64, which
should have been done only on the master branch.

13 years agoTweak postgresql.conf.sample's comments on listen_addresess.
Robert Haas [Thu, 25 Aug 2011 13:39:35 +0000 (09:39 -0400)]
Tweak postgresql.conf.sample's comments on listen_addresess.

This makes it slightly more clear that '*' is not part of the default
value, in case that wasn't obvious.

As requested by Dougal Sutherland.

13 years agoAdjust CREATE DOMAIN example for standard_conforming_strings=on.
Robert Haas [Thu, 25 Aug 2011 13:35:38 +0000 (09:35 -0400)]
Adjust CREATE DOMAIN example for standard_conforming_strings=on.

Noted by Hitoshi Harada.

13 years agoFix pgstatindex() to give consistent results for empty indexes.
Tom Lane [Thu, 25 Aug 2011 03:50:15 +0000 (23:50 -0400)]
Fix pgstatindex() to give consistent results for empty indexes.

For an empty index, the pgstatindex() function would compute 0.0/0.0 for
its avg_leaf_density and leaf_fragmentation outputs.  On machines that
follow the IEEE float arithmetic standard with any care, that results in
a NaN.  However, per report from Rushabh Lathia, Microsoft couldn't
manage to get this right, so you'd get a bizarre error on Windows.

Fix by forcing the results to be NaN explicitly, rather than relying on
the division operator to give that or the snprintf function to print it
correctly.  I have some doubts that this is really the most useful
definition, but it seems better to remain backward-compatible with
those platforms for which the behavior wasn't completely broken.

Back-patch to 8.2, since the code is like that in all current releases.

13 years agoFix pgxs.mk to always add --dbname=$(CONTRIB_TESTDB) to REGRESS_OPTS.
Tom Lane [Wed, 24 Aug 2011 19:16:23 +0000 (15:16 -0400)]
Fix pgxs.mk to always add  --dbname=$(CONTRIB_TESTDB) to REGRESS_OPTS.

The previous coding resulted in contrib modules unintentionally overriding
the use of CONTRIB_TESTDB.  There seems no particularly good reason to
allow that (after all, the makefile can set CONTRIB_TESTDB if that's really
what it intends).

In passing, document REGRESS_OPTS where the other pgxs.mk options are
documented.

Back-patch to 9.1 --- in prior versions, there were no cases of contrib
modules setting REGRESS_OPTS without including the --dbname switch, so
while the coding was fragile there was no actual bug.

13 years agoBuild src/ before contrib/ in make world
Peter Eisentraut [Wed, 24 Aug 2011 18:34:49 +0000 (21:34 +0300)]
Build src/ before contrib/ in make world

This fixes failures under parallel make when contrib modules use a
generated backend header file (such as errcodes.h).

13 years agoAvoid locale dependency in expected output.
Tom Lane [Wed, 24 Aug 2011 17:47:01 +0000 (13:47 -0400)]
Avoid locale dependency in expected output.

We'll have to settle for just listing the extensions' data types,
since function arguments seem to sort differently in different locales.
Per buildfarm results.

13 years agoFix multiple bugs in extension dropping.
Tom Lane [Wed, 24 Aug 2011 17:09:06 +0000 (13:09 -0400)]
Fix multiple bugs in extension dropping.

When we implemented extensions, we made findDependentObjects() treat
EXTENSION dependency links similarly to INTERNAL links.  However, that
logic contained an implicit assumption that an object could have at most
one INTERNAL dependency, so it did not work correctly for objects having
both INTERNAL and DEPENDENCY links.  This led to failure to drop some
extension member objects when dropping the extension.  Furthermore, we'd
never actually exercised the case of recursing to an internally-referenced
(owning) object from anything other than a NORMAL dependency, and it turns
out that passing the incoming dependency's flags to the owning object is
the Wrong Thing.  This led to sometimes dropping a whole extension silently
when we should have rejected the drop command for lack of CASCADE.

Since we obviously were under-testing extension drop scenarios, add some
regression test cases.  Unfortunately, such test cases require some
extensions (duh), so we can't test for problems in the core regression
tests.  I chose to add them to the earthdistance contrib module, which is
a good test case because it has a dependency on the cube contrib module.

Back-patch to 9.1.  Arguably these are pre-existing bugs in INTERNAL
dependency handling, but since it appears that the cases can never arise
pre-9.1, I'll refrain from back-patching the logic changes further than
that.

13 years agoMake CREATE EXTENSION check schema creation permissions.
Tom Lane [Wed, 24 Aug 2011 01:49:07 +0000 (21:49 -0400)]
Make CREATE EXTENSION check schema creation permissions.

When creating a new schema for a non-relocatable extension, we neglected
to check whether the calling user has permission to create schemas.
That didn't matter in the original coding, since we had already checked
superuserness, but in the new dispensation where users need not be
superusers, we should check it.  Use CreateSchemaCommand() rather than
calling NamespaceCreate() directly, so that we also enforce the rules
about reserved schema names.

Per complaint from KaiGai Kohei, though this isn't the same as his patch.

13 years agoFix overoptimistic assumptions in column width estimation for subqueries.
Tom Lane [Tue, 23 Aug 2011 21:11:41 +0000 (17:11 -0400)]
Fix overoptimistic assumptions in column width estimation for subqueries.

set_append_rel_pathlist supposed that, while computing per-column width
estimates for the appendrel, it could ignore child rels for which the
translated reltargetlist entry wasn't a Var.  This gave rise to completely
silly estimates in some common cases, such as constant outputs from some or
all of the arms of a UNION ALL.  Instead, fall back on get_typavgwidth to
estimate from the value's datatype; which might be a poor estimate but at
least it's not completely wacko.

That problem was exposed by an Assert in set_subquery_size_estimates, which
unfortunately was still overoptimistic even with that fix, since we don't
compute attr_widths estimates for appendrels that are entirely excluded by
constraints.  So remove the Assert; we'll just fall back on get_typavgwidth
in such cases.

Also, since set_subquery_size_estimates calls set_baserel_size_estimates
which calls set_rel_width, there's no need for set_subquery_size_estimates
to call get_typavgwidth; set_rel_width will handle it for us if we just
leave the estimate set to zero.  Remove the unnecessary code.

Per report from Erik Rijkers and subsequent investigation.

13 years agoAdd recovery.conf to the index in the user manual.
Heikki Linnakangas [Tue, 23 Aug 2011 08:55:21 +0000 (11:55 +0300)]
Add recovery.conf to the index in the user manual.

Fujii Masao

13 years agoFix handling of extension membership when filling in a shell operator.
Tom Lane [Mon, 22 Aug 2011 14:55:47 +0000 (10:55 -0400)]
Fix handling of extension membership when filling in a shell operator.

The previous coding would result in deleting and not re-creating the
extension membership pg_depend rows, since there was no
CommandCounterIncrement that would allow recordDependencyOnCurrentExtension
to see that the deletion had happened.  Make it work like the shell type
case, ie, keep the existing entries (and then throw an error if they're for
the wrong extension).

Per bug #6172 from Hitoshi Harada.  Investigation and fix by Dimitri
Fontaine.

13 years agoFix trigger WHEN conditions when both BEFORE and AFTER triggers exist.
Tom Lane [Sun, 21 Aug 2011 22:16:02 +0000 (18:16 -0400)]
Fix trigger WHEN conditions when both BEFORE and AFTER triggers exist.

Due to tuple-slot mismanagement, evaluation of WHEN conditions for AFTER
ROW UPDATE triggers could crash if there had been a BEFORE ROW trigger
fired for the same update.  Fix by not trying to overload the use of
estate->es_trig_tuple_slot.  Per report from Yoran Heling.

Back-patch to 9.0, when trigger WHEN conditions were introduced.

13 years agoFix performance problem when building a lossy tidbitmap.
Tom Lane [Sat, 20 Aug 2011 18:51:02 +0000 (14:51 -0400)]
Fix performance problem when building a lossy tidbitmap.

As pointed out by Sergey Koposov, repeated invocations of tbm_lossify can
make building a large tidbitmap into an O(N^2) operation.  To fix, make
sure we remove more than the minimum amount of information per call, and
add a fallback path to behave sanely if we're unable to fit the bitmap
within the requested amount of memory.

This has been wrong since the tidbitmap code was written, so back-patch
to all supported branches.

13 years agoFix contrib/sepgsql and contrib/xml2 to always link required libraries.
Robert Haas [Fri, 19 Aug 2011 15:57:38 +0000 (11:57 -0400)]
Fix contrib/sepgsql and contrib/xml2 to always link required libraries.

contrib/xml2 can get by without libxslt; the relevant features just
won't work.  But if doesn't have libxml2, or if sepgsql doesn't have
libselinux, the link succeeds but the module then fails to work at load
time.  To avoid that, link the require libraries unconditionally, so
that it will be clear at link-time that there is a problem.

Per discussion with Tom Lane and KaiGai Kohei.

13 years agoAllow sepgsql regression tests to be run from a user homedir.
Robert Haas [Fri, 19 Aug 2011 15:51:10 +0000 (11:51 -0400)]
Allow sepgsql regression tests to be run from a user homedir.

KaiGai Kohei, with some changes by me.

13 years agoTag 9.1rc1. REL9_1_RC1
Tom Lane [Thu, 18 Aug 2011 21:23:13 +0000 (17:23 -0400)]
Tag 9.1rc1.

13 years agoExplain max_prepared_transactions requirement in isolation tests' README.
Tom Lane [Thu, 18 Aug 2011 15:45:33 +0000 (11:45 -0400)]
Explain max_prepared_transactions requirement in isolation tests' README.

Now that we have a test that requires nondefault settings to pass, it seems
like we'd better mention that detail in the directions about how to run the
tests.

Also do some very minor copy-editing.

13 years agoReport libpq errors correctly if session setup or teardown steps fail in
Heikki Linnakangas [Thu, 18 Aug 2011 13:47:31 +0000 (16:47 +0300)]
Report libpq errors correctly if session setup or teardown steps fail in
isolation regression tests.

Alvaro committed these fixes to master branch on Tue Jul 29th, as part of
Noah Misch's patch. The rest of that patch is not needed on 9.1, but this
part should be backpatched.

13 years agoAdd an SSI regression test that tests all interesting permutations in the
Heikki Linnakangas [Thu, 18 Aug 2011 10:36:37 +0000 (13:36 +0300)]
Add an SSI regression test that tests all interesting permutations in the
order of begin, prepare, and commit of three concurrent transactions that
have conflicts between them.

The test runs for a quite long time, and the expected output file is huge,
but this test caught some serious bugs during development, so seems
worthwhile to keep. The test uses prepared transactions, so it fails if the
server has max_prepared_transactions=0. Because of that, it's marked as
"ignore" in the schedule file.

Dan Ports

13 years agoStrip whitespace from SQL blocks in the isolation test suite. This is purely
Heikki Linnakangas [Thu, 18 Aug 2011 09:16:10 +0000 (12:16 +0300)]
Strip whitespace from SQL blocks in the isolation test suite. This is purely
cosmetic, it removes a lot of IMHO ugly whitespace from the expected output.

13 years agoImprove detection of Python 3.2 installations
Peter Eisentraut [Thu, 18 Aug 2011 11:43:16 +0000 (14:43 +0300)]
Improve detection of Python 3.2 installations

Because of ABI tagging, the library version number might no longer be
exactly the Python version number, so do extra lookups.  This affects
installations without a shared library, such as ActiveState's
installer.

Also update the way to detect the location of the 'config' directory,
which can also be versioned.

Ashesh Vashi

13 years agoChange PyInit_plpy to external linkage
Peter Eisentraut [Thu, 18 Aug 2011 09:53:32 +0000 (12:53 +0300)]
Change PyInit_plpy to external linkage

Module initialization functions in Python 3 must have external
linkage, because PyMODINIT_FUNC does dllexport on Windows-like
platforms.  Without this change, the build with Python 3 fails on
Windows.

13 years agoUpdate 9.1 release notes to reflect commits through today.
Tom Lane [Thu, 18 Aug 2011 00:18:23 +0000 (20:18 -0400)]
Update 9.1 release notes to reflect commits through today.

Also do another pass of copy-editing.

13 years agoFix two issues in plpython's handling of composite results.
Tom Lane [Wed, 17 Aug 2011 21:07:25 +0000 (17:07 -0400)]
Fix two issues in plpython's handling of composite results.

Dropped columns within a composite type were not handled correctly.
Also, we did not check for whether a composite result type had changed
since we cached the information about it.

Jan UrbaÅ„ski, per a bug report from Jean-Baptiste Quenot

13 years agoProperly handle empty arrays returned from plperl functions.
Andrew Dunstan [Wed, 17 Aug 2011 16:03:26 +0000 (12:03 -0400)]
Properly handle empty arrays returned from plperl functions.

Bug reported by David Wheeler, fix by Alex Hunsaker.
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
# modified:   src/pl/plperl/plperl.c
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
# autom4te.cache/
# configure.in~
# doc/src/sgml/ref/grant.sgml~
# src/backend/port/win32_latch.c~
# src/bin/psql/command.c~
# src/include/pg_config.h.win32~
# src/pl/plpython/plpython.c~
# src/tools/msvc/pgbison.bat~
# src/tools/msvc/pgbison.pl.bak
# src/tools/msvc/pgflex.bat~
# src/tools/msvc/pgflex.pl.bak
# src/tools/pgindent/README~
# src/tools/pgindent/pgindent.pl
# src/tools/pgindent/pgindent.pl~
# xxxxx
# yyyyyy

13 years agoTranslation updates
Peter Eisentraut [Wed, 17 Aug 2011 11:02:24 +0000 (14:02 +0300)]
Translation updates

13 years agoAdjust wording now that estimated size can increase
Magnus Hagander [Wed, 17 Aug 2011 09:01:06 +0000 (11:01 +0200)]
Adjust wording now that estimated size can increase

Per comment form Fujii Masao.

13 years agoIf backup-end record is not seen, and we reach end of recovery from a
Heikki Linnakangas [Wed, 17 Aug 2011 08:36:47 +0000 (11:36 +0300)]
If backup-end record is not seen, and we reach end of recovery from a
streamed backup, throw an error and refuse to start up. The restore has not
finished correctly in that case and the data directory is possibly corrupt.
We already errored out in case of archive recovery, but could not during
crash recovery because we couldn't distinguish between the case that
pg_start_backup() was called and the database then crashed (must not error,
data is OK), and the case that we're restoring from a backup and not all
the needed WAL was replayed (data can be corrupt).

To distinguish those cases, add a line to backup_label to indicate
whether the backup was taken with pg_start/stop_backup(), or by streaming
(ie. pg_basebackup).

This is a different implementation than what I committed to 9.2 a week ago.
That implementation was not back-patchable because it required re-initdb.

Fujii Masao

13 years agoMove \r out of translatable strings
Peter Eisentraut [Wed, 17 Aug 2011 07:52:35 +0000 (10:52 +0300)]
Move \r out of translatable strings

The translation tools are very unhappy about seeing \r in translatable
strings, so move it to a separate fprintf call.

13 years agoMacOS -> Mac OS
Peter Eisentraut [Wed, 17 Aug 2011 07:05:22 +0000 (10:05 +0300)]
MacOS -> Mac OS

Josh Kupershmidt

13 years agoForget about targeting catalog cache invalidations by tuple TID.
Tom Lane [Tue, 16 Aug 2011 19:26:30 +0000 (15:26 -0400)]
Forget about targeting catalog cache invalidations by tuple TID.

The TID isn't stable enough: we might queue an sinval event before a VACUUM
FULL, and then process it afterwards, when the target tuple no longer has
the same TID.  So we must invalidate entries on the basis of hash value
only.  The old coding can be shown to result in various bizarre,
hard-to-reproduce errors in the presence of concurrent VACUUM FULLs on
system catalogs, and could easily result in permanent catalog corruption,
up to and including complete loss of tables.

This commit is just a minimal fix that removes the unsafe comparison.
We should remove transmission of the tuple TID from sinval messages
altogether, and then arrange to suppress the extra message in the common
case of a heap_update that doesn't change the key hashvalue.  But that's
going to be much more invasive, and will only produce a probably-marginal
performance gain, so it doesn't seem like material for a back-patch.

Back-patch to 9.0.  Before that, VACUUM FULL refused to do any tuple moving
if it found any INSERT_IN_PROGRESS or DELETE_IN_PROGRESS tuples (and
CLUSTER would give up altogether), so there was no risk of moving a tuple
that might be the subject of an unsent sinval message.

13 years agoFix incorrect order of operations during sinval reset processing.
Tom Lane [Tue, 16 Aug 2011 18:38:29 +0000 (14:38 -0400)]
Fix incorrect order of operations during sinval reset processing.

We have to be sure that we have revalidated each nailed-in-cache relcache
entry before we try to use it to load data for some other relcache entry.
The introduction of "mapped relations" in 9.0 broke this, because although
we updated the state kept in relmapper.c early enough, we failed to
propagate that information into relcache entries soon enough; in
particular, we could try to fetch pg_class rows out of pg_class before
we'd updated its relcache entry's rd_node.relNode value from the map.

This bug accounts for Dave Gould's report of failures after "vacuum full
pg_class", and I believe that there is risk for other system catalogs
as well.

The core part of the fix is to copy relmapper data into the relcache
entries during "phase 1" in RelationCacheInvalidate(), before they'll be
used in "phase 2".  To try to future-proof the code against other similar
bugs, I also rearranged the order in which nailed relations are visited
during phase 2: now it's pg_class first, then pg_class_oid_index, then
other nailed relations.  This should ensure that RelationClearRelation can
apply RelationReloadIndexInfo to all nailed indexes without risking use
of not-yet-revalidated relcache entries.

Back-patch to 9.0 where the relation mapper was introduced.

13 years agoPreserve toast value OIDs in toast-swap-by-content for CLUSTER/VACUUM FULL.
Tom Lane [Tue, 16 Aug 2011 17:48:11 +0000 (13:48 -0400)]
Preserve toast value OIDs in toast-swap-by-content for CLUSTER/VACUUM FULL.

This works around the problem that a catalog cache entry might contain a
toast pointer that we try to dereference just as a VACUUM FULL completes
on that catalog.  We will see the sinval message on the cache entry when
we acquire lock on the toast table, but by that point we've already told
tuptoaster.c "here's the pointer to fetch", so it's difficult from a code
structural standpoint to update the pointer before we use it.  Much less
painful to ensure that toast pointers are not invalidated in the first
place.  We have to add a bit of code to deal with the case that a value
that previously wasn't toasted becomes so; but that should be a
seldom-exercised corner case, so the inefficiency shouldn't be significant.

Back-patch to 9.0.  In prior versions, we didn't allow CLUSTER on system
catalogs, and VACUUM FULL didn't result in reassignment of toast OIDs, so
there was no problem.

13 years agoFix race condition in relcache init file invalidation.
Tom Lane [Tue, 16 Aug 2011 17:12:03 +0000 (13:12 -0400)]
Fix race condition in relcache init file invalidation.

The previous code tried to synchronize by unlinking the init file twice,
but that doesn't actually work: it leaves a window wherein a third process
could read the already-stale init file but miss the SI messages that would
tell it the data is stale.  The result would be bizarre failures in catalog
accesses, typically "could not read block 0 in file ..." later during
startup.

Instead, hold RelCacheInitLock across both the unlink and the sending of
the SI messages.  This is more straightforward, and might even be a bit
faster since only one unlink call is needed.

This has been wrong since it was put in (in 2002!), so back-patch to all
supported releases.

13 years agoAdjust total size in pg_basebackup progress report when reality changes
Magnus Hagander [Tue, 16 Aug 2011 14:56:47 +0000 (16:56 +0200)]
Adjust total size in pg_basebackup progress report when reality changes

When streaming including WAL, the size estimate will always be incorrect,
since we don't know how much WAL is included. To make sure the output doesn't
look completely unreasonable, this patch increases the total size whenever we
go past the estimate, to make sure we never go above 100%.

13 years agoMake pg_basebackup progress report translatable
Peter Eisentraut [Tue, 16 Aug 2011 08:24:08 +0000 (11:24 +0300)]
Make pg_basebackup progress report translatable

Also fix a potential portability bug, because INT64_FORMAT is only
guaranteed to be available with snprintf, not fprintf.

13 years agoUse less cryptic variable names
Peter Eisentraut [Tue, 16 Aug 2011 08:19:50 +0000 (11:19 +0300)]
Use less cryptic variable names

13 years agoIn pg_upgrade, avoid dumping orphaned temporary tables. This makes the
Bruce Momjian [Tue, 16 Aug 2011 02:39:37 +0000 (22:39 -0400)]
In pg_upgrade, avoid dumping orphaned temporary tables.  This makes the
pg_upgrade schema matching pattern match pg_dump/pg_dumpall.

Fix for 9.0, 9.1, and 9.2.

13 years agoAdjust regression tests for error message change
Peter Eisentraut [Mon, 15 Aug 2011 14:27:10 +0000 (17:27 +0300)]
Adjust regression tests for error message change

13 years agoAdd "Reason code" prefix to internal SSI error messages
Peter Eisentraut [Mon, 15 Aug 2011 12:20:16 +0000 (15:20 +0300)]
Add "Reason code" prefix to internal SSI error messages

This makes it clearer that the error message is perhaps not supposed
to be understood by users, and it also makes it somewhat clearer that
it was not accidentally omitted from translation.

Idea from Heikki Linnakangas, except that we don't mark "Reason code"
for translation at this point, because that would make the
implementation too cumbersome.

13 years agoFix unsafe order of operations in foreign-table DDL commands.
Tom Lane [Sun, 14 Aug 2011 19:40:29 +0000 (15:40 -0400)]
Fix unsafe order of operations in foreign-table DDL commands.

When updating or deleting a system catalog tuple, it's necessary to acquire
RowExclusiveLock on the catalog before looking up the tuple; otherwise a
concurrent VACUUM FULL on the catalog might move the tuple to a different
TID before we can apply the update.  Coding patterns that find the tuple
via a table scan aren't at risk here, but when obtaining the tuple from a
catalog cache, correct ordering is important; and several routines in
foreigncmds.c got it wrong.  Noted while running the regression tests in
parallel with VACUUM FULL of assorted system catalogs.

For consistency I moved all the heap_open calls to the starts of their
functions, including a couple for which there was no actual bug.

Back-patch to 8.4 where foreigncmds.c was added.

13 years agoMessage style improvements
Peter Eisentraut [Sun, 14 Aug 2011 18:03:08 +0000 (21:03 +0300)]
Message style improvements

13 years agoFix typo
Peter Eisentraut [Sun, 14 Aug 2011 07:40:50 +0000 (10:40 +0300)]
Fix typo

13 years agoFix incorrect timeout handling during initial authentication transaction.
Tom Lane [Sat, 13 Aug 2011 21:52:24 +0000 (17:52 -0400)]
Fix incorrect timeout handling during initial authentication transaction.

The statement start timestamp was not set before initiating the transaction
that is used to look up client authentication information in pg_authid.
In consequence, enable_sig_alarm computed a wrong value (far in the past)
for statement_fin_time.  That didn't have any immediate effect, because the
timeout alarm was set without reference to statement_fin_time; but if we
subsequently blocked on a lock for a short time, CheckStatementTimeout
would consult the bogus value when we cancelled the lock timeout wait,
and then conclude we'd timed out, leading to immediate failure of the
connection attempt.  Thus an innocent "vacuum full pg_authid" would cause
failures of concurrent connection attempts.  Noted while testing other,
more serious consequences of vacuum full on system catalogs.

We should set the statement timestamp before StartTransactionCommand(),
so that the transaction start timestamp is also valid.  I'm not sure if
there are any non-cosmetic effects of it not being valid, but the xact
timestamp is at least sent to the statistics machinery.

Back-patch to 9.0.  Before that, the client authentication timeout was done
outside any transaction and did not depend on this state to be valid.

13 years agoAdd major features list and introductory text for 9.1 release notes.
Bruce Momjian [Thu, 11 Aug 2011 20:36:58 +0000 (16:36 -0400)]
Add major features list and introductory text for 9.1 release notes.

Backpatch to 9.1, obviously.

13 years agoUnbreak legacy syntax "COMMENT ON RULE x IS y", with no relation name.
Robert Haas [Thu, 11 Aug 2011 15:23:51 +0000 (11:23 -0400)]
Unbreak legacy syntax "COMMENT ON RULE x IS y", with no relation name.

check_object_ownership() isn't happy about the null relation pointer.
We could fix it there, but this seems more future-proof.

13 years agoBack-patch assorted latch-related fixes.
Tom Lane [Wed, 10 Aug 2011 16:20:45 +0000 (12:20 -0400)]
Back-patch assorted latch-related fixes.

Fix a whole bunch of signal handlers that had been hacked to do things that
might change errno, without adding the necessary save/restore logic for
errno.  Also make some minor fixes in unix_latch.c, and clean up bizarre
and unsafe scheme for disowning the process's latch.  While at it, rename
the PGPROC latch field to procLatch for consistency with 9.2.

Issues noted while reviewing a patch by Peter Geoghegan.

13 years agoMeasure WaitLatch's timeout parameter in milliseconds, not microseconds.
Tom Lane [Tue, 9 Aug 2011 22:52:35 +0000 (18:52 -0400)]
Measure WaitLatch's timeout parameter in milliseconds, not microseconds.

The original definition had the problem that timeouts exceeding about 2100
seconds couldn't be specified on 32-bit machines.  Milliseconds seem like
sufficient resolution, and finer grain than that would be fantasy anyway
on many platforms.

Back-patch to 9.1 so that this aspect of the latch API won't change between
9.1 and later releases.

Peter Geoghegan

13 years agoDocumentation improvement and minor code cleanups for the latch facility.
Tom Lane [Tue, 9 Aug 2011 19:30:51 +0000 (15:30 -0400)]
Documentation improvement and minor code cleanups for the latch facility.

Improve the documentation around weak-memory-ordering risks, and do a pass
of general editorialization on the comments in the latch code.  Make the
Windows latch code more like the Unix latch code where feasible; in
particular provide the same Assert checks in both implementations.
Fix poorly-placed WaitLatch call in syncrep.c.

This patch resolves, for the moment, concerns around weak-memory-ordering
bugs in latch-related code: we have documented the restrictions and checked
that existing calls meet them.  In 9.2 I hope that we will install suitable
memory barrier instructions in SetLatch/ResetLatch, so that their callers
don't need to be quite so careful.

13 years agoFix nested PlaceHolderVar expressions that appear only in targetlists.
Tom Lane [Tue, 9 Aug 2011 04:48:58 +0000 (00:48 -0400)]
Fix nested PlaceHolderVar expressions that appear only in targetlists.

A PlaceHolderVar's expression might contain another, lower-level
PlaceHolderVar.  If the outer PlaceHolderVar is used, the inner one
certainly will be also, and so we have to make sure that both of them get
into the placeholder_list with correct ph_may_need values during the
initial pre-scan of the query (before deconstruct_jointree starts).
We did this correctly for PlaceHolderVars appearing in the query quals,
but overlooked the issue for those appearing in the top-level targetlist;
with the result that nested placeholders referenced only in the targetlist
did not work correctly, as illustrated in bug #6154.

While at it, add some error checking to find_placeholder_info to ensure
that we don't try to create new placeholders after it's too late to do so;
they have to all be created before deconstruct_jointree starts.

Back-patch to 8.4 where the PlaceHolderVar mechanism was introduced.

13 years agoAdd "Compatibility" section to ALTER EXTENSION reference page
Peter Eisentraut [Sun, 7 Aug 2011 19:15:38 +0000 (22:15 +0300)]
Add "Compatibility" section to ALTER EXTENSION reference page

Almost all other pages have one; this one must have been forgotten.

13 years agoRemove whitespace from end of lines
Peter Eisentraut [Sun, 7 Aug 2011 13:11:55 +0000 (16:11 +0300)]
Remove whitespace from end of lines

13 years agoRename "Example" sections to "Examples" in dblink chapter
Peter Eisentraut [Sun, 7 Aug 2011 12:51:04 +0000 (15:51 +0300)]
Rename "Example" sections to "Examples" in dblink chapter

For consistency with other man pages.

13 years agoFix a whitespace issue with the man pages
Peter Eisentraut [Sun, 7 Aug 2011 07:49:45 +0000 (10:49 +0300)]
Fix a whitespace issue with the man pages

There is what may actually be a mistake in our markup.  The problem is
in a situation like

<para>
 <command>FOO</command> is ...

there is strictly speaking a line break before "FOO".  In the HTML
output, this does not appear to be a problem, but in the man page
output, this shows up, so you get double blank lines at odd places.

So far, we have attempted to work around this with an XSL hack, but
that causes other problems, such as creating run-ins in places like

<acronym>SQL</acronym> <command>COPY</command>

So fix the problem properly by removing the extra whitespace.  I only
fixed the problems that affect the man page output, not all the
places.

13 years agoClean up ill-advised attempt to invent a private set of Node tags.
Tom Lane [Sat, 6 Aug 2011 18:53:59 +0000 (14:53 -0400)]
Clean up ill-advised attempt to invent a private set of Node tags.

Somebody thought it'd be cute to invent a set of Node tag numbers that were
defined independently of, and indeed conflicting with, the main tag-number
list.  While this accidentally failed to fail so far, it would certainly
lead to trouble as soon as anyone wanted to, say, apply copyObject to these
node types.  Clang was already complaining about the use of makeNode on
these tags, and I think quite rightly so.  Fix by pushing these node
definitions into the mainstream, including putting replnodes.h where it
belongs.

13 years agoFix thinko in documentation of local_preload_libraries.
Tom Lane [Sat, 6 Aug 2011 01:18:02 +0000 (21:18 -0400)]
Fix thinko in documentation of local_preload_libraries.

Somebody added a cross-reference to shared_preload_libraries, but wrote the
wrong variable name when they did it (and didn't bother to make it a link
either).

Spotted by Christoph Anton Mitterer.

13 years agoReduce PG_SYSLOG_LIMIT to 900 bytes.
Tom Lane [Sat, 6 Aug 2011 01:02:31 +0000 (21:02 -0400)]
Reduce PG_SYSLOG_LIMIT to 900 bytes.

The previous limit of 1024 was set on the assumption that all modern syslog
implementations have line length limits of 2KB or so.  However, this is
false, as at least Solaris and sysklogd truncate at only 1KB.  900 seems
to leave enough room for the max likely length of the tacked-on prefixes,
so let's go with that.

As with the previous change, it doesn't seem wise to back-patch this into
already-released branches; but it should be OK to sneak it into 9.1.

Noah Misch

13 years agoFix markup for recent wal_level clarification.
Bruce Momjian [Thu, 4 Aug 2011 19:02:02 +0000 (15:02 -0400)]
Fix markup for recent wal_level clarification.

Backpatch to 9.1 and 9.0.

13 years agoIn documentaiton, clarify which commands have reduced WAL volume for
Bruce Momjian [Thu, 4 Aug 2011 16:06:53 +0000 (12:06 -0400)]
In documentaiton, clarify which commands have reduced WAL volume for
wal_level = minimum.

Backpatch to 9.1 and 9.0.

13 years agoMove CheckRecoveryConflictDeadlock() call to a safer place.
Tom Lane [Tue, 2 Aug 2011 19:16:37 +0000 (15:16 -0400)]
Move CheckRecoveryConflictDeadlock() call to a safer place.

This kluge was inserted in a spot apparently chosen at random: the lock
manager's state is not yet fully set up for the wait, and in particular
LockWaitCancel hasn't been armed by setting lockAwaited, so the ProcLock
will not get cleaned up if the ereport is thrown.  This seems to not cause
any observable problem in trivial test cases, because LockReleaseAll will
silently clean up the debris; but I was able to cause failures with tests
involving subtransactions.

Fixes breakage induced by commit c85c941470efc44494fd7a5f426ee85fc65c268c.
Back-patch to all affected branches.

13 years agoFix incorrect initialization of ProcGlobal->startupBufferPinWaitBufId.
Tom Lane [Tue, 2 Aug 2011 17:24:00 +0000 (13:24 -0400)]
Fix incorrect initialization of ProcGlobal->startupBufferPinWaitBufId.

It was initialized in the wrong place and to the wrong value.  With bad
luck this could result in incorrect query-cancellation failures in hot
standby sessions, should a HS backend be holding pin on buffer number 1
while trying to acquire a lock.

13 years agoAvoid integer overflow when LIMIT + OFFSET >= 2^63.
Heikki Linnakangas [Tue, 2 Aug 2011 07:47:17 +0000 (10:47 +0300)]
Avoid integer overflow when LIMIT + OFFSET >= 2^63.

This fixes bug #6139 reported by Hitoshi Harada.

13 years agoAdd host name resolution information to pg_hba.conf error messages
Peter Eisentraut [Sun, 31 Jul 2011 15:03:43 +0000 (18:03 +0300)]
Add host name resolution information to pg_hba.conf error messages

This is to be able to analyze issues with host names in pg_hba.conf.

13 years agoFix pg_update to properly test for the data directory's existence on
Bruce Momjian [Sat, 30 Jul 2011 05:50:19 +0000 (01:50 -0400)]
Fix pg_update to properly test for the data directory's existence on
Win32.

Backpatch to 9.1.

13 years agoFix pg_restore's direct-to-database mode for standard_conforming_strings.
Tom Lane [Thu, 28 Jul 2011 18:07:04 +0000 (14:07 -0400)]
Fix pg_restore's direct-to-database mode for standard_conforming_strings.

pg_backup_db.c contained a mini SQL lexer with which it tried to identify
boundaries between SQL commands, but that code was not designed to cope
with standard_conforming_strings, and would get the wrong answer if a
backslash immediately precedes a closing single quote in such a string,
as per report from Julian Mehnle.  The bug only affects direct-to-database
restores from archive files made with standard_conforming_strings = on.

Rather than complicating the code some more to try to fix that, let's just
rip it all out.  The only reason it was needed was to cope with COPY data
embedded into ordinary archive entries, which was a layout that was used
only for about the first three weeks of the archive format's existence,
and never in any production release of pg_dump.  Instead, just rely on the
archive file layout to tell us whether we're printing COPY data or not.

This bug represents a data corruption hazard in all releases in which
standard_conforming_strings can be turned on, ie 8.2 and later, so
back-patch to all supported branches.

13 years agoMinor message style adjustment
Peter Eisentraut [Wed, 27 Jul 2011 20:54:46 +0000 (23:54 +0300)]
Minor message style adjustment

13 years agoFix typo.
Robert Haas [Wed, 27 Jul 2011 15:20:07 +0000 (11:20 -0400)]
Fix typo.

Noted by Josh Kupershmidt.

13 years agoAdd missing newlines at end of error messages
Peter Eisentraut [Tue, 26 Jul 2011 20:27:40 +0000 (23:27 +0300)]
Add missing newlines at end of error messages

13 years agoClarify which relkinds accept column comments.
Robert Haas [Tue, 26 Jul 2011 13:34:55 +0000 (09:34 -0400)]
Clarify which relkinds accept column comments.

Per discussion with Josh Kupershmidt.

13 years agoDon't build replacement getpeereid function on mingw.
Andrew Dunstan [Tue, 26 Jul 2011 03:46:52 +0000 (23:46 -0400)]
Don't build replacement getpeereid function on mingw.

Windows doesn't have Unix sockets, so it's not needed, and moreover causes compile warnings.

13 years agoImprovements to SQL/MED documentation.
Robert Haas [Mon, 25 Jul 2011 13:37:06 +0000 (09:37 -0400)]
Improvements to SQL/MED documentation.

Laurenz Albe, somewhat modified by me.

13 years agoFix previous patch so it also works if not USE_SSL (mea culpa).
Tom Lane [Mon, 25 Jul 2011 03:29:10 +0000 (23:29 -0400)]
Fix previous patch so it also works if not USE_SSL (mea culpa).

On balance, the need to cover this case changes my mind in favor of pushing
all error-message generation duties into the two fe-secure.c routines.
So do it that way.

13 years agoImprove libpq's error reporting for SSL failures.
Tom Lane [Sun, 24 Jul 2011 20:29:13 +0000 (16:29 -0400)]
Improve libpq's error reporting for SSL failures.

In many cases, pqsecure_read/pqsecure_write set up useful error messages,
which were then overwritten with useless ones by their callers.  Fix this
by defining the responsibility to set an error message to be entirely that
of the lower-level function when using SSL.

Back-patch to 8.3; the code is too different in 8.2 to be worth the
trouble.

13 years agoUse OpenSSL's SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER flag.
Tom Lane [Sun, 24 Jul 2011 19:17:56 +0000 (15:17 -0400)]
Use OpenSSL's SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER flag.

This disables an entirely unnecessary "sanity check" that causes failures
in nonblocking mode, because OpenSSL complains if we move or compact the
write buffer.  The only actual requirement is that we not modify pending
data once we've attempted to send it, which we don't.  Per testing and
research by Martin Pihlak, though this fix is a lot simpler than his patch.

I put the same change into the backend, although it's less clear whether
it's necessary there.  We do use nonblock mode in some situations in
streaming replication, so seems best to keep the same behavior in the
backend as in libpq.

Back-patch to all supported releases.