Commit Graph

2177 Commits

Author SHA1 Message Date
Peter Eisentraut d383c23f6f Remove support for on_exit()
All supported platforms support the C89 standard function atexit()
(SunOS 4 probably being the last one not to), and supporting both
makes the code clumsy.
2011-12-27 20:57:59 +02:00
Peter Eisentraut c317a3ac16 Run "make all" as a prerequisite of "make check"
This is the standard behavior but was forgotten in some places.
2011-12-27 20:27:24 +02:00
Robert Haas e1042a3484 sepgsql: Check CREATE permissions for some object types.
KaiGai Kohei, reviewed by Dimitri Fontaine and me.
2011-12-21 09:14:02 -05:00
Robert Haas ab7d4213f9 If pg_test_fsync is interrupted, clean up the temp file.
Marti Raudsepp, with additional paranoia by me.
2011-12-09 15:06:46 -05:00
Magnus Hagander 16d8e594ac Remove spclocation field from pg_tablespace
Instead, add a function pg_tablespace_location(oid) used to return
the same information, and do this by reading the symbolic link.

Doing it this way makes it possible to relocate a tablespace when the
database is down by simply changing the symbolic link.
2011-12-07 10:37:33 +01:00
Bruce Momjian 0e8f6bf0e7 In pg_upgrade, allow tables using regclass to be upgraded because we
preserve pg_class oids since PG 9.0.
2011-12-05 16:45:19 -05:00
Tom Lane 9c6aa8cca0 Move EXTRA_CLEAN to where it actually works. 2011-11-29 23:14:16 -05:00
Peter Eisentraut b258ceb3ad pg_upgrade: Disable installcheck
Disabled for now because some build farm members with low resources
are not prepared to handle it.
2011-11-29 06:57:09 +02:00
Peter Eisentraut 08da2d282f Add pg_upgrade test suite
It runs the regression tests, runs pg_upgrade on the populated
database, and compares the before and after dumps.  While not actually
a cross-version upgrade, this does detect omissions and bugs in the
involved tools from time to time.  It's also possible to do a
cross-version upgrade by manually supplying parameters.
2011-11-27 22:42:32 +02:00
Tom Lane 6c8768c386 Fix overly-aggressive and inconsistent quoting in OS X start script.
Sidar Lopez, per bug #6310, with some additional improvements by me.
Back-patch to 9.0, where the issue was introduced.
2011-11-26 13:01:02 -05:00
Bruce Momjian 32fb4546e3 Remove ENABLE_SAME_CATVERSION_UPGRADES as unnecessary. 2011-11-25 19:08:41 -05:00
Bruce Momjian 5df1403b0f Add pg_upgrade ENABLE_SAME_CATVERSION_UPGRADES macro for testing to
allow upgrades of the same catalog version.  (Doesn't work for
tablespaces, as indicated by C comment.)
2011-11-23 22:51:45 -05:00
Tom Lane 9b97b7f835 Fix citext upgrade script to update derived copies of pg_type.typcollation.
If the existing citext type has not merely been created, but used in any
tables, then the upgrade script wasn't doing enough.  We have to update
attcollation for each citext table column, and indcollation for each citext
index column, as well.  Per report from Rudolf van der Leeden.
2011-11-21 11:24:39 -05:00
Bruce Momjian 7012b5edb7 Remove scandir() requirement in pg_upgrade; instead just use readdir()
--- we were not using the scandir pattern filtering anyway.  This also
removes the scandir requirement in configure.
2011-11-17 21:59:49 -05:00
Alvaro Herrera ef27c81d89 Don't quote language name
Same as previous patch, but give it actual thought this time
2011-11-17 18:35:07 -03:00
Alvaro Herrera b44dda7158 Don't quote language name
It's been deprecated for ages according to Tom, and it breaks now given
the previous patch anyway.

Per buildfarm
2011-11-17 18:27:54 -03:00
Bruce Momjian ee3ef8f30c Fix pg_upgrade's pg_scandir_internal() the right way. Backpatch to 9.1. 2011-11-17 13:40:44 -05:00
Bruce Momjian 988f907d24 Fix pg_upgrade's pg_scandir_internal() to properly handle a NULL
pattern, which is used on PG 9.1 and HEAD (but not pre-9.1).  Fixes
crash on Windows.

Backpatched to 9.1.

Reported by Mark Dilger
2011-11-17 13:24:54 -05:00
Bruce Momjian b735757c32 Remove pg_upgrade function no longer called (dir_matching_filenames). 2011-11-17 13:17:33 -05:00
Robert Haas bb1afb528a Fix hstore regression tests.
This was an oversight in commit b60653bc0b.

Also, fix a typo spotted by Thom Brown.
2011-11-08 08:09:10 -05:00
Robert Haas b60653bc0b Remove hstore's text => text operator.
Since PostgreSQL 9.0, we've emitted a warning message when an operator
named => is created, because the SQL standard now reserves that token
for another use.  But we've also shipped such an operator with hstore.
Use of the function hstore(text, text) has been recommended in
preference to =>(text, text).  Per discussion, it's now time to take
the next step and stop shipping the operator.  This will allow us to
prohibit the use of => as an operator name in a future release if and
when we wish to support the SQL standard use of this token.

The release notes should mention this incompatibility.

Patch by me, reviewed by David Wheeler, Dimitri Fontaine and Tom Lane.
2011-11-07 21:47:45 -05:00
Tom Lane ced3a93ccb Fix assorted bugs in contrib/unaccent's configuration file parsing.
Make it use t_isspace() to identify whitespace, rather than relying on
sscanf which is known to get it wrong on some platform/locale combinations.
Get rid of fixed-size buffers.  Make it actually continue to parse the file
after ignoring a line with untranslatable characters, as was obviously
intended.

The first of these issues is per gripe from J Smith, though not exactly
either of his proposed patches.
2011-11-07 11:50:18 -05:00
Robert Haas b76c61f1e8 Silence bogus compiler warning. 2011-11-04 10:40:52 -04:00
Robert Haas c9f48b572c Check the return value of getcwd(), instead of assuming success.
Kevin Grittner
2011-11-04 10:40:25 -04:00
Tom Lane e3e3087d87 Fix bogus code in contrib/ tsearch dictionary examples.
Both dict_int and dict_xsyn were blithely assuming that whatever memory
palloc gives back will be pre-zeroed.  This would typically work for
just about long enough to run their regression tests, and no longer :-(.

The pre-9.0 code in dict_xsyn was even lamer than that, as it would
happily give back a pointer to the result of palloc(0), encouraging
its caller to access off the end of memory.  Again, this would just
barely fail to fail as long as memory contained nothing but zeroes.

Per a report from Rodrigo Hjort that code based on these examples
didn't work reliably.
2011-11-03 19:17:48 -04:00
Bruce Momjian 84b8fcaa92 Adjust pg_upgrade "new database skip" code, e.g. 'postgres', to more
cleanly handle old/new database mismatches.
2011-11-03 13:57:52 -04:00
Peter Eisentraut 654e1f96b0 Clean up whitespace and indentation in parser and scanner files
These are not touched by pgindent, so clean them up a bit manually.
2011-11-01 21:51:30 +02:00
Bruce Momjian 09d1174e5a Update pg_upgrade comment on missing 'postgres' database. 2011-11-01 14:34:35 -04:00
Bruce Momjian a50d860ae1 Allow pg_upgrade to upgrade an old cluster that doesn't have a
'postgres' database.
2011-11-01 13:49:48 -04:00
Bruce Momjian 51eba98cf4 Remove pg_upgrade dependency on the 'postgres' database existing in the
new cluster.   vacuumdb, used by pg_upgrade, still has this dependency.
2011-10-28 21:19:21 -04:00
Bruce Momjian 9846dcfb9e Clarify pg_upgrade error message that the 'postgres' database must exist
in the old cluster.
2011-10-28 08:09:15 -04:00
Bruce Momjian 38f3c7c4dd Update pg_upgrade testing instructions. 2011-10-27 21:29:03 -04:00
Tom Lane 458857cc9d Throw a useful error message if an extension script file is fed to psql.
We have seen one too many reports of people trying to use 9.1 extension
files in the old-fashioned way of sourcing them in psql.  Not only does
that usually not work (due to failure to substitute for MODULE_PATHNAME
and/or @extschema@), but if it did work they'd get a collection of loose
objects not an extension.  To prevent this, insert an \echo ... \quit
line that prints a suitable error message into each extension script file,
and teach commands/extension.c to ignore lines starting with \echo.
That should not only prevent any adverse consequences of loading a script
file the wrong way, but make it crystal clear to users that they need to
do it differently now.

Tom Lane, following an idea of Andrew Dunstan's.  Back-patch into 9.1
... there is not going to be much value in this if we wait till 9.2.
2011-10-12 15:45:03 -04:00
Bruce Momjian 0dc3f57ba0 In pg_upgrade, add -o/-O options to pass parameters to the servers, and
document its use for config-only directory installs.
2011-10-10 07:44:11 -04:00
Bruce Momjian caa1054df8 In pg_upgrade, use the new postmaster -C option to get the real data
directory, for config-only directory installs.  Only works for PG 9.2+
servers.
2011-10-07 14:40:23 -04:00
Bruce Momjian a3996754cc In pg_upgrade, improve popen() failure detection by checking for fgets()
failures.
2011-10-06 19:37:29 -04:00
Robert Haas 1cb018dd09 Make pgstatindex respond to cancel interrupts.
A similar problem for pgstattuple() was fixed in April of 2010 by commit
33065ef8bc, but pgstatindex() seems to have
been overlooked.

Back-patch all the way, as with that commit, though not to 7.4 through
8.1, since those are now EOL.
2011-10-06 12:09:33 -04:00
Tom Lane 41e461d36f Improve define_custom_variable's handling of pre-existing settings.
Arrange for any problems with pre-existing settings to be reported as
WARNING not ERROR, so that we don't undesirably abort the loading of the
incoming add-on module.  The bad setting is just discarded, as though it
had never been applied at all.  (This requires a change in the API of
set_config_option.  After some thought I decided the most potentially
useful addition was to allow callers to just pass in a desired elevel.)

Arrange to restore the complete stacked state of the variable, rather than
cheesily reinstalling only the active value.  This ensures that custom GUCs
will behave unsurprisingly even when the module loading operation occurs
within nested subtransactions that have changed the active value.  Since a
module load could occur as a result of, eg, a PL function call, this is not
an unlikely scenario.
2011-10-04 19:57:21 -04:00
Bruce Momjian 878b74e094 In pg_upgrade, remove unnecessary local variable. 2011-10-01 10:01:43 -04:00
Tom Lane 0a5d5a49d9 Cache the result of makesign() across calls of gtrgm_penalty().
Since gtrgm_penalty() is usually called many times in a row with the same
"newval" (to determine which item on an index page newval fits into best),
the makesign() calculation is repetitious.  It's expensive enough to make
it worth caching the result, so do so.  On my machine this is good for
more than a 40% savings in the time needed to build a trigram index on
/usr/share/dict/words.  This is all per a suggestion of Heikki's.

In passing, make some mostly-cosmetic improvements in the caching logic in
the other functions in this file that rely on caching info in fn_extra.
2011-09-30 23:54:27 -04:00
Bruce Momjian 5e5958428b In pg_upgrade, because toast table names can be mismatched with the heap
oid on 8.4, modify the toast name comparison test to only apply to old
9.0+ servers.  (The test was previously 8.4+.)

Backpatch to 9.1.X.
2011-09-28 22:30:44 -04:00
Tom Lane cc4ff8742b Take sepgsql regression tests out of the regular regression test mechanism.
Because these tests require root privileges, not to mention invasive
changes to the security configuration of the host system, it's not
reasonable for them to be invoked by a regular "make check" or "make
installcheck".  Instead, dike out the Makefile's knowledge of the tests,
and change chkselinuxenv (now renamed "test_sepgsql") into a script that
verifies the environment is workable and then runs the tests.  It's
expected that test_sepgsql will only be run manually.

While at it, do some cleanup in the error checking in the script, and
do some wordsmithing in the documentation.
2011-09-27 20:07:15 -04:00
Robert Haas a9d845be49 sepgsql uavc comment improvements.
Robert Haas and KaiGai Kohei
2011-09-27 08:37:46 -04:00
Robert Haas 291873c155 Teach sepgsql about database labels.
This is still a bit of a hack, but it's better than the old way, for sure.

KaiGai Kohei, with one change by me to make it compile
2011-09-23 17:09:34 -04:00
Robert Haas e50b052a3b Add missing brackets to chkselinuxenv. 2011-09-23 17:02:09 -04:00
Tom Lane 86a3f2d492 Add FORCE_NOT_NULL support to the file_fdw foreign data wrapper.
This is implemented as a per-column boolean option, rather than trying
to match COPY's convention of a single option listing the column names.

Shigeru Hanada, reviewed by KaiGai Kohei
2011-09-16 16:35:51 -04:00
Tom Lane e6faf910d7 Redesign the plancache mechanism for more flexibility and efficiency.
Rewrite plancache.c so that a "cached plan" (which is rather a misnomer
at this point) can support generation of custom, parameter-value-dependent
plans, and can make an intelligent choice between using custom plans and
the traditional generic-plan approach.  The specific choice algorithm
implemented here can probably be improved in future, but this commit is
all about getting the mechanism in place, not the policy.

In addition, restructure the API to greatly reduce the amount of extraneous
data copying needed.  The main compromise needed to make that possible was
to split the initial creation of a CachedPlanSource into two steps.  It's
worth noting in particular that SPI_saveplan is now deprecated in favor of
SPI_keepplan, which accomplishes the same end result with zero data
copying, and no need to then spend even more cycles throwing away the
original SPIPlan.  The risk of long-term memory leaks while manipulating
SPIPlans has also been greatly reduced.  Most of this improvement is based
on use of the recently-added MemoryContextSetParent primitive.
2011-09-16 00:43:52 -04:00
Tom Lane 5f42e5945b Remove no-longer-used variable. 2011-09-11 16:18:06 -04:00
Peter Eisentraut 1b81c2fe6e Remove many -Wcast-qual warnings
This addresses only those cases that are easy to fix by adding or
moving a const qualifier or removing an unnecessary cast.  There are
many more complicated cases remaining.
2011-09-11 21:54:32 +03:00
Peter Eisentraut 52ce20589a Add missing format attributes
Add __attribute__ decorations for printf format checking to the places that
were missing them.  Fix the resulting warnings.  Add
-Wmissing-format-attribute to the standard set of warnings for GCC, so these
don't happen again.

The warning fixes here are relatively harmless.  The one serious problem
discovered by this was already committed earlier in
cf15fb5cab.
2011-09-10 23:12:46 +03:00
Tom Lane a7801b62f2 Move Timestamp/Interval typedefs and basic macros into datatype/timestamp.h.
As per my recent proposal, this refactors things so that these typedefs and
macros are available in a header that can be included in frontend-ish code.
I also changed various headers that were undesirably including
utils/timestamp.h to include datatype/timestamp.h instead.  Unsurprisingly,
this showed that half the system was getting utils/timestamp.h by way of
xlog.h.

No actual code changes here, just header refactoring.
2011-09-09 13:23:41 -04:00
Bruce Momjian 3ced32d24e In pg_upgrade, disallow migration of 8.3 clusters using contrib/ltree
because its internal format was changed in 8.4.

Backpatch to 9.0 and 9.1.

Report by depesz, diagnosis by Tom.
2011-09-07 14:43:12 -04:00
Tom Lane 1609797c25 Clean up the #include mess a little.
walsender.h should depend on xlog.h, not vice versa.  (Actually, the
inclusion was circular until a couple hours ago, which was even sillier;
but Bruce broke it in the expedient rather than logically correct
direction.)  Because of that poor decision, plus blind application of
pgrminclude, we had a situation where half the system was depending on
xlog.h to include such unrelated stuff as array.h and guc.h.  Clean up
the header inclusion, and manually revert a lot of what pgrminclude had
done so things build again.

This episode reinforces my feeling that pgrminclude should not be run
without adult supervision.  Inclusion changes in header files in particular
need to be reviewed with great care.  More generally, it'd be good if we
had a clearer notion of module layering to dictate which headers can sanely
include which others ... but that's a big task for another day.
2011-09-04 01:13:16 -04:00
Bruce Momjian 6416a82a62 Remove unnecessary #include references, per pgrminclude script. 2011-09-01 10:04:27 -04:00
Robert Haas 4232c4b406 Userspace access vector cache for contrib/sepgsql.
KaiGai Kohei
2011-09-01 08:38:40 -04:00
Robert Haas 3d14bd2563 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.
2011-09-01 08:28:26 -04:00
Bruce Momjian d532184252 Remove "fmgr.h" include in cube contrib --- caused crash on a Gentoo
builfarm member.
2011-09-01 07:22:40 -04:00
Tom Lane 731ebb64b7 Fix not-backwards-compatible pg_upgrade test for prepared transactions.
There's no reason for this test to use the undocumented pg_prepared_xact()
function, when it can use the stable API pg_prepared_xacts instead.
Fixes breakage against 8.3, as reported by Justin Arnold.
2011-08-30 17:15:00 -04:00
Bruce Momjian 4bd7333b14 Allow more include files to be compiled in their own by adding missing
include dependencies.

Modify pgcompinclude to skip a common fcinfo error.
2011-08-27 11:05:33 -04:00
Bruce Momjian f1312b5ed3 Add postgres.h to *.c files for pg_upgrade, ltree, and btree_gist, and
remove from local *.h files.

Per suggestion from Alvaro.
2011-08-26 21:16:24 -04:00
Bruce Momjian eb013ede59 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.
2011-08-26 00:12:32 -04:00
Tom Lane 2e95f1f002 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.
2011-08-25 13:55:57 -04:00
Tom Lane bd165757f4 Add a regression test for pgstattuple.
This is mainly to prove that the NaN fix actually works cross-platform.
2011-08-25 00:06:16 -04:00
Tom Lane af7d181298 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.
2011-08-24 23:50:10 -04:00
Tom Lane d1d388603e 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.
2011-08-24 15:16:50 -04:00
Tom Lane ba69b419a8 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.
2011-08-24 13:47:01 -04:00
Tom Lane cb5c2ba2d8 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.
2011-08-24 13:09:06 -04:00
Robert Haas a4b3feebc4 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.
2011-08-19 13:09:40 -04:00
Robert Haas 10c378f235 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.
2011-08-19 12:00:45 -04:00
Robert Haas a64bdf5f65 Allow sepgsql regression tests to be run from a user homedir.
KaiGai Kohei, with some changes by me.
2011-08-19 11:53:14 -04:00
Bruce Momjian 00a7c9014a 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.
2011-08-19 11:20:30 -04:00
Robert Haas ffaf9eca4c Typo fix. 2011-08-18 13:10:43 -04:00
Bruce Momjian 2411fbdac4 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.
2011-08-15 22:40:14 -04:00
Peter Eisentraut 85612039b9 Message style improvements 2011-08-14 21:03:08 +03:00
Robert Haas b69f2e3640 Teach vacuumlo to limit number of removals, via new -l option.
Also, handle failure better: don't just blindly keep trying to delete
stuff after the transaction has already failed.

Tim Lewis, reviewed by Josh Kupershmidt, with further hacking by me.
2011-08-08 09:16:45 -04:00
Robert Haas 68cbb9f4e7 Modestly improve pgbench's checking for invalid ranges.
The old check against MAX_RANDOM_VALUE is clearly irrelevant since
getrand() no longer calls random().  Instead, check whether min and max
are close enough together to avoid an overflow inside getrand(), as
suggested by Tom Lane.  This is still somewhat silly, because we're
using atoi(), which doesn't check for overflow anyway and (at least on
my system) will cheerfully return 0 when given "4294967296".  But that's
a problem for another commit.
2011-08-05 12:53:03 -04:00
Robert Haas 4af43ee3f1 Make pgbench use erand48() rather than random().
glibc renders random() thread-safe by wrapping a futex lock around it;
testing reveals that this limits the performance of pgbench on machines
with many CPU cores.  Rather than switching to random_r(), which is
only available on GNU systems and crashes unless you use undocumented
alchemy to initialize the random state properly, switch to our built-in
implementation of erand48(), which is both thread-safe and concurrent.

Since the list of reasons not to use the operating system's erand48()
is getting rather long, rename ours to pg_erand48() (and similarly
for our implementations of lrand48() and srand48()) and just always
use those.  We were already doing this on Cygwin anyway, and the
glibc implementation is not quite thread-safe, so pgbench wouldn't
be able to use that either.

Per discussion with Tom Lane.
2011-08-03 16:26:40 -04:00
Bruce Momjian a31dc392d6 Fix pg_update to properly test for the data directory's existence on
Win32.

Backpatch to 9.1.
2011-07-30 01:50:55 -04:00
Robert Haas 60fb25a3f5 Move new pgbench options to correct section of --help output. 2011-07-29 16:43:57 -04:00
Robert Haas 8cca49d8a0 Add some environment checks prior to sepgsql regression testing.
This probably needs more work, but it's a start.

KaiGai Kohei
2011-07-25 10:51:02 -04:00
Robert Haas 7c26395661 Add new pgbench options, --tablespace and --index-tablespace.
Per a request from Greg Smith.
2011-07-25 09:16:14 -04:00
Robert Haas 2d6fee09eb Add new pgbench switch, --unlogged-tables.
This entails adjusting pgbench to use getopt_long() rather
than getopt().
2011-07-25 06:55:12 -04:00
Bruce Momjian 081a5518c0 In pg_upgrade on Windows, check if the directory is writable by actually
creating and removing a file because access() doesn't work on that
platform.

Backpatch to 9.1 where this check was added.
2011-07-24 01:43:57 -04:00
Bruce Momjian 43aa40e155 In pg_upgrade, add C comment about why we don't try to do shared file
writes for logging.
2011-07-21 17:13:17 -04:00
Bruce Momjian 17a16eeb7c In pg_upgrade, fix the -l/log option to work on Windows.
Also, double-quote the log file name in all places, to allow (on all
platforms) log file names with spaces.

Back patch to 9.0 and 9.1.
2011-07-20 18:31:03 -04:00
Bruce Momjian 6b43fddee4 In pg_upgrade, use pg_strudup(), for consistency. 2011-07-20 16:37:17 -04:00
Tom Lane cacd42d62c Rewrite libxml error handling to be more robust.
libxml reports some errors (like invalid xmlns attributes) via the error
handler hook, but still returns a success indicator to the library caller.
This causes us to miss some errors that are important to report.  Since the
"generic" error handler hook doesn't know whether the message it's getting
is for an error, warning, or notice, stop using that and instead start
using the "structured" error handler hook, which gets enough information
to be useful.

While at it, arrange to save and restore the error handler hook setting in
each libxml-using function, rather than assuming we can set and forget the
hook.  This should improve the odds of working nicely with third-party
libraries that also use libxml.

In passing, volatile-ize some local variables that get modified within
PG_TRY blocks.  I noticed this while testing with an older gcc version
than I'd previously tried to compile xml.c with.

Florian Pflug and Tom Lane, with extensive review/testing by Noah Misch
2011-07-20 13:03:49 -04:00
Peter Eisentraut bf6be7af25 Put inline declaration before return type
gcc -Wextra complains that the other way around is obsolescent, and
this was the only place where it was written in this order.
2011-07-19 07:57:38 +03:00
Tom Lane 1af37ec96d Replace errdetail("%s", ...) with errdetail_internal("%s", ...).
There may be some other places where we should use errdetail_internal,
but they'll have to be evaluated case-by-case.  This commit just hits
a bunch of places where invoking gettext is obviously a waste of cycles.
2011-07-16 14:22:18 -04:00
Peter Eisentraut 912bc4f038 Make pg_upgrade output more consistent with project style
Add errno-based output to error messages where appropriate, reformat
blocks to about 72 characters per line, use spaces instead of tabs for
indentation, and other style adjustments.
2011-07-12 07:13:51 +03:00
Peter Eisentraut d7fb49314d Fix use of unportable %m format 2011-07-07 22:48:59 +03:00
Tom Lane 6e6cc5910b Make the file_fdw validator check that a filename option has been provided.
This was already a runtime failure condition, but it's better to check
at validation time if possible.  Lightly modified version of a patch
by Shigeru Hanada.
2011-07-05 18:46:03 -04:00
Peter Eisentraut 76dfcb942f Postgres -> PostgreSQL in error message 2011-07-05 22:41:14 +03:00
Alvaro Herrera b93f5a5673 Move Trigger and TriggerDesc structs out of rel.h into a new reltrigger.h
This lets us stop including rel.h into execnodes.h, which is a widely
used header.
2011-07-04 14:35:58 -04:00
Tom Lane acb9198b96 Make distprep and *clean build targets recurse into all subdirectories.
Certain subdirectories do not get built if corresponding options are not
selected at configure time.  However, "make distprep" should visit such
directories anyway, so that constructing derived files to be included in
the tarball happens without requiring all configure options to be given
in the tarball build script.  Likewise, it's better if cleanup actions
unconditionally visit all directories (for example, this ensures proper
cleanup if someone has done a manual make in such a subdirectory).

To handle this, set up a convention that subdirectories that are
conditionally included in SUBDIRS should be added to ALWAYS_SUBDIRS
instead when they are excluded.

Back-patch to 9.1, so that plpython's spiexceptions.h will get provided
in 9.1 tarballs.  There don't appear to be any instances where distprep
actions got missed in previous releases, and anyway this fix requires
gmake 3.80 so we don't want to apply it before 9.1.
2011-07-03 13:55:12 -04:00
Bruce Momjian a88f4496b7 Change pg_upgrade to use port 50432 by default to avoid unintended
client connections during the upgrade.  Also rename data/bin/port
environment variables to being with 'PG'.  Also no longer honor PGPORT.
2011-07-01 18:17:12 -04:00
Alvaro Herrera 6f3efa76b0 Remove rel.h from objectaddress.h; only relcache.h is necessary.
Add rel.h to some files that now need it.
2011-06-28 17:08:29 -04:00
Joe Conway 8af3596d6b Async dblink functions require a named connection, and therefore should
use DBLINK_GET_NAMED_CONN rather than DBLINK_GET_CONN.
Problem found by Peter Eisentraut and patch by Fujii Masao.
2011-06-25 15:58:07 -07:00
Bruce Momjian 0b44818ead In pg_upgrade, check that the binary and data directories are the same
major version.

Backpatch to 9.1.

Dan McGee
2011-06-22 20:48:34 -04:00
Bruce Momjian 3b3c2cf180 In pg_upgrade, fix odd function parameter wrapping. 2011-06-22 19:30:46 -04:00
Bruce Momjian effbe6ecb4 Rename pg_upgrade directory validation function, for clarity. 2011-06-22 17:50:40 -04:00
Bruce Momjian 559b114dd4 Adjust pg_upgrade check for pg_upgrade_support to happen after the
binary directory has been validated.

Backpatch to 9.1.

Dan McGee
2011-06-22 17:47:23 -04:00
Bruce Momjian b06ad7def8 Fix pg_upgrade status message capitalization mistake.
Backpatch to 9.1 and 9.0.

Dan McGee
2011-06-22 14:49:54 -04:00
Tom Lane ca59dfa6f7 Apply upstream fix for blowfish signed-character bug (CVE-2011-2483).
A password containing a character with the high bit set was misprocessed
on machines where char is signed (which is most).  This could cause the
preceding one to three characters to fail to affect the hashed result,
thus weakening the password.  The result was also unportable, and failed
to match some other blowfish implementations such as OpenBSD's.

Since the fix changes the output for such passwords, upstream chose
to provide a compatibility hack: password salts beginning with $2x$
(instead of the usual $2a$ for blowfish) are intentionally processed
"wrong" to give the same hash as before.  Stored password hashes can
thus be modified if necessary to still match, though it'd be better
to change any affected passwords.

In passing, sync a couple other upstream changes that marginally improve
performance and/or tighten error checking.

Back-patch to all supported branches.  Since this issue is already
public, no reason not to commit the fix ASAP.
2011-06-21 14:41:05 -04:00
Bruce Momjian e3df3572f6 In pg_upgrade, clean up code layout in validateDirectoryOption(). 2011-06-15 17:23:02 -04:00
Bruce Momjian 07d17a73ec In pg_upgrade, check there are no prepared transactions. 2011-06-14 14:53:35 -04:00
Bruce Momjian 6560407c7d Pgindent run before 9.1 beta2. 2011-06-09 14:32:50 -04:00
Tom Lane 3ebc061c18 Make citext's equality and hashing functions collation-insensitive.
This is an ugly hack to get around the fact that significant parts of the
core backend assume they don't need to worry about passing collation to
equality and hashing functions.  That's true for the core string datatypes,
but citext should ideally have equality behavior that depends on the
specified collation's LC_CTYPE.  However, there's no chance of fixing the
core before 9.2, so we'll have to live with this compromise arrangement for
now.  Per bug #6053 from Regina Obe.

The code changes in this commit should be reverted in full once the core
code is up to speed, but be careful about reverting the docs changes:
I fixed a number of obsolete statements while at it.
2011-06-08 15:25:02 -04:00
Peter Eisentraut ba4cacf075 Recode non-ASCII characters in source to UTF-8
For consistency, have all non-ASCII characters from contributors'
names in the source be in UTF-8.  But remove some other more
gratuitous uses of non-ASCII characters.
2011-05-31 23:11:46 +03:00
Peter Eisentraut 4d7d6386d7 Remove literal tabs from message strings 2011-05-28 01:01:42 +03:00
Bruce Momjian 11c08c3fd7 In pg_upgrade, do case-insensitive checks of locale, encoding, and ctype
because these are often inconsistently capitalized.
2011-05-24 15:59:34 -04:00
Heikki Linnakangas ea896da394 Replace strdup() with pstrdup(), to avoid leaking memory.
It's been like this since the seg module was introduced, so backpatch to
8.2 which is the oldest supported version.
2011-05-18 22:49:22 -04:00
Bruce Momjian 1f35944607 In pg_upgrade, clean up handling of invalid directory specification by
checking the stat() errno value more strictly.
2011-05-18 22:22:40 -04:00
Bruce Momjian 772a5f1e5b Improve pg_upgrade error reporting if the bin or data directories do not
exist or are not directories.
2011-05-18 18:37:25 -04:00
Peter Eisentraut 0ee391b77a /contrib/foo -> contrib/foo
Since contrib is a relative directory specification, a leading slash
is inappropriate.
2011-05-19 00:30:31 +03:00
Bruce Momjian 92ff915018 Improve pg_upgrade X_OK comment. 2011-05-18 12:25:34 -04:00
Bruce Momjian 6fbf4e0e7c Fix pg_upgrade build problem on Windows when using X_OK access
permission check on the current directory.
2011-05-18 12:13:37 -04:00
Bruce Momjian e728701fb4 Update pg_upgrade directory check error message. 2011-05-16 12:32:36 -04:00
Bruce Momjian bda27e502f Add pg_upgrade check to make sure the user has full access permission in
the current directory;  if not, throw an error.
2011-05-16 11:01:29 -04:00
Bruce Momjian 6c19bd96bc Allow pg_upgrade to honor libpq environment variables. Add 'local'
checks for PGHOST and PGHOSTADDR.
2011-05-16 10:48:40 -04:00
Alvaro Herrera c6eb5740b3 Fix assorted typos 2011-05-12 08:52:56 -04:00
Peter Eisentraut 94a8fde403 Put options help in alphabetical order 2011-05-10 21:48:07 +03:00
Peter Eisentraut 00fad9f6fe Format pg_upgrade --version in line with conventions 2011-05-10 21:40:29 +03:00
Peter Eisentraut 4c78846cb3 Add bug report line to pg_upgrade --help output 2011-05-10 21:37:55 +03:00
Peter Eisentraut 3a8dcd9a1f Put pg_test_fsync --help and --version output in line with conventions
Foremost, it should go to stdout.
2011-05-10 21:34:26 +03:00
Bruce Momjian 5059cf6ebf In pg_upgrade, remove suggestion of setting pg_hba.conf to 'trust', now
that we report the libpq connection failure string.  Per suggestion from
Robert Haas.
2011-05-10 10:42:43 -04:00
Bruce Momjian 78318d63d7 In pg_upgrade, add status message about superuser check. 2011-05-09 08:55:36 -04:00
Bruce Momjian e6a7402842 Add C comment why client encoding can be set in pg_upgrade. 2011-05-07 22:30:35 -04:00
Bruce Momjian 1609ca5adb In pg_upgrade, report non-super-user username in error message. 2011-05-07 12:17:21 -04:00
Bruce Momjian 81301b8578 Check that the pg_upgrade user specified is a super-user.
Also report the error message when the post-pg_ctl connection fails.

Per private bug report from EnterpriseDB.
2011-05-07 08:55:45 -04:00
Bruce Momjian 5c5f83507c Adjust pg_upgrade FATAL error messages to have consistent newlines.
Also adjust some error message capitalization for consistency.
2011-05-06 21:47:42 -04:00
Peter Eisentraut b24181b26f Improve pg_archivecleanup and pg_standby --help output
For consistency with other tools, put the options before further usage
information.

In pg_standby, remove the supposedly deprecated -l option from the
given example invocation.
2011-05-05 23:19:13 +03:00
Peter Eisentraut d6d823c8b0 Improve formatting of pg_upgrade --help output 2011-05-05 23:19:13 +03:00
Bruce Momjian 6c4d2bd914 Now that pg_upgrade uses -w in pg_ctl, remove loop that retried testing
the connection;  also restructure the libpq connection code.

This patch also removes the unused variable postmasterPID and fixes a
libpq structure leak that was in the testing loop.
2011-04-26 10:15:18 -04:00
Bruce Momjian 44091442db In pg_upgrade, avoid one start/stop of the postmaster; use the -w
(wait) flag for pg_ctl start/stop;  remove the unused "quiet" flag in
the functions for starting/stopping the postmaster.
2011-04-25 20:18:23 -04:00
Peter Eisentraut f8ebe3bcc5 Support "make check" in contrib
Added a new option --extra-install to pg_regress to arrange installing
the respective contrib directory into the temporary installation.
This is currently not yet supported for Windows MSVC builds.

Updated the .gitignore files for contrib modules to ignore the
leftovers of a temp-install check run.

Changed the exit status of "make check" in a pgxs build (which still
does nothing) to 0 from 1.

Added "make check" in contrib to top-level "make check-world".
2011-04-25 22:27:11 +03:00
Bruce Momjian 76dd09bbec Add postmaster/postgres undocumented -b option for binary upgrades.
This option turns off autovacuum, prevents non-super-user connections,
and enables oid setting hooks in the backend.  The code continues to use
the old autoavacuum disable settings for servers with earlier catalog
versions.

This includes a catalog version bump to identify servers that support
the -b option.
2011-04-25 12:00:21 -04:00
Bruce Momjian f6322b3191 In pg_upgrade, only compile copy_file() on non-Win32 systems.
Per report from Andrew Dunstan.
2011-04-23 20:28:29 -04:00
Tom Lane bb85030630 Fix contrib/btree_gist to handle collations properly.
Make use of the collation attached to the index column, instead of
hard-wiring DEFAULT_COLLATION_OID.  (Note: in theory this could require
reindexing btree_gist indexes on textual columns, but I rather doubt anyone
has one with a non-default declared collation as yet.)
2011-04-22 20:19:58 -04:00
Tom Lane 474ff212e5 De-kludge contrib/btree_gin for collations.
Using DEFAULT_COLLATION_OID in the comparePartial functions was not only
a lame hack, but outright wrong, because the compare functions for
collation-aware types were already responding to the declared index
collation.  So comparePartial would have the wrong expectation about
the index's sort order, possibly leading to missing matches for prefix
searches.
2011-04-22 18:22:38 -04:00
Bruce Momjian 0262251c33 Pg_upgrade C comment addition.
Document why we do the missing new database check during the check
phase.
2011-04-20 05:45:31 -04:00
Bruce Momjian 7228d02989 Throw error for mismatched pg_upgrade clusters
If someone removes the 'postgres' database from the old cluster and the
new cluster has a 'postgres' database, the number of databases will not
match.  We actually could upgrade such a setup, but it would violate the
1-to-1 mapping of database counts, so we throw an error instead.

Previously they got an error during the upgrade, and not at the check
stage; PG 9.0.4 does the same.
2011-04-19 21:00:29 -04:00
Bruce Momjian 0341944706 Add C comment
Add C comment about why we throw an error if the pg_upgrade old/new
database counts don't match.
2011-04-19 19:15:13 -04:00
Peter Eisentraut 385942f46c Refix the unaccent regression test on MSVC properly
... for some value of "properly".  Instead of overriding REGRESS_OPTS,
set the variables ENCODING and NO_LOCALE, which is more expressive and
allows overriding by the user.  Fix vcregress.pl to handle that.
2011-04-19 22:52:52 +03:00
Peter Eisentraut 001cbb145f Avoid unused variable warnings for certain configurations 2011-04-19 20:01:51 +03:00
Andrew Dunstan b7b86924c6 Attempt to remedy buildfarm breakage caused by commit f536d4194. 2011-04-18 09:27:30 -04:00
Peter Eisentraut f536d41942 Rename pg_regress option --multibyte to --encoding
Also refactor things a little bit so that the same methods for setting
test locale and encoding can be used everywhere.
2011-04-15 08:42:05 +03:00
Tom Lane d64713df7e Pass collations to functions in FunctionCallInfoData, not FmgrInfo.
Since collation is effectively an argument, not a property of the function,
FmgrInfo is really the wrong place for it; and this becomes critical in
cases where a cached FmgrInfo is used for varying purposes that might need
different collation settings.  Fix by passing it in FunctionCallInfoData
instead.  In particular this allows a clean fix for bug #5970 (record_cmp
not working).  This requires touching a bit more code than the original
method, but nobody ever thought that collations would not be an invasive
patch...
2011-04-12 19:19:24 -04:00
Peter Eisentraut 5caa3479c2 Clean up most -Wunused-but-set-variable warnings from gcc 4.6
This warning is new in gcc 4.6 and part of -Wall.  This patch cleans
up most of the noise, but there are some still warnings that are
trickier to remove.
2011-04-11 22:28:45 +03:00
Andrew Dunstan c1d82a936f Remove CRLF line endings in new cube results file. 2011-04-10 18:26:53 -04:00