Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-04-14Move pg_upgrade from contrib/ to src/bin/Peter Eisentraut
Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
2015-04-14Integrate pg_upgrade_support module into backendPeter Eisentraut
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>
2015-04-01pg_upgrade: call 'postgres' binary to get data directory locationBruce Momjian
This matches the binary 'pg_ctl' calls. Previously we called the 'postmaster'. Report by Christoph Berg
2015-03-30Run pg_upgrade and pg_resetxlog with restricted token on WindowsAndrew Dunstan
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-26Tweak __attribute__-wrapping macros for better pgindent results.Tom Lane
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.
2015-03-11Add macros wrapping all usage of gcc's __attribute__.Andres Freund
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.
2015-02-12pg_upgrade: improve checksum mismatch error messageBruce Momjian
Patch by Greg Sabino Mullane, slight adjustments by me
2015-02-12pg_upgrade: quote directory names in delete_old_cluster scriptBruce Momjian
This allows the delete script to properly function when special characters appear in directory paths, e.g. spaces. Backpatch through 9.0
2015-01-09pg_upgrade: fix one-byte per empty db memory leakBruce Momjian
Report by Tatsuo Ishii, Coverity
2015-01-06Update copyright for 2015Bruce Momjian
Backpatch certain files through 9.0
2014-12-18Lock down regression testing temporary clusters on Windows.Noah Misch
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
2014-12-17Update .gitignore for pg_upgradeMagnus Hagander
Add Windows versions of generated scripts, and make sure we only ignore the scripts int he root directory. Michael Paquier
2014-12-03Keep track of transaction commit timestampsAlvaro Herrera
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
2014-10-11pg_upgrade: prefix Unix shell script name output with "./"Bruce Momjian
This more clearly suggests the current directory. While this also works on Windows, it might be confusing. Report by Christoph Berg
2014-10-10Remove unnecessary initialization of local variables.Heikki Linnakangas
Oops, forgot these in the prveious commit.
2014-10-10Change the way encoding and locale checks are done in pg_upgrade.Heikki Linnakangas
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.
2014-09-30pg_upgrade: have pg_upgrade fail for old 9.4 JSONB formatBruce Momjian
Backpatch through 9.4
2014-09-11pg_upgrade: adjust C commentsBruce Momjian
2014-09-11pg_upgrade: compare control version, not catalog versionBruce Momjian
Also modify test for the possibility the large object value might not exist in the old cluster. Fix for commit e1598a15f4fb0f076a6034d3d3debb9776aff07a
2014-09-10pg_upgrade: check for large object size compatibilityBruce Momjian
2014-09-05pg_upgrade: preserve the timestamp epochBruce Momjian
This is useful for replication tools like Slony and Skytools. Report by Sergey Konoplev
2014-08-26Fix whitespacePeter Eisentraut
2014-08-26pg_upgrade: use CTE query rather than temp tableBruce Momjian
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.
2014-08-26revert "Throw error for ALTER TABLE RESET of an invalid option"Bruce Momjian
Reverts commits 73d78e11a0f7183c80b93eefbbb6026fe9664015 and b0488e5c4fbfdce8acc989bdc17d9f0ec09ac281. Also reverts pg_upgrade changes.
2014-08-26pg_upgrade: remove support for 8.3 old clustersBruce Momjian
This trims down the code, and is in preparation for hardening pg_upgrade against auto-oid assignment.
2014-08-25pg_upgrade: add SET log_min_error_statement = warningBruce Momjian
Add to commit 73d78e11a0f7183c80b93eefbbb6026fe9664015
2014-08-25Throw error for ALTER TABLE RESET of an invalid optionBruce Momjian
Also adjust pg_upgrade to not use this method for optional TOAST table creation. Patch by Fabrízio de Royes Mello
2014-08-25pg_ctl, pg_upgrade: allow multiple -o/-O options, append themBruce Momjian
Report by Pavel Raiskup
2014-08-20pg_upgrade: adjust logging to use QUERY_ALLOC lengthsBruce Momjian
Allows the logging to print the entire text of failed queries, rather than a truncated version.
2014-08-15Fix whitespacePeter Eisentraut
2014-08-15pg_upgrade: fix define adjusted during testingBruce Momjian
from commit e4c3c99ac3d4777458ef3e94b037438b244b72b6
2014-08-15pg_upgrade: error if run from top of new PGDATA on WindowsBruce Momjian
Print a clear error message in this case, rather than wait for initdb --sync-only to generate a "Permission denied" error.
2014-08-07pg_upgrade: prevent oid conflicts with new-cluster TOAST tablesBruce Momjian
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
2014-08-04pg_upgrade: assume user is install userBruce Momjian
The user specified to the upgrade was effectively the install user, but that was not clearly stated in the comments, documentation, or error messages.
2014-08-04pg_upgrade: remove reference to autovacuum_multixact_freeze_max_ageBruce Momjian
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
2014-07-30pg_upgrade: improve C comment wordingBruce Momjian
2014-07-15pg_upgrade: Fix spacing in help outputPeter Eisentraut
2014-07-07pg_upgrade: allow upgrades for new-only TOAST tablesBruce Momjian
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
2014-07-06Consistently pass an "unsigned char" to ctype.h functions.Noah Misch
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.
2014-07-02pg_upgrade: preserve database and relation minmxid valuesBruce Momjian
Also set these values for pre-9.3 old clusters that don't have values to preserve. Analysis by Alvaro Backpatch through 9.3
2014-07-02pg_upgrade: no need to remove "members" files for pre-9.3 upgradesBruce Momjian
Per analysis by Alvaro Backpatch through 9.3
2014-07-02Allow CREATE/ALTER DATABASE to manipulate datistemplate and datallowconn.Tom Lane
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
2014-06-30pg_upgrade: update C comments about pg_dumpallBruce Momjian
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
2014-06-24pg_upgrade: remove pg_multixact files left by initdbBruce Momjian
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
2014-06-20Fix contrib/pg_upgrade/test.sh for $PWD containing spaces.Noah Misch
Most of the necessary quoting was in place; this catches the exceptions.
2014-06-14Secure Unix-domain sockets of "make check" temporary clusters.Noah Misch
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
2014-05-15Fix whitespacePeter Eisentraut
2014-05-15pg_update: slight major version adjustmentBruce Momjian
2014-05-15Fix version check for pg_upgrade line type crosscheck.Tom Lane
Per buildfarm.
2014-05-14pg_upgrade: error out on 'line' data type usageBruce Momjian
The data type internal format changed in 9.4. Also mention this in the 9.4 release notes.