summaryrefslogtreecommitdiff
path: root/contrib/pg_upgrade
Commit message (Collapse)AuthorAgeFilesLines
* Move pg_upgrade from contrib/ to src/bin/Peter Eisentraut2015-04-1422-6994/+0
| | | | Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
* Integrate pg_upgrade_support module into backendPeter Eisentraut2015-04-145-144/+1
| | | | | | | | | | | | | | | | Previously, these functions were created in a schema "binary_upgrade", which was deleted after pg_upgrade was finished. Because we don't want to keep that schema around permanently, move them to pg_catalog but rename them with a binary_upgrade_... prefix. The provided functions are only small wrappers around global variables that were added specifically for pg_upgrade use, so keeping the module separate does not create any modularity. The functions still check that they are only called in binary upgrade mode, so it is not possible to call these during normal operation. Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
* pg_upgrade: call 'postgres' binary to get data directory locationBruce Momjian2015-04-011-1/+1
| | | | | | | This matches the binary 'pg_ctl' calls. Previously we called the 'postmaster'. Report by Christoph Berg
* Run pg_upgrade and pg_resetxlog with restricted token on WindowsAndrew Dunstan2015-03-301-0/+3
| | | | | | | | | | | | | | 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.
* Tweak __attribute__-wrapping macros for better pgindent results.Tom Lane2015-03-262-26/+14
| | | | | | | | | | | | | | | | | | | | | This improves on commit bbfd7edae5aa5ad5553d3c7e102f2e450d4380d4 by making two simple changes: * pg_attribute_noreturn now takes parentheses, ie pg_attribute_noreturn(). Likewise pg_attribute_unused(), pg_attribute_packed(). This reduces pgindent's tendency to misformat declarations involving them. * attributes are now always attached to function declarations, not definitions. Previously some places were taking creative shortcuts, which were not merely candidates for bad misformatting by pgindent but often were outright wrong anyway. (It does little good to put a noreturn annotation where callers can't see it.) In any case, if we would like to believe that these macros can be used with non-gcc compilers, we should avoid gratuitous variance in usage patterns. I also went through and manually improved the formatting of a lot of declarations, and got rid of excessively repetitive (and now obsolete anyway) comments informing the reader what pg_attribute_printf is for.
* Add macros wrapping all usage of gcc's __attribute__.Andres Freund2015-03-112-8/+8
| | | | | | | | | | | | | | | | | | | | Until now __attribute__() was defined to be empty for all compilers but gcc. That's problematic because it prevents using it in other compilers; which is necessary e.g. for atomics portability. It's also just generally dubious to do so in a header as widely included as c.h. Instead add pg_attribute_format_arg, pg_attribute_printf, pg_attribute_noreturn macros which are implemented in the compilers that understand them. Also add pg_attribute_noreturn and pg_attribute_packed, but don't provide fallbacks, since they can affect functionality. This means that external code that, possibly unwittingly, relied on __attribute__ defined to be empty on !gcc compilers may now run into warnings or errors on those compilers. But there shouldn't be many occurances of that and it's hard to work around... Discussion: 54B58BA3.8040302@ohmu.fi Author: Oskari Saarenmaa, with some minor changes by me.
* pg_upgrade: improve checksum mismatch error messageBruce Momjian2015-02-111-4/+8
| | | | Patch by Greg Sabino Mullane, slight adjustments by me
* pg_upgrade: quote directory names in delete_old_cluster scriptBruce Momjian2015-02-111-3/+3
| | | | | | | This allows the delete script to properly function when special characters appear in directory paths, e.g. spaces. Backpatch through 9.0
* pg_upgrade: fix one-byte per empty db memory leakBruce Momjian2015-01-091-4/+2
| | | | Report by Tatsuo Ishii, Coverity
* Update copyright for 2015Bruce Momjian2015-01-0618-18/+18
| | | | Backpatch certain files through 9.0
* Lock down regression testing temporary clusters on Windows.Noah Misch2014-12-171-4/+11
| | | | | | | | | | | | Use SSPI authentication to allow connections exclusively from the OS user that launched the test suite. This closes on Windows the vulnerability that commit be76a6d39e2832d4b88c0e1cc381aa44a7f86881 closed on other platforms. Users of "make installcheck" or custom test harnesses can run "pg_regress --config-auth=DATADIR" to activate the same authentication configuration that "make check" would use. Back-patch to 9.0 (all supported versions). Security: CVE-2014-0067
* Update .gitignore for pg_upgradeMagnus Hagander2014-12-171-2/+4
| | | | | | | Add Windows versions of generated scripts, and make sure we only ignore the scripts int he root directory. Michael Paquier
* Keep track of transaction commit timestampsAlvaro Herrera2014-12-031-0/+7
| | | | | | | | | | | | | | | | | | | | | Transactions can now set their commit timestamp directly as they commit, or an external transaction commit timestamp can be fed from an outside system using the new function TransactionTreeSetCommitTsData(). This data is crash-safe, and truncated at Xid freeze point, same as pg_clog. This module is disabled by default because it causes a performance hit, but can be enabled in postgresql.conf requiring only a server restart. A new test in src/test/modules is included. Catalog version bumped due to the new subdirectory within PGDATA and a couple of new SQL functions. Authors: Álvaro Herrera and Petr Jelínek Reviewed to varying degrees by Michael Paquier, Andres Freund, Robert Haas, Amit Kapila, Fujii Masao, Jaime Casanova, Simon Riggs, Steven Singer, Peter Eisentraut
* pg_upgrade: prefix Unix shell script name output with "./"Bruce Momjian2014-10-112-2/+6
| | | | | | | This more clearly suggests the current directory. While this also works on Windows, it might be confusing. Report by Christoph Berg
* Remove unnecessary initialization of local variables.Heikki Linnakangas2014-10-101-2/+2
| | | | Oops, forgot these in the prveious commit.
* Change the way encoding and locale checks are done in pg_upgrade.Heikki Linnakangas2014-10-104-173/+87
| | | | | | | | | | | | | | | | | | | | | | | | Lc_collate and lc_ctype have been per-database settings since server version 8.4, but pg_upgrade was still treating them as cluster-wide options. It fetched the values for the template0 databases in old and new cluster, and compared them. That's backwards; the encoding and locale of the template0 database doesn't matter, as template0 is guaranteed to contain only ASCII characters. But if there are any other databases that exist on both clusters (in particular template1 and postgres databases), their encodings and locales must be compatible. Also, make the locale comparison more lenient. If the locale names are not equal, try to canonicalize both of them by passing them to setlocale(). We used to do that only when upgrading from 9.1 or below, but it seems like a good idea even with newer versions. If we change the canonical form of a locale, this allows pg_upgrade to still work. I'm about to do just that to fix bug #11431, by mapping a locale name that contains non-ASCII characters to a pure-ASCII alias of the same locale. No backpatching, because earlier versions of pg_upgrade still support upgrading from 8.3 servers. That would be more complicated, so it doesn't seem worth it, given that we haven't received any complaints about this from users.
* pg_upgrade: have pg_upgrade fail for old 9.4 JSONB formatBruce Momjian2014-09-292-0/+99
| | | | Backpatch through 9.4
* pg_upgrade: adjust C commentsBruce Momjian2014-09-111-25/+25
|
* pg_upgrade: compare control version, not catalog versionBruce Momjian2014-09-101-3/+5
| | | | | | | Also modify test for the possibility the large object value might not exist in the old cluster. Fix for commit e1598a15f4fb0f076a6034d3d3debb9776aff07a
* pg_upgrade: check for large object size compatibilityBruce Momjian2014-09-102-0/+28
|
* pg_upgrade: preserve the timestamp epochBruce Momjian2014-09-053-8/+17
| | | | | | This is useful for replication tools like Slony and Skytools. Report by Sergey Konoplev
* Fix whitespacePeter Eisentraut2014-08-261-3/+3
|
* pg_upgrade: use CTE query rather than temp tableBruce Momjian2014-08-251-63/+67
| | | | | Now that 8.3 is not supported, we can use a CTE and not temp tables. This allows for auto-oid assignment protection in a future patch.
* revert "Throw error for ALTER TABLE RESET of an invalid option"Bruce Momjian2014-08-251-10/+1
| | | | | | Reverts commits 73d78e11a0f7183c80b93eefbbb6026fe9664015 and b0488e5c4fbfdce8acc989bdc17d9f0ec09ac281. Also reverts pg_upgrade changes.
* pg_upgrade: remove support for 8.3 old clustersBruce Momjian2014-08-257-878/+11
| | | | | This trims down the code, and is in preparation for hardening pg_upgrade against auto-oid assignment.
* pg_upgrade: add SET log_min_error_statement = warningBruce Momjian2014-08-251-0/+2
| | | | Add to commit 73d78e11a0f7183c80b93eefbbb6026fe9664015
* Throw error for ALTER TABLE RESET of an invalid optionBruce Momjian2014-08-251-1/+8
| | | | | | | Also adjust pg_upgrade to not use this method for optional TOAST table creation. Patch by Fabrízio de Royes Mello
* pg_ctl, pg_upgrade: allow multiple -o/-O options, append themBruce Momjian2014-08-251-3/+21
| | | | Report by Pavel Raiskup
* pg_upgrade: adjust logging to use QUERY_ALLOC lengthsBruce Momjian2014-08-202-6/+6
| | | | | Allows the logging to print the entire text of failed queries, rather than a truncated version.
* Fix whitespacePeter Eisentraut2014-08-151-1/+1
|
* pg_upgrade: fix define adjusted during testingBruce Momjian2014-08-151-1/+1
| | | | from commit e4c3c99ac3d4777458ef3e94b037438b244b72b6
* pg_upgrade: error if run from top of new PGDATA on WindowsBruce Momjian2014-08-151-0/+20
| | | | | Print a clear error message in this case, rather than wait for initdb --sync-only to generate a "Permission denied" error.
* pg_upgrade: prevent oid conflicts with new-cluster TOAST tablesBruce Momjian2014-08-073-0/+73
| | | | | | | | Previously, TOAST tables only required in the new cluster could cause oid conflicts if they were auto-numbered and a later conflicting oid had to be assigned. Backpatch through 9.3
* pg_upgrade: assume user is install userBruce Momjian2014-08-042-29/+24
| | | | | | The user specified to the upgrade was effectively the install user, but that was not clearly stated in the comments, documentation, or error messages.
* pg_upgrade: remove reference to autovacuum_multixact_freeze_max_ageBruce Momjian2014-08-041-9/+8
| | | | | | | | | | | | | | | autovacuum_multixact_freeze_max_age was added as a pg_ctl start parameter in 9.3.X to prevent autovacuum from running. However, only some 9.3.X releases have autovacuum_multixact_freeze_max_age as it was added in a minor PG 9.3 release. It also isn't needed because -b turns off autovacuum in 9.1+. Without this fix, trying to upgrade from an early 9.3 release to 9.4 would fail. Report by EDB Backpatch through 9.3
* pg_upgrade: improve C comment wordingBruce Momjian2014-07-291-1/+1
|
* pg_upgrade: Fix spacing in help outputPeter Eisentraut2014-07-151-1/+1
|
* pg_upgrade: allow upgrades for new-only TOAST tablesBruce Momjian2014-07-071-13/+51
| | | | | | | | | | Previously, when calculations on the need for toast tables changed, pg_upgrade could not handle cases where the new cluster needed a TOAST table and the old cluster did not. (It already handled the opposite case.) This fixes the "OID mismatch" error typically generated in this case. Backpatch through 9.2
* Consistently pass an "unsigned char" to ctype.h functions.Noah Misch2014-07-061-1/+1
| | | | | | The isxdigit() calls relied on undefined behavior. The isascii() call was well-defined, but our prevailing style is to include the cast. Back-patch to 9.4, where the isxdigit() calls were introduced.
* pg_upgrade: preserve database and relation minmxid valuesBruce Momjian2014-07-022-26/+55
| | | | | | | | | Also set these values for pre-9.3 old clusters that don't have values to preserve. Analysis by Alvaro Backpatch through 9.3
* pg_upgrade: no need to remove "members" files for pre-9.3 upgradesBruce Momjian2014-07-021-3/+3
| | | | | | Per analysis by Alvaro Backpatch through 9.3
* Allow CREATE/ALTER DATABASE to manipulate datistemplate and datallowconn.Tom Lane2014-07-011-6/+4
| | | | | | | | | | | Historically these database properties could be manipulated only by manually updating pg_database, which is error-prone and only possible for superusers. But there seems no good reason not to allow database owners to set them for their databases, so invent CREATE/ALTER DATABASE options to do that. Adjust a couple of places that were doing it the hard way to use the commands instead. Vik Fearing, reviewed by Pavel Stehule
* pg_upgrade: update C comments about pg_dumpallBruce Momjian2014-06-306-8/+9
| | | | | | | | There were some C comments that hadn't been updated from the switch of using only pg_dumpall to using pg_dump and pg_dumpall, so update them. Also, don't bother using --schema-only for pg_dumpall --globals-only. Backpatch through 9.4
* pg_upgrade: remove pg_multixact files left by initdbBruce Momjian2014-06-241-6/+27
| | | | | | | | This fixes a bug that caused vacuum to fail when the '0000' files left by initdb were accessed as part of vacuum's cleanup of old pg_multixact files. Backpatch through 9.3
* Fix contrib/pg_upgrade/test.sh for $PWD containing spaces.Noah Misch2014-06-191-5/+5
| | | | Most of the necessary quoting was in place; this catches the exceptions.
* Secure Unix-domain sockets of "make check" temporary clusters.Noah Misch2014-06-141-5/+32
| | | | | | | | | | | | | | | | | Any OS user able to access the socket can connect as the bootstrap superuser and proceed to execute arbitrary code as the OS user running the test. Protect against that by placing the socket in a temporary, mode-0700 subdirectory of /tmp. The pg_regress-based test suites and the pg_upgrade test suite were vulnerable; the $(prove_check)-based test suites were already secure. Back-patch to 8.4 (all supported versions). The hazard remains wherever the temporary cluster accepts TCP connections, notably on Windows. As a convenient side effect, this lets testing proceed smoothly in builds that override DEFAULT_PGSOCKET_DIR. Popular non-default values like /var/run/postgresql are often unwritable to the build user. Security: CVE-2014-0067
* Fix whitespacePeter Eisentraut2014-05-151-1/+1
|
* pg_update: slight major version adjustmentBruce Momjian2014-05-141-1/+1
|
* Fix version check for pg_upgrade line type crosscheck.Tom Lane2014-05-141-1/+1
| | | | Per buildfarm.
* pg_upgrade: error out on 'line' data type usageBruce Momjian2014-05-143-2/+95
| | | | | The data type internal format changed in 9.4. Also mention this in the 9.4 release notes.