]> granicus.if.org Git - postgresql/log
postgresql
12 years agoRemove unnecessary #include references, per pgrminclude script.
Bruce Momjian [Thu, 1 Sep 2011 14:03:22 +0000 (10:03 -0400)]
Remove unnecessary #include references, per pgrminclude script.

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

12 years agoMinor improvements to mbregress.sh script.
Robert Haas [Thu, 1 Sep 2011 13:21:10 +0000 (09:21 -0400)]
Minor improvements to mbregress.sh script.

1. Use new dropdb --if-exists option, to avoid alarming the user if
   the database being dropped doesn't already exist.
2. Bail out if createdb fails.
3. exit 1 if the checks fail.
4. Make it executable.

Josh Kupershmidt, with some kibitzing by me.

12 years agoUserspace access vector cache for contrib/sepgsql.
Robert Haas [Thu, 1 Sep 2011 12:37:33 +0000 (08:37 -0400)]
Userspace access vector cache for contrib/sepgsql.

KaiGai Kohei

12 years agoFix "is db labeled test?" in chkselinuxenv script.
Robert Haas [Thu, 1 Sep 2011 12:28:26 +0000 (08:28 -0400)]
Fix "is db labeled test?" in chkselinuxenv script.

Don't test whether the number of labels is numerically equal to zero;
count(*) isn't going return zero anyway, and the current coding blows
up if it returns an empty string or an error.

12 years agoRemove "fmgr.h" include in cube contrib --- caused crash on a Gentoo
Bruce Momjian [Thu, 1 Sep 2011 11:22:01 +0000 (07:22 -0400)]
Remove "fmgr.h" include in cube contrib --- caused crash on a Gentoo
builfarm member.

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

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

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

12 years agoFurther repair of eqjoinsel ndistinct-clamping logic.
Tom Lane [Thu, 1 Sep 2011 04:18:28 +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.

12 years agoFix pg_upgrade to preserve toast relfrozenxids for old 8.3 servers.
Bruce Momjian [Thu, 1 Sep 2011 01:49:58 +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.

12 years agoImprove eqjoinsel's ndistinct clamping to work for multiple levels of join.
Tom Lane [Wed, 31 Aug 2011 20:04:48 +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.

12 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

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

12 years agoFix a missed case in code for "moving average" estimate of reltuples.
Tom Lane [Tue, 30 Aug 2011 18:49:45 +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.

12 years agoClean up pg_regress --help output
Peter Eisentraut [Tue, 30 Aug 2011 18:25:10 +0000 (21:25 +0300)]
Clean up pg_regress --help output

Put options listing in a less random order, fix capitalization, and
some typos.

12 years agoSome markup cleanup to deconfuse the find_gt_lt tool
Peter Eisentraut [Tue, 30 Aug 2011 17:32:49 +0000 (20:32 +0300)]
Some markup cleanup to deconfuse the find_gt_lt tool

Josh Kupershmidt

12 years agoRepair brain fade in previous commit, per Josh Kupershmidt.
Robert Haas [Tue, 30 Aug 2011 16:49:18 +0000 (12:49 -0400)]
Repair brain fade in previous commit, per Josh Kupershmidt.

12 years agoAdd --if-exists option to dropdb and dropuser.
Robert Haas [Tue, 30 Aug 2011 16:06:40 +0000 (12:06 -0400)]
Add --if-exists option to dropdb and dropuser.

Josh Kupershmidt, with some further editing by me.

12 years agoDetect out of date flex in MSVC builds.
Andrew Dunstan [Tue, 30 Aug 2011 16:06:32 +0000 (12:06 -0400)]
Detect out of date flex in MSVC builds.

Per recent discussion, following a report from Quan Zongliang.
The same logic is used as in pgbison.pl.

12 years agoFix parsing of time string followed by yesterday/today/tomorrow.
Robert Haas [Tue, 30 Aug 2011 15:34:29 +0000 (11:34 -0400)]
Fix parsing of time string followed by yesterday/today/tomorrow.

Previously, 'yesterday 04:00:00'::timestamp didn't do the same thing as
'04:00:00 yesterday'::timestamp, and the return value from the latter
was midnight rather than the specified time.

Dean Rasheed, with some stylistic changes

12 years agoRemove some tabs from README file.
Robert Haas [Tue, 30 Aug 2011 02:25:17 +0000 (22:25 -0400)]
Remove some tabs from README file.

Some of the ASCII art expected 8-space tab stops, and some of it
expected 4-space tab stops.

Per report from YAMAMOTO Takashi.

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

12 years agoUse a non-locking test in TAS_SPIN() on all IA64 platforms.
Tom Lane [Mon, 29 Aug 2011 17:18:44 +0000 (13:18 -0400)]
Use a non-locking test in TAS_SPIN() on all IA64 platforms.

Per my testing, this works just as well with gcc as it does with HP's
compiler; and there is no reason to think that the effect doesn't occur
with icc, either.

Also, rewrite the header comment about enforcing sequencing around spinlock
operations, per Robert's gripe that it was misleading.

12 years agoImprove spinlock performance for HP-UX, ia64, non-gcc.
Robert Haas [Mon, 29 Aug 2011 14:05:48 +0000 (10:05 -0400)]
Improve spinlock performance for HP-UX, ia64, non-gcc.

At least on this architecture, it's very important to spin on a
non-atomic instruction and only retry the atomic once it appears
that it will succeed.  To fix this, split TAS() into two macros:
TAS(), for trying to grab the lock the first time, and TAS_SPIN(),
for spinning until we get it.  TAS_SPIN() defaults to same as TAS(),
but we can override it when we know there's a better way.

It's likely that some of the other cases in s_lock.h require
similar treatment, but this is the only one we've got conclusive
evidence for at present.

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

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

12 years agoInclude $cc_string in the info reported by a configure run.
Tom Lane [Sun, 28 Aug 2011 21:14:52 +0000 (17:14 -0400)]
Include $cc_string in the info reported by a configure run.

Without this, it's not very easy to tell which compiler version a buildfarm
animal is actually using at the moment.

12 years agoModify pgrminclude -v to report include files that can't be compiled on
Bruce Momjian [Sun, 28 Aug 2011 17:04:01 +0000 (13:04 -0400)]
Modify pgrminclude -v to report include files that can't be compiled on
their own.

Avoid compile problems with defines being redefined after the removal of
the #if blocks.

Change script to use shell functions for simplicity.

12 years agoDon't assume that "E" response to NEGOTIATE_SSL_CODE means pre-7.0 server.
Tom Lane [Sat, 27 Aug 2011 20:36:57 +0000 (16:36 -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.

12 years agoDocument minimum required version of DocBook XSL stylesheets
Peter Eisentraut [Sat, 27 Aug 2011 20:28:55 +0000 (23:28 +0300)]
Document minimum required version of DocBook XSL stylesheets

12 years agoEnsure we discard unread/unsent data when abandoning a connection attempt.
Tom Lane [Sat, 27 Aug 2011 18:16:14 +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.

12 years agoAllow more include files to be compiled in their own by adding missing
Bruce Momjian [Sat, 27 Aug 2011 15:05:33 +0000 (11:05 -0400)]
Allow more include files to be compiled in their own by adding missing
include dependencies.

Modify pgcompinclude to skip a common fcinfo error.

12 years agoAdd support for #elif to pgrminclude.
Bruce Momjian [Sat, 27 Aug 2011 13:24:27 +0000 (09:24 -0400)]
Add support for #elif to pgrminclude.

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