Commit Graph

104 Commits

Author SHA1 Message Date
Peter Eisentraut
bebf0c1bec Fix typos 2015-05-17 22:23:35 -04:00
Bruce Momjian
df161c94e7 pg_upgrade: force timeline 1 in the new cluster
Previously, this prevented promoted standby servers from being upgraded
because of a missing WAL history file.  (Timeline 1 doesn't need a
history file, and we don't copy WAL files anyway.)

Report by Christian Echerer(?), Alexey Klyukin

Backpatch through 9.0
2015-05-16 00:40:18 -04:00
Bruce Momjian
2194aa92b7 pg_upgrade: only allow template0 to be non-connectable
This patch causes pg_upgrade to error out during its check phase if:

(1) template0 is marked connectable
or
(2) any other database is marked non-connectable

This is done because, in the first case, pg_upgrade would fail because
the pg_dumpall --globals restore would fail, and in the second case, the
database would not be restored, leading to data loss.

Report by Matt Landry (1), Stephen Frost (2)

Backpatch through 9.0
2015-05-16 00:10:03 -04:00
Tom Lane
248c096b26 Fix assorted inconsistent function declarations.
While gcc doesn't complain if you declare a function "static" and then
define it not-static, other compilers do; and in any case the code is
highly misleading this way.  Add the missing "static" keywords to a
couple of recent patches.  Per buildfarm member pademelon.
2015-04-07 16:56:21 -04:00
Andrew Dunstan
bf22a8e585 Run pg_upgrade and pg_resetxlog with restricted token on Windows
As with initdb these programs need to run with a restricted token, and
if they don't pg_upgrade will fail when run as a user with Adminstrator
privileges.

Backpatch to all live branches. On the development branch the code is
reorganized so that the restricted token code is now in a single
location. On the stable bramches a less invasive change is made by
simply copying the relevant code to pg_upgrade.c and pg_resetxlog.c.

Patches and bug report from Muhammad Asif Naeem, reviewed by Michael
Paquier, slightly edited by me.
2015-03-30 17:18:10 -04:00
Bruce Momjian
4ae178f607 pg_upgrade: quote directory names in delete_old_cluster script
This allows the delete script to properly function when special
characters appear in directory paths, e.g. spaces.

Backpatch through 9.0
2015-02-11 22:06:04 -05:00
Bruce Momjian
1d033d3054 Remove tabs after spaces in C comments
This was not changed in HEAD, but will be done later as part of a
pgindent run.  Future pgindent runs will also do this.

Report by Tom Lane

Backpatch through all supported branches, but not HEAD
2014-05-06 11:26:25 -04:00
Bruce Momjian
4859a710ea Properly check for readdir/closedir() failures
Clear errno before calling readdir() and handle old MinGW errno bug
while adding full test coverage for readdir/closedir failures.

Backpatch through 8.4.
2014-03-21 13:45:11 -04:00
Bruce Momjian
fb7890aedb pg_upgrade: don't copy/link files for invalid indexes
Now that pg_dump no longer dumps invalid indexes, per commit
683abc73df, have pg_upgrade also skip
them.  Previously pg_upgrade threw an error if invalid indexes existed.

Backpatch to 9.2, 9.1, and 9.0 (where pg_upgrade was added to git)
2013-03-30 22:20:53 -04:00
Andrew Dunstan
ecfbbfc0ef Unbreak 9.0 and 9.1 pg_upgrade.
These were broken by my recent backpatch of
the simple prompt fix. These older versions
used DEVTTY, so import the definition from
psql's command.c.
2013-01-25 11:39:17 -05:00
Bruce Momjian
33be41d3ad Fix pg_upgrade for invalid indexes
All versions of pg_upgrade upgraded invalid indexes caused by CREATE
INDEX CONCURRENTLY failures and marked them as valid.  The patch adds a
check to all pg_upgrade versions and throws an error during upgrade or
--check.

Backpatch to 9.2, 9.1, 9.0.  Patch slightly adjusted.
2012-12-11 15:09:22 -05:00
Andrew Dunstan
f7b13e4837 Fix line end mishandling in pg_upgrade on Windows.
pg_upgrade opened the output from pg_dumpall in text mode and
wrote the split files in text mode. This caused unwanted eating
of intended carriage returns on input and production of spurious
carriage returns on output. To avoid this, open all these files
in binary mode. On non-Windows platforms, this change has no
effect.

Backpatch to 9.0. On 9.0 and 9.1, we also switch from redirecting
pg_dumpall's output to using pg_dumpall's -f switch, for the same
reason.
2012-09-05 17:49:30 -04:00
Andrew Dunstan
e62ad18663 Unbreak Windows builds on 9.0 broken by 4397c51816. 2012-09-03 22:51:13 -04:00
Andrew Dunstan
4397c51816 Use correct path separator for Windows builtin commands.
pg_upgrade produces a platform-specific script to remove the old
directory, but on Windows it has not been making sure that the
paths it writes as arguments for rmdir and del use the backslash
path separator, which will cause these scripts to fail.

The fix is backpatched to Release 9.0.
2012-09-03 18:14:06 -04:00
Bruce Momjian
916eec2dcf Fix pg_upgrade to properly upgrade a table that is stored in the cluster
default tablespace, but part of a database that is in a user-defined
tablespace.  Caused "file not found" error during upgrade.

Per bug report from Ants Aasma.

Backpatch to 9.1 and 9.0.
2012-04-10 19:57:13 -04:00
Bruce Momjian
ec218056fe 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:01 -05:00
Bruce Momjian
c3106a340f 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:42:36 -04:00
Bruce Momjian
df957a79cc 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:39 -04:00
Bruce Momjian
f239ec5727 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:39:38 -04:00
Bruce Momjian
431b7b84fe 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:08 -04:00
Peter Eisentraut
f1d869276f Fix use of unportable %m format 2011-07-07 21:48:15 +03:00
Bruce Momjian
7412f5cd29 Fix pg_upgrade status message capitalization mistake.
Backpatch to 9.1 and 9.0.

Dan McGee
2011-06-22 14:49:09 -04:00
Bruce Momjian
052e621cc2 Fix pg_upgrade crash
Fix pg_upgrade crash in 9.0 caused by a new cluster database that
doesn't exist in the old cluster;  instead throw an error.  This was
reported to me by EnterpriseDB testing staff.  This bug does not exist
in git head.
2011-04-13 11:33:55 -04:00
Bruce Momjian
9a22ea242b In pg_upgrade, copy pg_largeobject_metadata and its index for 9.0+
servers because, like pg_largeobject, it is a system table whose
contents are not dumped by pg_dump --schema-only.
2011-01-04 23:35:52 -05:00
Bruce Momjian
845626f506 In pg_upgrade, fix backward logging display of link operations. 2011-01-04 21:33:37 -05:00
Tom Lane
ee718c2310 Improve pg_upgrade's checks for required executables.
Don't insist on pg_dumpall and psql being present in the old cluster,
since they are not needed.  Do insist on pg_resetxlog being present
(in both old and new), since we need it.  Also check for pg_config,
but only in the new cluster.  Remove the useless attempt to call
pg_config in the old cluster; we don't need to know the old value of
--pkglibdir.  (In the case of a stripped-down migration installation
there might be nothing there to look at anyway, so any future change
that might reintroduce that need would have to be considered carefully.)

Per my attempts to build a minimal previous-version installation to support
pg_upgrade.
2010-12-29 13:43:58 -05:00
Tom Lane
368e44f6a5 Fix buffer overrun in pg_upgrade.
Problem reported, and cause identified, by Hernan Gonzalez.
2010-11-02 17:31:54 -04:00
Bruce Momjian
80a65c0577 Add removal of PG_VERSION to optional old cluster deletion script.
Backpatch to 9.0.X.
2010-10-19 15:52:44 +00:00
Bruce Momjian
fc8470ed4d In pg_upgrade, rename macro EXEC_EXT to SHELL_EXT for clarity.
Backpatch to 9.0.X.
2010-10-19 02:55:58 +00:00
Bruce Momjian
3689583d5a Have pg_upgrade use strtoul(), not strtol(). 2010-09-29 02:40:26 +00:00
Bruce Momjian
b757f18f2f Use macro atooid() for conversion of strings to oids, per suggestion
from Tom.
2010-09-28 22:11:21 +00:00
Bruce Momjian
ddfa48776c In pg_upgrade, properly handle oids > 2^31 by using strtoul() internally
rather than atol().

Per report from Brian Hirt
2010-09-28 21:41:03 +00:00
Bruce Momjian
0364ab8b26 Fix leak patch that was using fclose() instead of close(). 2010-09-28 21:37:14 +00:00
Bruce Momjian
c767c3bd36 Properly close files after read file failure to prevent potential
resource leak.  Of course, any such failure aborts pg_upgrade, but might
as well be clean about it.

Per patch from Grzegorz Ja?kiewicz.
2010-09-28 19:25:13 +00:00
Magnus Hagander
a692359411 Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:06 +02:00
Bruce Momjian
d3581d3161 Modify pg_upgrade to set/restore all environment variables related to
collation/encoding to match English when reading controldata.  This now
matches the English variable setting used by pg_regress.c.

Backpatch to 9.0.X.
2010-09-07 14:10:39 +00:00
Bruce Momjian
8dad931f4e Adjust check_for_isn_and_int8_passing_mismatch() so it is called for all
migrations.

Backpatch to 9.0.
2010-07-25 03:47:33 +00:00
Bruce Momjian
ca2901c144 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:39 +00:00
Bruce Momjian
f53bc2e78d Backpatch pg_upgrade fixes to 9.0:
In pg_upgrade, prevent psql AUTOCOMMIT=off by not loading .psqlrc.

 In pg_upgrade, report /bin directory checks independent of /data checks.

 Remove incorrect email address for pg_upgrade bug reports.

 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:15:51 +00:00
Bruce Momjian
beed55dff7 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:29 +00:00
Bruce Momjian
239d769e7e pgindent run for 9.0, second run 2010-07-06 19:19:02 +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
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
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