]> granicus.if.org Git - postgresql/log
postgresql
12 years agoImplement the information schema with_hierarchy column
Peter Eisentraut [Sat, 27 Aug 2011 12:03:02 +0000 (15:03 +0300)]
Implement the information schema with_hierarchy column

In PostgreSQL, this is included in the SELECT privilege, so show YES
or NO depending on whether SELECT is granted.

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

12 years agoAdd another pgdefine path check, and a cvs-git change.
Bruce Momjian [Sat, 27 Aug 2011 01:52:35 +0000 (21:52 -0400)]
Add another pgdefine path check, and a cvs-git change.

12 years agoChange references of CVS to .git.
Bruce Momjian [Sat, 27 Aug 2011 01:43:34 +0000 (21:43 -0400)]
Change references of CVS to .git.

12 years agoAdd postgres.h to *.c files for pg_upgrade, ltree, and btree_gist, and
Bruce Momjian [Sat, 27 Aug 2011 01:16:24 +0000 (21:16 -0400)]
Add postgres.h to *.c files for pg_upgrade, ltree, and btree_gist, and
remove from local *.h files.

Per suggestion from Alvaro.

12 years agoFix missing pgdefine detection in pgrminclude.
Bruce Momjian [Fri, 26 Aug 2011 22:21:32 +0000 (18:21 -0400)]
Fix missing pgdefine detection in pgrminclude.

12 years agoModify pgrminclude to include all code, even in #if blocks. Process
Bruce Momjian [Fri, 26 Aug 2011 22:14:35 +0000 (18:14 -0400)]
Modify pgrminclude to include all code, even in #if blocks.  Process
.h include files before .c files.

Mark some includes as needed to be ignored by pgrminclude.

12 years agoCleanup of script.
Bruce Momjian [Fri, 26 Aug 2011 21:58:18 +0000 (17:58 -0400)]
Cleanup of script.

12 years agoAdd missing includes after pgrminclude run.
Bruce Momjian [Fri, 26 Aug 2011 20:52:16 +0000 (16:52 -0400)]
Add missing includes after pgrminclude run.

12 years agodo include files first
Bruce Momjian [Fri, 26 Aug 2011 20:10:34 +0000 (16:10 -0400)]
do include files first

12 years agoAdd markers.
Bruce Momjian [Fri, 26 Aug 2011 20:04:29 +0000 (16:04 -0400)]
Add markers.

12 years agoAdd another marker.
Bruce Momjian [Fri, 26 Aug 2011 19:13:41 +0000 (15:13 -0400)]
Add another marker.

12 years agoAdd markers for skips.
Bruce Momjian [Fri, 26 Aug 2011 17:51:26 +0000 (13:51 -0400)]
Add markers for skips.

12 years agoFix #if blocks.
Bruce Momjian [Fri, 26 Aug 2011 17:09:39 +0000 (13:09 -0400)]
Fix #if blocks.

12 years agoFix potential memory clobber in tsvector_concat().
Tom Lane [Fri, 26 Aug 2011 20:51:34 +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.

12 years agoImprove comments describing tsvector data structure.
Tom Lane [Fri, 26 Aug 2011 20:17:42 +0000 (16:17 -0400)]
Improve comments describing tsvector data structure.

12 years agoClean up weird corner cases in lexing of psql meta-command arguments.
Tom Lane [Fri, 26 Aug 2011 17:52:23 +0000 (13:52 -0400)]
Clean up weird corner cases in lexing of psql meta-command arguments.

These changes allow backtick command evaluation and psql variable
interpolation to happen on substrings of a single meta-command argument.
Formerly, no such evaluations happened at all if the backtick or colon
wasn't the first character of the argument, and we considered an argument
completed as soon as we'd processed one backtick, variable reference, or
quoted substring.  A string like 'FOO'BAR was thus taken as two arguments
not one, not exactly what one would expect.  In the new coding, an argument
is considered terminated only by unquoted whitespace or backslash.

Also, clean up a bunch of omissions, infelicities and outright errors in
the psql documentation of variables and metacommand argument syntax.

12 years agoSupport non-ASCII letters in psql variable names.
Tom Lane [Fri, 26 Aug 2011 14:41:31 +0000 (10:41 -0400)]
Support non-ASCII letters in psql variable names.

As in the backend, the implementation actually accepts any non-ASCII
character, but we only document that you can use letters.

12 years agoFix pgrminclude regex pattern.
Bruce Momjian [Fri, 26 Aug 2011 14:32:26 +0000 (10:32 -0400)]
Fix pgrminclude regex pattern.

12 years agoUnbreak MSVC build broken by my port of flex check.
Andrew Dunstan [Fri, 26 Aug 2011 14:21:43 +0000 (10:21 -0400)]
Unbreak MSVC build broken by my port of flex check.

flex puts lex.backup in the current working directory regardless
of where the input and output are.

12 years agoIn pgrminclude, add code to skip includes with a marker comment.
Bruce Momjian [Fri, 26 Aug 2011 14:08:39 +0000 (10:08 -0400)]
In pgrminclude, add code to skip includes with a marker comment.

12 years agoIn pgrminclude, make skipped include names constent and skip files with
Bruce Momjian [Fri, 26 Aug 2011 14:06:01 +0000 (10:06 -0400)]
In pgrminclude, make skipped include names constent and skip files with
#if/#ifdefs.

12 years agoIn pg_upgrade, limit schema name filter to include toast tables. Bug
Bruce Momjian [Fri, 26 Aug 2011 04:12:32 +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.

12 years agoPort backup check on psql lexer to MSVC.
Andrew Dunstan [Thu, 25 Aug 2011 21:27:36 +0000 (17:27 -0400)]
Port backup check on psql lexer to MSVC.

12 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.

12 years agoAdd makefile rules to check for backtracking in backend and psql lexers.
Tom Lane [Thu, 25 Aug 2011 18:44:17 +0000 (14:44 -0400)]
Add makefile rules to check for backtracking in backend and psql lexers.

Per discussion, we should enforce the policy of "no backtracking" in these
performance-sensitive scanners.

12 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.

12 years agoAdd "%option warn" to all flex input files that lacked it.
Tom Lane [Thu, 25 Aug 2011 17:55:57 +0000 (13:55 -0400)]
Add "%option warn" to all flex input files that lacked it.

This is recommended in the flex manual, and there seems no good reason
not to use it everywhere.

12 years agoChange format of SQL/MED generic options in psql backslash commands.
Robert Haas [Thu, 25 Aug 2011 16:47:30 +0000 (12:47 -0400)]
Change format of SQL/MED generic options in psql backslash commands.

Rather than dumping out the raw array as PostgreSQL represents it
internally, we now print it out in a format similar to the one in
which the user input it, which seems a lot more user friendly.

Shigeru Hanada

12 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

12 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.

12 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.

12 years agoAdd a regression test for pgstattuple.
Tom Lane [Thu, 25 Aug 2011 04:06:16 +0000 (00:06 -0400)]
Add a regression test for pgstattuple.

This is mainly to prove that the NaN fix actually works cross-platform.

12 years agoFix pgstatindex() to give consistent results for empty indexes.
Tom Lane [Thu, 25 Aug 2011 03:50:10 +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.

12 years agoUpdate FK alternative test output to new whitespace rules
Alvaro Herrera [Wed, 24 Aug 2011 21:21:19 +0000 (18:21 -0300)]
Update FK alternative test output to new whitespace rules

With these changes, the isolation tests pass again on isolation levels
serializable and repeatable read.

Author: Kevin Grittner

12 years agoFix pgxs.mk to always add --dbname=$(CONTRIB_TESTDB) to REGRESS_OPTS.
Tom Lane [Wed, 24 Aug 2011 19:16:17 +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.

12 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).

12 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.

12 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.

12 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.

12 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.

12 years agoUse consistent format for reporting GetLastError()
Peter Eisentraut [Tue, 23 Aug 2011 19:00:52 +0000 (22:00 +0300)]
Use consistent format for reporting GetLastError()

Use something like "error code %lu" for reporting GetLastError()
values on Windows.  Previously, a mix of different wordings and
formats were in use.

12 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

12 years agoAdd missing include so include file compiles cleanly on its own.
Bruce Momjian [Tue, 23 Aug 2011 03:19:21 +0000 (23:19 -0400)]
Add missing include so include file compiles cleanly on its own.

12 years agoMark cpluspluscheck as excutable in git.
Bruce Momjian [Tue, 23 Aug 2011 02:14:23 +0000 (22:14 -0400)]
Mark cpluspluscheck as excutable in git.

12 years agoTypo fix.
Robert Haas [Mon, 22 Aug 2011 16:16:03 +0000 (12:16 -0400)]
Typo fix.

12 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.

12 years agoProperly call strerror() in thread test; add comments.
Bruce Momjian [Mon, 22 Aug 2011 13:04:48 +0000 (09:04 -0400)]
Properly call strerror() in thread test;  add comments.

12 years agoSimplify errno generating in thread testing program.
Bruce Momjian [Mon, 22 Aug 2011 01:24:03 +0000 (21:24 -0400)]
Simplify errno generating in thread testing program.

12 years agoFix trigger WHEN conditions when both BEFORE and AFTER triggers exist.
Tom Lane [Sun, 21 Aug 2011 22:15:55 +0000 (18:15 -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.

12 years agoHave thread_test create its test files in the current directory, rather
Bruce Momjian [Sat, 20 Aug 2011 22:21:53 +0000 (18:21 -0400)]
Have thread_test create its test files in the current directory, rather
than /tmp.  Also cleanup C defines and add comments.

Per report by Alex Soto

12 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.

12 years agoFix copyright.pl to properly us 'tie' function.
Bruce Momjian [Fri, 19 Aug 2011 23:31:12 +0000 (19:31 -0400)]
Fix copyright.pl to properly us 'tie' function.

Kris Jurka

12 years agoFix problem with regex in copyright test.
Bruce Momjian [Fri, 19 Aug 2011 21:45:10 +0000 (17:45 -0400)]
Fix problem with regex in copyright test.

Report and fix by Kris Jurka

12 years agoRemove use of 'tie' in perl for copyright.pl; instead use normal file
Bruce Momjian [Fri, 19 Aug 2011 21:43:32 +0000 (17:43 -0400)]
Remove use of 'tie' in perl for copyright.pl;  instead use normal file
open/close.

12 years agoAdd executable bit to file.
Bruce Momjian [Fri, 19 Aug 2011 21:18:06 +0000 (17:18 -0400)]
Add executable bit to file.

12 years agoImplement src/tools/copyright as a Perl program, so anyone can run it.
Bruce Momjian [Fri, 19 Aug 2011 17:50:39 +0000 (13:50 -0400)]
Implement src/tools/copyright as a Perl program, so anyone can run it.

David Fetter

12 years agoClean up 'chkselinuxenv' script.
Robert Haas [Fri, 19 Aug 2011 17:09:40 +0000 (13:09 -0400)]
Clean up 'chkselinuxenv' script.

Eliminate dependencies on "which", as we don't really need that to be
installed for proper testing.  Don't number the tests, as that increases
the footprint of every patch that wants to add or remove tests.  Make
the test output more informative, so that it's a bit easier to see what
went right (or wrong).  Spelling and grammar improvements.

12 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.

12 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.

12 years agoIn pg_upgrade, don't copy visibility map files from clusters that did not
Bruce Momjian [Fri, 19 Aug 2011 15:20:30 +0000 (11:20 -0400)]
In pg_upgrade, don't copy visibility map files from clusters that did not
have crash-safe visibility maps to clusters that expect crash-safety.

Request from Robert Haas.

12 years agoTypo fix.
Robert Haas [Thu, 18 Aug 2011 17:10:18 +0000 (13:10 -0400)]
Typo fix.

12 years agoExplain max_prepared_transactions requirement in isolation tests' README.
Tom Lane [Thu, 18 Aug 2011 15:45:25 +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.

12 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

12 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.

12 years agoMake lazy_vacuum_rel call pg_rusage_init only if needed.
Robert Haas [Thu, 18 Aug 2011 13:55:04 +0000 (09:55 -0400)]
Make lazy_vacuum_rel call pg_rusage_init only if needed.

do_analyze_rel already does it this way.

Euler Taveira de Oliveira

12 years agoRemove obsolete README file.
Robert Haas [Thu, 18 Aug 2011 13:49:41 +0000 (09:49 -0400)]
Remove obsolete README file.

Perhaps we ought to add some other kind of documentation here instead,
but for now let's get rid of this woefully obsolete description of the
sinval machinery.

12 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

12 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.

12 years agoHide unused variable warnings under Python 3
Peter Eisentraut [Thu, 18 Aug 2011 08:40:30 +0000 (11:40 +0300)]
Hide unused variable warnings under Python 3

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

Also do another pass of copy-editing.

12 years agoFix two issues in plpython's handling of composite results.
Tom Lane [Wed, 17 Aug 2011 21:07:16 +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

12 years agoProperly handle empty arrays returned from plperl functions.
Andrew Dunstan [Wed, 17 Aug 2011 15:59:18 +0000 (11:59 -0400)]
Properly handle empty arrays returned from plperl functions.

Bug reported by David Wheeler, fix by Alex Hunsaker.

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

12 years agoTeach pg_controldata and pg_resetxlog about the new backupEndRequired field
Heikki Linnakangas [Wed, 17 Aug 2011 09:36:41 +0000 (12:36 +0300)]
Teach pg_controldata and pg_resetxlog about the new backupEndRequired field
in control file.

12 years agoFix comment about which version had BACKUP METHOD line in backup_lable, again.
Heikki Linnakangas [Wed, 17 Aug 2011 08:47:45 +0000 (11:47 +0300)]
Fix comment about which version had BACKUP METHOD line in backup_lable, again.
It was invalidated again by Fujii's patch to 9.1.

12 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.

12 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.

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

Josh Kupershmidt

12 years agoRevise sinval code to remove no-longer-used tuple TID from inval messages.
Tom Lane [Tue, 16 Aug 2011 23:27:46 +0000 (19:27 -0400)]
Revise sinval code to remove no-longer-used tuple TID from inval messages.

This requires adjusting the API for syscache callback functions: they now
get a hash value, not a TID, to identify the target tuple.  Most of them
weren't paying any attention to that argument anyway, but plancache did
require a small amount of fixing.

Also, improve performance a trifle by avoiding sending duplicate inval
messages when a heap_update isn't changing the catcache lookup columns.

12 years agoForget about targeting catalog cache invalidations by tuple TID.
Tom Lane [Tue, 16 Aug 2011 19:26:22 +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.

12 years agoFix incorrect order of operations during sinval reset processing.
Tom Lane [Tue, 16 Aug 2011 18:38:20 +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.

12 years agoPreserve toast value OIDs in toast-swap-by-content for CLUSTER/VACUUM FULL.
Tom Lane [Tue, 16 Aug 2011 17:48:04 +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.

12 years agoFix race condition in relcache init file invalidation.
Tom Lane [Tue, 16 Aug 2011 17:11:54 +0000 (13:11 -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.

12 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%.

12 years agoFix bogus comment that claimed that the new BACKUP METHOD line in
Heikki Linnakangas [Tue, 16 Aug 2011 09:21:50 +0000 (12:21 +0300)]
Fix bogus comment that claimed that the new BACKUP METHOD line in
backup_label was new in 9.0. Spotted by Fujii Masao.

12 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.

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

12 years agoIn pg_upgrade, avoid dumping orphaned temporary tables. This makes the
Bruce Momjian [Tue, 16 Aug 2011 02:39:31 +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.

12 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

12 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.

12 years agoFix unsafe order of operations in foreign-table DDL commands.
Tom Lane [Sun, 14 Aug 2011 19:40:21 +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.

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

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

12 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.

12 years agoMake USECS_PER_* timestamp macros visible even when we are not using
Bruce Momjian [Sat, 13 Aug 2011 01:32:19 +0000 (21:32 -0400)]
Make USECS_PER_* timestamp macros visible even when we are not using
integer timestamps.

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

Backpatch to 9.1, obviously.

13 years agoTeach unix_latch.c to use poll() where available.
Tom Lane [Thu, 11 Aug 2011 16:49:45 +0000 (12:49 -0400)]
Teach unix_latch.c to use poll() where available.

poll() is preferred over select() on platforms where both are available,
because it tends to be a bit faster and it doesn't have an arbitrary limit
on the range of FD numbers that can be accessed.  The FD range limit does
not appear to be a risk factor for any 9.1 usages, so this doesn't need to
be back-patched, but we need to have it in place if we keep on expanding
the uses of WaitLatch.

13 years agoDisplay both per-table and per-column FDW options in psql's \d output.
Robert Haas [Thu, 11 Aug 2011 15:45:47 +0000 (11:45 -0400)]
Display both per-table and per-column FDW options in psql's \d output.

Along the way, rename "Options" to "FDW Options" in various places for
consistency and clarity.

Shigeru Hanada

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.