Commit Graph

1805 Commits

Author SHA1 Message Date
Robert Haas 8a4dc94ca0 Make details of the Numeric representation private to numeric.c.
Review by Tom Lane.
2010-07-30 04:30:23 +00:00
Robert Haas 980341b3c2 Avoid using text_to_cstring() in levenshtein functions.
Operating directly on the underlying varlena saves palloc and memcpy
overhead, which testing shows to be significant.

Extracted from a larger patch by Alexander Korotkov.
2010-07-29 20:11:48 +00:00
Peter Eisentraut f0790a642c Remove wildly obsolete type attribute externallength from chkpass 2010-07-28 20:34:34 +00:00
Robert Haas 6d16902eda Add ssl_cipher() and ssl_version() functions to contrib/sslinfo.
Review by Dave Page.
2010-07-27 23:43:42 +00:00
Bruce Momjian 8af787ea24 Adjust check_for_isn_and_int8_passing_mismatch() so it is called for all
migrations.

Backpatch to 9.0.
2010-07-25 03:47:29 +00:00
Bruce Momjian f31b1fd7c1 Prevent pg_upgrade from migrating databases that use reg* data types
where the oid is not preserved by pg_upgrade (everything but pg_type).
Update documentation.

Per bug report from depstein@alliedtesting.com.
2010-07-25 03:28:32 +00:00
Robert Haas 0e22e08fe5 Make hstore regression tests independent of standard_conforming_strings.
Per buildfarm.
2010-07-20 01:22:52 +00:00
Bruce Momjian 4504a1bc01 On Win32, pg_upgrade cannot sent any server log output to the log file
because of file access limitations on that platform.
2010-07-13 20:03:32 +00:00
Bruce Momjian 477c01b00d Remove incorrect email address for pg_upgrade bug reports. 2010-07-13 18:14:14 +00:00
Bruce Momjian f87bd25f00 In pg_upgrade, report /bin directory checks independent of /data checks. 2010-07-13 18:09:55 +00:00
Bruce Momjian 804f96accb In pg_upgrade, prevent psql AUTOCOMMIT=off by not loading .psqlrc. 2010-07-13 15:56:53 +00:00
Bruce Momjian a0d7c5f689 Properly report errno/out-of-disk-space error from pg_upgrade when in
copy mode, per report from depstein@alliedtesting.com.

Patch suggestion from Magnus.

Backpatch to 9.0.X.
2010-07-09 16:51:23 +00:00
Bruce Momjian 239d769e7e pgindent run for 9.0, second run 2010-07-06 19:19:02 +00:00
Tom Lane f9e9da6664 Fix a few single-file (MODULES, not MODULE_big) contrib makefiles that were
supposing that they should set SHLIB_LINK rather than LDFLAGS_SL.  Since these
don't go through Makefile.shlib that was a no-op on most platforms.  Also
regularize the few platform-specific Makefiles that did pay attention to
SHLIB_LINK: it seems that the real value of that is to pull in BE_DLLLIBS,
so do that instead.  Per buildfarm failures on cygwin.
2010-07-05 23:15:56 +00:00
Bruce Momjian da254e3d16 Make pg_upgrade copyrights just 2010, not 2010-2010. 2010-07-03 16:33:15 +00:00
Bruce Momjian de255a6eb1 Add copyrights to pg_upgrade and pg_upgrade_tools files, per Tom. 2010-07-03 16:25:01 +00:00
Bruce Momjian ccbe0c14e6 Add CVS tags to pg_upgrade and pg_upgrade_support files, per request
from Tom.
2010-07-03 14:23:14 +00:00
Robert Haas ce51747673 Remove hstore % text[] operator; use slice() function instead.
David Wheeler, with one small correction by me.
2010-07-02 20:36:49 +00:00
Tom Lane 600fc1dc9d Get rid of some more stuff that duplicates c.h or port.h. 2010-07-01 15:52:52 +00:00
Bruce Momjian 14bd1c3d9e Remove port.h prototypes from pg_upgrade.h, per report from Robert Haas. 2010-07-01 14:37:53 +00:00
Bruce Momjian c1b617987d Add username designations to all pg_upgrade utility calls that support it. 2010-06-23 20:04:50 +00:00
Bruce Momjian 601d1eeddc Fix pg_upgrade's use of pg_ctl on Win32 to not send command and sever
output to the same file, because it is impossible.

Also set user name for pg_dumpall in pg_upgrade.
2010-06-22 16:45:10 +00:00
Robert Haas 8327060dc2 Updated expected-output file for hstore.
This is an oversight in my previous patch to deprecate => as an operator
name.  Per buildfarm.
2010-06-22 12:54:22 +00:00
Robert Haas 31c47e53aa Rename hstore => text[] operator to %
This is not yet in any released version, so we still have the option to
change the name.  We may want to reserve the token => in a future release.
2010-06-18 03:52:03 +00:00
Tom Lane 449c73f466 Clean up pg_archivecleanup's error and logging output: put newlines in
sane places, make messages follow project's message style guidelines.

Also, avoid closedir(NULL).

Fujii Masao and Tom Lane
2010-06-17 17:31:27 +00:00
Bruce Momjian 1aa117506d Fix pg_upgrade to remove malloc(0) call. 2010-06-16 19:43:11 +00:00
Bruce Momjian 24cb6ab9af Fix storage of getopt() return, should be 'int', for pg_upgrade.
Steve Singer
2010-06-15 23:25:01 +00:00
Tom Lane c0989c67fa Change the interpretation of the primary_key_attnums parameter of
dblink_build_sql_insert() and related functions.  Now the column numbers
are treated as logical not physical column numbers.  This will provide saner
behavior in the presence of dropped columns; furthermore, if we ever get
around to allowing rearrangement of logical column ordering, the original
definition would become nearly untenable from a usability standpoint.
Per recent discussion of dblink's handling of dropped columns.
Not back-patched for fear of breaking existing applications.
2010-06-15 20:29:01 +00:00
Robert Haas b17129b589 Remove hstore's text[] => text[] operator.
This is not yet in any released version, so we still have the option to
backtrack.  Instead, document hstore(text[], text[]).  Per discussion.
2010-06-15 19:48:30 +00:00
Tom Lane 3b3706d2cf Fix dblink_build_sql_insert() and related functions to handle dropped
columns correctly.  In passing, get rid of some dead logic in the
underlying get_sql_insert() etc functions --- there is no caller that
will pass null value-arrays to them.

Per bug report from Robert Voinea.
2010-06-15 19:04:15 +00:00
Tom Lane 48a7245391 Consolidate and improve checking of key-column-attnum arguments for
dblink_build_sql_insert() and related functions.  In particular, be sure to
reject references to dropped and out-of-range column numbers.  The numbers
are still interpreted as physical column numbers, though, for backward
compatibility.

This patch replaces Joe's patch of 2010-02-03, which handled only some aspects
of the problem.
2010-06-15 16:22:19 +00:00
Bruce Momjian 8141523e35 Properly define pg_upgrade global variable, per bug report from Chris
Ruprecht on Mac (64 bit).
2010-06-15 02:08:01 +00:00
Tom Lane 6bbaa3148d Rearrange dblink's dblink_build_sql_insert() and related routines to open and
lock the target relation just once per SQL function call.  The original coding
obtained and released lock several times per call.  Aside from saving a
not-insignificant number of cycles, this eliminates possible race conditions
if someone tries to modify the relation's schema concurrently.  Also
centralize locking and permission-checking logic.

Problem noted while investigating a trouble report from Robert Voinea --- his
problem is still to be fixed, though.
2010-06-14 20:49:33 +00:00
Simon Riggs ca65f2190a Files for pg_archivecleanup 2010-06-14 16:19:24 +00:00
Simon Riggs 25fee5cfbd New contrib module for use as an archive_cleanup_command, or as a
standalone utility for removing files from archive.
2010-06-14 16:17:56 +00:00
Bruce Momjian 785c2acc12 Update pg_upgrade C comment about cwd. 2010-06-12 17:45:28 +00:00
Bruce Momjian 1dc7c796c9 Have pg_upgrade create its output files in the current directory, rather
than in a subdirectory of the $HOME directory, or $TMP in Windows.
2010-06-12 17:05:29 +00:00
Itagaki Takahiro 5a41c317c5 Avoid "identifier will be truncated" warning in dblink
when connection string is longer than NAMEDATALEN.
The previous fix for long connection name broke the behavior.
2010-06-09 03:39:26 +00:00
Itagaki Takahiro a624356072 Fix connection leak in dblink when dblink_connect() or dblink_connect_u()
end with "duplicate connection name" errors.

Backported to release 7.4.
2010-06-09 00:56:02 +00:00
Teodor Sigaev 3e7451a6df Add missed function dblink_connect_u(text[,text]) to uninstall script 2010-06-07 15:14:36 +00:00
Itagaki Takahiro 7dff7260af Fix dblink to treat connection names longer than NAMEDATALEN-2 (62 bytes).
Now long names are adjusted with truncate_identifier() and NOTICE messages
are raised if names are actually truncated.

Backported to release 8.0.
2010-06-03 09:38:33 +00:00
Bruce Momjian 9b6dba1193 Remove IMPLEMENTATION.jp file from pg_upgrade docs; still in pgFoundry
for pg_migrator, per suggestion from Magnus.
2010-05-25 16:53:24 +00:00
Bruce Momjian 02265f06b7 Update pg_upgrade IMPLEMENTATION doc file to match current 9.0 behavior. 2010-05-25 16:09:29 +00:00
Bruce Momjian 238d21d7d2 Modify pg_standby, pgbench, and pg_upgrade manual pages to be consistent
in their display of command-line options with other client applications.
2010-05-25 15:55:28 +00:00
Bruce Momjian f4e9436026 Add Japanese Implementation file to CVS. 2010-05-25 02:56:36 +00:00
Bruce Momjian 7a74d70e71 Re-order pg_upgrade 'help' options to be alphabetical. 2010-05-25 02:55:58 +00:00
Bruce Momjian 6368682788 In pg_upgrade, test for datallowconn instead of hardcoding template0. 2010-05-24 19:52:33 +00:00
Bruce Momjian 00be75415c Split apart pg_upgrade user lookup and root check so '--help' shows
proper default username.
2010-05-24 16:34:35 +00:00
Tom Lane add8044778 issue_warnings() has no business freeing its parameter, especially not when
its sole caller does that too.  Jan Matousek, via Pavel Stehule
2010-05-23 16:54:13 +00:00
Bruce Momjian 3245bd5240 Simplify pg_upgrade queries by using IN instead of multiple OR clauses
comparing the same column to multiple values.
2010-05-19 18:56:47 +00:00
Bruce Momjian 573e446f6f For pg_upgrade, update template0's datfrozenxid and its relfrozenxids to
match the behavior of autovacuum, which does this as the xid advances
even if autovacuum is turned off.
2010-05-19 18:27:43 +00:00
Bruce Momjian 64719a18db Use a 'datallowconn' check for avoiding 'template0', rather than
hardcoding a 'template0' check, per suggestion from Alvaro.

This might fix a problem where someone has allowed 'template0'
connections, but it is a cleaner approach even if doesn't fix the
bug.
2010-05-18 18:40:51 +00:00
Bruce Momjian 37953b2d20 Add pg_upgrade TESTING files explaining a testing method. 2010-05-18 03:26:12 +00:00
Bruce Momjian 5c337fb45c Adjust pg_upgrade BSD defines for scandir(), per report from Giles Lean 2010-05-15 10:21:54 +00:00
Bruce Momjian 5781d96dc3 Change bsdi define to __bsdi__ 2010-05-15 10:08:28 +00:00
Heikki Linnakangas de4e18a34d Fix typos in comments, spotted by Josh Kupershmidt. 2010-05-15 09:31:57 +00:00
Tom Lane 88fba7089e Fix another obvious bug pointed out by a compiler warning. 2010-05-14 00:43:42 +00:00
Tom Lane 0546906064 Remove another unsafe use of random data as a format string. 2010-05-14 00:39:51 +00:00
Tom Lane 8eac39780d Get rid of unsafe sprintf and snprintf usages. Per compiler warnings. 2010-05-14 00:32:21 +00:00
Tom Lane adf6b8edfb Spell __darwin__ correctly, to suppress compiler warning on OSX. 2010-05-14 00:19:46 +00:00
Bruce Momjian e9ad14f9f4 Use NAMEDATALEN instead of local define.
Modify path separators for Win32.

Per ideas from Takahiro Itagaki
2010-05-14 00:13:38 +00:00
Bruce Momjian 36d3afd2d4 Remove all mentions of EnterpriseDB Advanced Server from pg_upgrade;
EDB must maintain their own patch set for this.
2010-05-13 22:51:00 +00:00
Tom Lane 382ff21203 Fix up lame idea of not using autoconf to determine if platform has scandir().
Should fix buildfarm failures.
2010-05-13 22:07:43 +00:00
Magnus Hagander 2b61b3e507 Assorted fixes to make pg_upgrade build on MSVC.
* There is no chmod() on Windows.
* Must always use the 3-parameter version of open()
* There is no dynloader.h - but it also appears unnecessary on all platforms
* Don't include shlobj.h because it causes compile errors, and from what I can
  see it's not actually used. This may need to be added back for mingw
  and/or cygwin in the worst case.
2010-05-13 15:58:15 +00:00
Tom Lane c2e7f78abe Fix wrong subdir. Per buildfarm. 2010-05-13 05:17:16 +00:00
Bruce Momjian 9885206cab Move pg_upgrade shared library out into its own /contrib directory
(pg_upgrade_support).
2010-05-13 01:03:01 +00:00
Tom Lane 44e55690fd Hook pg_upgrade into the contrib makefile structure so it gets built
on the buildfarm.
2010-05-12 16:50:58 +00:00
Tom Lane c9c25a982c Clean up unnecessary unportability and compiler warnings by removing the
cmp parameter for pg_scandir().  The code failed to support this anyway
for Sun/Windows, so pretending we could accept a parameter other than
NULL was just asking for trouble.
2010-05-12 16:50:00 +00:00
Bruce Momjian b460b5cd11 Move pg_upgrade TODO to TODO wiki. 2010-05-12 13:59:21 +00:00
Bruce Momjian 395d1259ad Add PGFILEDESC description to Makefiles for all /contrib executables.
Add PGAPPICON to all executable makefiles.
2010-05-12 11:33:10 +00:00
Bruce Momjian 561afa534d Small formatting adjustment. 2010-05-12 11:07:24 +00:00
Bruce Momjian a898199df5 Add pg_upgrade IMPLEMENTATION file to CVS. 2010-05-12 02:24:43 +00:00
Bruce Momjian 6c4a98d99c Add TODO file to CVS. 2010-05-12 02:23:56 +00:00
Bruce Momjian c2e9b2f288 Add pg_upgrade to /contrib; will be in 9.0 beta2.
Add documentation.

Supports migration from PG 8.3 and 8.4.
2010-05-12 02:19:11 +00:00
Tom Lane 77acab75df Modify ShmemInitStruct and ShmemInitHash to throw errors internally,
rather than returning NULL for some-but-not-all failures as they used to.
Remove now-redundant tests for NULL from call sites.

We had to do something about this because many call sites were failing to
check for NULL; and changing it like this seems a lot more useful and
mistake-proof than adding checks to the call sites without them.
2010-04-28 16:54:16 +00:00
Tom Lane a2de4826e9 Fix contrib/tsearch2 expected results to match recent changes in URL parsing. 2010-04-28 15:07:59 +00:00
Robert Haas 33980a0640 Fix various instances of "the the".
Two of these were pointed out by Erik Rijkers; the rest I found.
2010-04-23 23:21:44 +00:00
Andrew Dunstan ce36151ac7 Make dmetaphone.c safe for pgindent and fussy compilers. Still to do: make it properly encoding aware w.r.t. chars U+00C7 and U+00D1. 2010-04-05 02:46:20 +00:00
Tom Lane 33065ef8bc Ensure that contrib/pgstattuple functions respond to cancel interrupts
reasonably promptly, by adding CHECK_FOR_INTERRUPTS in the per-page loops.

Tatsuhito Kasahara
2010-04-02 16:16:51 +00:00
Magnus Hagander 4c10623306 Update a number of broken links in comments.
Josh Kupershmidt
2010-04-02 15:21:20 +00:00
Magnus Hagander 337b217572 Fix minor typos in comments.
Josh Kupershmidt
2010-04-02 15:19:22 +00:00
Tom Lane 5ceb13c8a1 Fix ginint4_queryextract() to actually do what it was intended to do for an
unsatisfiable query, such as indexcol && empty_array.  It should return -1
to tell GIN no scan is required; but silly typo disabled the logic for that,
resulting in unnecessary "GIN indexes do not support whole-index scans" error.
Per bug report from Jeff Trout.

Back-patch to 8.3 where the logic was introduced.
2010-03-25 15:50:10 +00:00
Itagaki Takahiro a887c486d5 Each worker thread will have its own log file in pgbench to avoid interleaved
writes. The first worker still uses "pgbench_log.<pid>" for the name, but
additional workers use "pgbench_log.<pid>.<serial-number>" instead.

Reported by Greg Smith.
2010-03-23 01:29:22 +00:00
Tom Lane 5e47403be3 Make contrib/xml2 use core xml.c's error handler, when available (that is,
in versions >= 8.3).  The core code is more robust and efficient than what
was there before, and this also reduces risks involved in swapping different
libxml error handler settings.

Before 8.3, there is still some risk of problems if add-on modules such as
Perl invoke libxml without setting their own error handler.  Given the lack
of reports I'm not sure there's a risk in practice, so I didn't take the
step of actually duplicating the core code into older contrib/xml2 branches.
Instead I just tweaked the existing code to ensure it didn't leave a dangling
pointer to short-lived memory when throwing an error.
2010-03-03 19:10:22 +00:00
Tom Lane d6a6f8c6be Fix contrib/xml2 so regression test still works when it's built without libxslt.
This involves modifying the module to have a stable ABI, that is, the
xslt_process() function still exists even without libxslt.  It throws a
runtime error if called, but doesn't prevent executing the CREATE FUNCTION
call.  This is a good thing anyway to simplify cross-version upgrades.
2010-03-01 18:07:59 +00:00
Tom Lane a102090995 Remove xmlCleanupParser calls from contrib/xml2.
These are unnecessary and probably dangerous.  I don't see any immediate
risk situations in the core XML support or contrib/xml2 itself, but there
could be issues with external uses of libxml2, and in any case it's an
accident waiting to happen.
2010-03-01 05:16:35 +00:00
Tom Lane 936c4af1c6 Fix up memory management problems in contrib/xml2.
Get rid of the code that attempted to funnel libxml2's memory allocations
into palloc.   We already knew from experience with the core xml datatype
that trying to do this is simply not reliable.  Unlike the core code, I
did not bother adding a lot of PG_TRY/PG_CATCH logic to try to ensure that
everything is cleaned up on error exit.  Hence, we might leak some memory
if one of these functions fails partway through.  Given the deprecated
status of this contrib module and the fact that errors partway through
the functions shouldn't be too common, it doesn't seem worth worrying about.

Also fix a separate bug in xpath_table, that it did the wrong things
if given a result tuple descriptor with less than 2 columns.  While
such a case isn't very useful in practice, we shouldn't fail or stomp
memory when it occurs.

Add some simple regression tests based on all the reported crash cases
that I have on hand.

This should be back-patched, but let's see if the buildfarm likes it first.
2010-02-28 21:31:57 +00:00
Tom Lane a12333eed2 Assorted code cleanup for contrib/xml2. No change in functionality,
just make it a bit less ugly in places.
2010-02-28 19:51:37 +00:00
Bruce Momjian 65e806cba1 pgindent run for 9.0 2010-02-26 02:01:40 +00:00
Tom Lane 29d2f86a31 Allow zero-dimensional (ie, empty) arrays in contrib/ltree operations.
The main motivation for changing this is bug #4921, in which it's pointed out
that it's no longer safe to apply ltree operations to the result of
ARRAY(SELECT ...) if the sub-select might return no rows.  Before 8.3,
the ARRAY() construct would return NULL, which might or might not be helpful
but at least it wouldn't result in an error.  Now it returns an empty array
which results in a failure for no good reason, since the ltree operations
are all perfectly capable of dealing with zero-element arrays.

As far as I can find, these ltree functions are the only places where zero
array dimensionality is rejected unnecessarily.

Back-patch to 8.3 to prevent behavioral regression of queries that worked
in older releases.
2010-02-24 18:02:24 +00:00
Itagaki Takahiro 912eb88c7d Remove useless codes to initialize TupleDesc from dblink_exec. 2010-02-24 05:20:49 +00:00
Bruce Momjian c4fc082a5a Modify freebsd start script to just exit 0 with message. 2010-02-23 22:17:25 +00:00
Bruce Momjian 1f0cf56be2 Update startup scripts for Linux and FreeBSD.
Kevin Grittner
2010-02-23 22:15:35 +00:00
Tom Lane 50a90fac40 Stamp HEAD as 9.0devel, and update various places that were referring to 8.5
(hope I got 'em all).  Per discussion, this release will be 9.0 not 8.5.
2010-02-17 04:19:41 +00:00
Andrew Dunstan fc5173ad51 Add query text to auto_explain output.
Still to be done: fix docs and fix regression failures under auto_explain.
2010-02-16 22:19:59 +00:00
Robert Haas e26c539e9f Wrap calls to SearchSysCache and related functions using macros.
The purpose of this change is to eliminate the need for every caller
of SearchSysCache, SearchSysCacheCopy, SearchSysCacheExists,
GetSysCacheOid, and SearchSysCacheList to know the maximum number
of allowable keys for a syscache entry (currently 4).  This will
make it far easier to increase the maximum number of keys in a
future release should we choose to do so, and it makes the code
shorter, too.

Design and review by Tom Lane.
2010-02-14 18:42:19 +00:00
Tom Lane d5768dce10 Create an official API function for C functions to use to check if they are
being called as aggregates, and to get the aggregate transition state memory
context if needed.  Use it instead of poking directly into AggState and
WindowAggState in places that shouldn't know so much.

We should have done this in 8.4, probably, but better late than never.

Revised version of a patch by Hitoshi Harada.
2010-02-08 20:39:52 +00:00
Tom Lane b9b8831ad6 Create a "relation mapping" infrastructure to support changing the relfilenodes
of shared or nailed system catalogs.  This has two key benefits:

* The new CLUSTER-based VACUUM FULL can be applied safely to all catalogs.

* We no longer have to use an unsafe reindex-in-place approach for reindexing
  shared catalogs.

CLUSTER on nailed catalogs now works too, although I left it disabled on
shared catalogs because the resulting pg_index.indisclustered update would
only be visible in one database.

Since reindexing shared system catalogs is now fully transactional and
crash-safe, the former special cases in REINDEX behavior have been removed;
shared catalogs are treated the same as non-shared.

This commit does not do anything about the recently-discussed problem of
deadlocks between VACUUM FULL/CLUSTER on a system catalog and other
concurrent queries; will address that in a separate patch.  As a stopgap,
parallel_schedule has been tweaked to run vacuum.sql by itself, to avoid
such failures during the regression tests.
2010-02-07 20:48:13 +00:00
Bruce Momjian 7027aba980 Remove /contrib/isn copyright mention for German Mendez Bravo, with
author's permission.
2010-02-05 04:34:51 +00:00
Bruce Momjian a141ec13de Rewrite intagg/Makefile from scratch, to avoid copyright mention. 2010-02-05 03:06:30 +00:00