aboutsummaryrefslogtreecommitdiff
path: root/contrib/pg_upgrade/util.c
Commit message (Collapse)AuthorAge
* Create libpgcommon, and move pg_malloc et al to itAlvaro Herrera2013-02-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | libpgcommon is a new static library to allow sharing code among the various frontend programs and backend; this lets us eliminate duplicate implementations of common routines. We avoid libpgport, because that's intended as a place for porting issues; per discussion, it seems better to keep them separate. The first use case, and the only implemented by this patch, is pg_malloc and friends, which many frontend programs were already using. At the same time, we can use this to provide palloc emulation functions for the frontend; this way, some palloc-using files in the backend can also be used by the frontend cleanly. To do this, we change palloc() in the backend to be a function instead of a macro on top of MemoryContextAlloc(). This was previously believed to cause loss of performance, but this implementation has been tweaked by Tom and Andres so that on modern compilers it provides a slight improvement over the previous one. This lets us clean up some places that were already with localized hacks. Most of the pg_malloc/palloc changes in this patch were authored by Andres Freund. Zoltán Böszörményi also independently provided a form of that. libpgcommon infrastructure was authored by Álvaro.
* Update copyrights for 2013Bruce Momjian2013-01-01
| | | | | Fully update git head, and update back branches in ./COPYRIGHT and legal.sgml files.
* Improve pg_upgrade's status displayBruce Momjian2012-12-07
| | | | | | | | | | | | | | | | | Pg_upgrade displays file names during copy and database names during dump/restore. Andrew Dunstan identified three bugs: * long file names were being truncated to 60 _leading_ characters, which often do not change for long file names * file names were truncated to 60 characters in log files * carriage returns were being output to log files This commit fixes these --- it prints 60 _trailing_ characters to the status display, and full path names without carriage returns to log files. It also suppresses status output to the log file unless verbose mode is used.
* In pg_upgrade, dump each database separately and useBruce Momjian2012-11-30
| | | | | | --single-transaction to restore each database schema. This yields performance improvements for databases with many tables. Also, remove split_old_dump() as it is no longer needed.
* Work around unportable behavior of malloc(0) and realloc(NULL, 0).Tom Lane2012-10-02
| | | | | | | | | | | | | | | | On some platforms these functions return NULL, rather than the more common practice of returning a pointer to a zero-sized block of memory. Hack our various wrapper functions to hide the difference by substituting a size request of 1. This is probably not so important for the callers, who should never touch the block anyway if they asked for size 0 --- but it's important for the wrapper functions themselves, which mistakenly treated the NULL result as an out-of-memory failure. This broke at least pg_dump for the case of no user-defined aggregates, as per report from Matthew Carrington. Back-patch to 9.2 to fix the pg_dump issue. Given the lack of previous complaints, it seems likely that there is no live bug in previous releases, even though some of these functions were in place before that.
* Silence -Wunused-result warning in contrib/pg_upgrade.Tom Lane2012-09-05
| | | | | This is just neatnik-ism, but since we do it for comparable code in elog.c, we may as well do it here.
* Prevent pg_upgrade from crashing if it can't write to the currentBruce Momjian2012-08-10
| | | | | | directory. Backpatch to 9.2.
* In pg_upgrade, use pg_log() instead of prep_status() forBruce Momjian2012-08-03
| | | | | | newline-terminated messages, per suggestion from Tom. Backpatch to 9.2.
* Improve pg_upgrade's load_directory() function.Tom Lane2012-07-18
| | | | | | | | | | | | | | | | | Error out on out-of-memory, rather than returning -1, which the sole existing caller wasn't checking for anyway. There doesn't seem to be any use-case for making the caller check for failure here. Detect failure return from readdir(). Use a less platform-dependent method of calculating the entrysize. It's possible, but not yet confirmed, that this explains bug #6733, in which Mike Wilson reports a pg_upgrade crash that did not occur in 9.1. (Note that load_directory is effectively new code in 9.2, at least on platforms that have scandir().) Fix up comments, avoid uselessly using two counters, reduce the number of realloc calls to something sane.
* In pg_upgrade, add various logging improvements:Bruce Momjian2012-03-12
| | | | | | | | | | | add ability to control permissions of created files have psql echo its queries for easier debugging output four separate log files, and delete them on success add -r/--retain option to keep log files after success make logs file append-only remove -g/-G/-l logging options sugggest tailing appropriate log file on failure enhance -v/--verbose behavior
* Update copyright notices for year 2012.Bruce Momjian2012-01-01
|
* Add postgres.h to *.c files for pg_upgrade, ltree, and btree_gist, andBruce Momjian2011-08-26
| | | | | | remove from local *.h files. Per suggestion from Alvaro.
* In pg_upgrade, use pg_strudup(), for consistency.Bruce Momjian2011-07-20
|
* Pgindent run before 9.1 beta2.Bruce Momjian2011-06-09
|
* Allow pg_upgrade to honor libpq environment variables. Add 'local'Bruce Momjian2011-05-16
| | | | checks for PGHOST and PGHOSTADDR.
* Adjust pg_upgrade FATAL error messages to have consistent newlines.Bruce Momjian2011-05-06
| | | | Also adjust some error message capitalization for consistency.
* pgindent run before PG 9.1 beta 1.Bruce Momjian2011-04-10
|
* Replace the confusing exit_nicely() by an atexit/on_exit hookPeter Eisentraut2011-04-06
|
* Print clearer failure message when pg_upgrade fails due to a fatalBruce Momjian2011-03-05
| | | | error.
* Stamp copyrights for year 2011.Bruce Momjian2011-01-01
|
* Rename pg_upgrade 'log' to 'log_opts', to avoid platform naming conflict.Bruce Momjian2010-10-20
|
* Restructure the pg_upgrade code to use several global structures ratherBruce Momjian2010-10-19
| | | | than packing everything into 'ctx' and passing that to every function.
* Have pg_upgrade use strtoul(), not strtol().Bruce Momjian2010-09-29
|
* In pg_upgrade, properly handle oids > 2^31 by using strtoul() internallyBruce Momjian2010-09-28
| | | | | | rather than atol(). Per report from Brian Hirt
* Remove cvs keywords from all files.Magnus Hagander2010-09-20
|
* pgindent run for 9.0, second runBruce Momjian2010-07-06
|
* Make pg_upgrade copyrights just 2010, not 2010-2010.Bruce Momjian2010-07-03
|
* Add copyrights to pg_upgrade and pg_upgrade_tools files, per Tom.Bruce Momjian2010-07-03
|
* Add CVS tags to pg_upgrade and pg_upgrade_support files, per requestBruce Momjian2010-07-03
| | | | from Tom.
* Add pg_upgrade to /contrib; will be in 9.0 beta2.Bruce Momjian2010-05-12
Add documentation. Supports migration from PG 8.3 and 8.4.