aboutsummaryrefslogtreecommitdiff
path: root/src/bin/scripts
Commit message (Collapse)AuthorAge
* Translation updatesPeter Eisentraut2016-05-09
| | | | | Source-Git-URL: git://git.postgresql.org/git/pgtranslation/messages.git Source-Git-Hash: 17bf3e8564abf600274789fcc90e72532d5e7c05
* Link libpq after libpgfeutils to satisfy Windows linker.Tom Lane2016-03-24
| | | | | | | | Some of the non-MSVC Windows buildfarm members seem to need this to avoid getting "undefined symbol" errors on libpgfeutils' references to libpq. I could understand that if libpq were a static library, but surely it is not? Oh well, at least the extra reference is no more harmful than it is for libpgcommon or libpgport.
* Move psql's print.c and mbprint.c into src/fe_utils.Tom Lane2016-03-24
| | | | Just turning the crank ...
* Create src/fe_utils/, and move stuff into there from pg_dump's dumputils.Tom Lane2016-03-24
| | | | | | | | | | | | | | | Per discussion, we want to create a static library and put the stuff into it that until now has been shared across src/bin/ directories by ad-hoc methods like symlinking a source file. This commit creates the library and populates it with a couple of files that contain the widely-useful portions of pg_dump's dumputils.c file. dumputils.c survives, because it has some stuff that didn't seem appropriate for fe_utils, but it's significantly smaller and is no longer referenced from any other directory. Follow-on patches will move more stuff into fe_utils. The Mkvcbuild.pm hacking here is just a best guess; we'll see how the buildfarm likes it.
* Move keywords.c/kwlookup.c into src/common/.Tom Lane2016-03-23
| | | | | | | | | | | | | | | | | | | Now that we have src/common/ for code shared between frontend and backend, we can get rid of (most of) the klugy ways that the keyword table and keyword lookup code were formerly shared between different uses. This is a first step towards a more general plan of getting rid of special-purpose kluges for sharing code in src/bin/. I chose to merge kwlookup.c back into keywords.c, as it once was, and always has been so far as keywords.h is concerned. We could have kept them separate, but there is noplace that uses ScanKeywordLookup without also wanting access to the backend's keyword list, so there seems little point. ecpg is still a bit weird, but at least now the trickiness is documented. I think that the MSVC build script should require no adjustments beyond what's done here ... but we'll soon find out.
* Handle invalid libpq sockets in more placesPeter Eisentraut2016-03-08
| | | | | | Also, make error messages consistent. From: Michael Paquier <michael.paquier@gmail.com>
* Rework PostgresNode's psql methodAlvaro Herrera2016-03-03
| | | | | | | | | | | | | | | | | | | | | | This makes the psql() method much more capable: it captures both stdout and stderr; it now returns the psql exit code rather than stdout; a timeout can now be specified, as can ON_ERROR_STOP behavior; it gained a new "on_error_die" (defaulting to off) parameter to raise an exception if there's any problem. Finally, additional parameters to psql can be passed if there's need for further tweaking. For convenience, a new safe_psql() method retains much of the old behavior of psql(), except that it uses on_error_die on, so that problems like syntax errors in SQL commands can be detected more easily. Many existing TAP test files now use safe_psql, which is what is really wanted. A couple of ->psql() calls are now added in the commit_ts tests, which verify that the right thing is happening on certain errors. Some ->command_fails() calls in recovery tests that were verifying that psql failed also became ->psql() calls now. Author: Craig Ringer. Some tweaks by Álvaro Herrera Reviewed-By: Michaël Paquier
* PostgresNode: Add names to nodesAlvaro Herrera2016-01-20
| | | | | | | | This makes the log files easier to follow when investigating a test failure. Author: Michael Paquier Review: Noah Misch
* Update copyright for 2016Bruce Momjian2016-01-02
| | | | Backpatch certain files through 9.1
* Improve handling of password reuse in src/bin/scripts programs.Tom Lane2015-12-23
| | | | | | | | | | | | | | | | | This reverts most of commit 83dec5a71 in favor of having connectDatabase() store the possibly-reusable password in a static variable, similar to the coding we've had for a long time in pg_dump's version of that function. To avoid possible problems with unwanted password reuse, make callers specify whether it's reasonable to attempt to re-use the password. This is a wash for cases where re-use isn't needed, but it is far simpler for callers that do want that. Functionally there should be no difference. Even though we're past RC1, it seems like a good idea to back-patch this into 9.5, like the prior commit. Otherwise, if there are any third-party users of connectDatabase(), they'll have to deal with an API change in 9.5 and then another one in 9.6. Michael Paquier
* Fix behavior of printTable() and friends with externally-invoked pager.Tom Lane2015-12-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The formatting modes that depend on knowledge of the terminal window width did not work right when printing a query result that's been fetched in sections (as a result of FETCH_SIZE). ExecQueryUsingCursor() would force use of the pager as soon as there's more than one result section, and then print.c would see an output file pointer that's not stdout and incorrectly conclude that the terminal window width isn't relevant. This has been broken all along for non-expanded "wrapped" output format, and as of 9.5 the issue affects expanded mode as well. The problem also caused "\pset expanded auto" mode to invariably *not* switch to expanded output in a segmented result, which seems to me to be exactly backwards. To fix, we need to pass down an "is_pager" flag to inform the print.c subroutines that some calling level has already replaced stdout with a pager pipe, so they should (a) not do that again and (b) nonetheless honor the window size. (Notably, this makes the first is_pager test in print_aligned_text() not be dead code anymore.) This patch is a bit invasive because there are so many existing calls of printQuery()/printTable(), but fortunately all but a couple can just pass "false" for the added parameter. Back-patch to 9.5 but no further. Given the lack of field complaints, it's not clear that we should change the behavior in stable branches. Also, the API change for printQuery()/printTable() might possibly break third-party code, again something we don't like to do in stable branches. However, it's not quite too late to do this in 9.5, and with the larger scope of the problem there, it seems worth doing.
* Refactor Perl test codeAlvaro Herrera2015-12-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The original code was a bit clunky; make it more amenable for further reuse by creating a new Perl package PostgresNode, which is an object-oriented representation of a single server, with some support routines such as init, start, stop, psql. This serves as a better basis on which to build further test code, and enables writing tests that use more than one server without too much complication. This commit modifies a lot of the existing test files, mostly to remove explicit calls to system commands (pg_ctl) replacing them with method calls of a PostgresNode object. The result is quite a bit more straightforward. Also move some initialization code to BEGIN and INIT blocks instead of having it straight in as top-level code. This commit also introduces package RecursiveCopy so that we can copy whole directories without having to depend on packages that may not be present on vanilla Perl 5.8 installations. I also ran perltidy on the modified files, which changes some code sites that are not otherwise touched by this patch. I tried to avoid this, but it ended up being more trouble than it's worth. Authors: Michael Paquier, Álvaro Herrera Review: Noah Misch
* Improve messagePeter Eisentraut2015-11-16
|
* vacuumdb: don't prompt for passwords over and overAlvaro Herrera2015-11-12
| | | | | | | | | | | | | | | | | | | Having the script prompt for passwords over and over was a preexisting problem when it processed multiple databases or when it processed multiple analyze stages, but the parallel mode introduced in commit a179232047 made it worse. Fix the annoyance by keeping a copy of the password used by the first connection that requires one. Since users can (currently) only have a single password, there's no need for more complex arrangements (such as remembering one password per database). Per bug #13741 reported by Eric Brown. Patch authored and cross-reviewed by Haribabu Kommi and Michael Paquier, slightly tweaked by Álvaro Herrera. Discussion: http://www.postgresql.org/message-id/20151027193919.931.54948@wrigleys.postgresql.org Backpatch to 9.5, where parallel vacuumdb was introduced.
* reindexdb: Fix mistake in help outputPeter Eisentraut2015-09-27
|
* Review program help output for wording and formattingPeter Eisentraut2015-09-16
|
* vacuumdb: Don't assign negative values to a boolean.Andres Freund2015-08-15
| | | | | | | | | | Since a17923204736 (vacuumdb: enable parallel mode) -1 has been assigned to a boolean. That can, justifiedly, trigger compiler warnings. There's also no need for ternary logic, result was only ever set to 0 or -1. So don't. Discussion: 20150812084351.GD8470@awork2.anarazel.de Backpatch: 9.5
* Fix assorted memory leaks.Tom Lane2015-07-12
| | | | | | | | Per Coverity (not that any of these are so non-obvious that they should not have been caught before commit). The extent of leakage is probably minor to unnoticeable, but a leak is a leak. Back-patch as necessary. Michael Paquier
* Use appendStringInfoString/Char et al where appropriate.Heikki Linnakangas2015-07-02
| | | | | | Patch by David Rowley. Backpatch to 9.5, as some of the calls were new in 9.5, and keeping the code in sync with master makes future backpatching easier.
* Translation updatesPeter Eisentraut2015-06-28
| | | | | Source-Git-URL: git://git.postgresql.org/git/pgtranslation/messages.git Source-Git-Hash: fb7e72f46cfafa1b5bfe4564d9686d63a1e6383f
* pgindent run for 9.5Bruce Momjian2015-05-23
|
* Support --verbose option in reindexdb.Fujii Masao2015-05-15
| | | | Sawada Masahiko, reviewed by Fabrízio Mello
* Fix parallel make risk with new check temp-install setupPeter Eisentraut2015-04-29
| | | | | | | | | | | | | | | The "check" target no longer needs to depend on "all", because it now runs "install" directly, which in turn depends on "all". Doing both will cause problems with parallel make, because two builds will run next to each other. Also remove the redirection of the temp-install output into a log file. This was appropriate when this was done from within pg_regress, but now it's just a regular make run, and especially with the above changes this will now take the place of running the "all" target before the test suites. problem report by Jeff Janes, patch in part by Michael Paquier
* Fix TAP tests to use only standard command-line argument ordering.Tom Lane2015-04-04
| | | | | | | | | | | | | Some of the TAP tests were supposing that PG programs would accept switches after non-switch arguments on their command lines. While GNU getopt_long() does allow that, our own implementation does not, and it's nowhere suggested in our documentation that such cases should work. Adjust the tests to use only the documented syntax. Back-patch to 9.4, since without this the TAP tests fail when run with src/port's getopt_long() implementation. Michael Paquier
* vacuumdb: Check result status of PQsendQueryAlvaro Herrera2015-03-23
| | | | Noticed by Coverity
* vacuumdb --help text: clarify analyze-onlyBruce Momjian2015-03-20
| | | | Patch by Mats Erik Andersson
* Translation updatesPeter Eisentraut2015-02-01
| | | | | Source-Git-URL: git://git.postgresql.org/git/pgtranslation/messages.git Source-Git-Hash: 19c72ea8d856d7b1d4f5d759a766c8206bf9ce53
* Fix assignment operator thinkoAlvaro Herrera2015-01-24
| | | | Pointed out by Michael Paquier
* vacuumdb: enable parallel modeAlvaro Herrera2015-01-23
| | | | | | | | This mode allows vacuumdb to open several server connections to vacuum or analyze several tables simultaneously. Author: Dilip Kumar. Some reworking by Álvaro Herrera Reviewed by: Jeff Janes, Amit Kapila, Magnus Hagander, Andres Freund
* Update copyright for 2015Bruce Momjian2015-01-06
| | | | Backpatch certain files through 9.0
* Translation updatesPeter Eisentraut2014-12-15
|
* Fix typoPeter Eisentraut2014-12-10
| | | | Author: Fabrízio de Royes Mello <fabriziomello@gmail.com>
* Execute 18 tests for src/bin/scripts/t/090..Simon Riggs2014-12-09
| | | | Some requests count as two tests.
* REINDEX SCHEMASimon Riggs2014-12-09
| | | | | | | | Add new SCHEMA option to REINDEX and reindexdb. Sawada Masahiko Reviewed by Michael Paquier and Fabrízio de Royes Mello
* Mark response messages for translation in pg_isready.Fujii Masao2014-11-28
| | | | | | Back-patch to 9.3 where pg_isready was added. Mats Erik Andersson
* Translation updatesPeter Eisentraut2014-11-16
|
* Remove use of TAP subtestsPeter Eisentraut2014-10-29
| | | | | They turned out to be too much of a portability headache, because they need a fairly new version of Test::More to work properly.
* Translation updatesPeter Eisentraut2014-10-05
|
* Fix vacuumdb --analyze-in-stages --all orderPeter Eisentraut2014-09-11
| | | | | | | | When running vacuumdb --analyze-in-stages --all, it needs to run the first stage across all databases before the second one, instead of running all stages in a database before processing the next one. Also respect the --quiet option with --analyze-in-stages.
* Translation updatesPeter Eisentraut2014-07-21
|
* Add missing source files to nls.mkPeter Eisentraut2014-07-15
| | | | | | These are files under common/ that have been moved around. Updating these manually is not satisfactory, but it's the only solution at the moment.
* pgindent run for 9.4Bruce Momjian2014-05-06
| | | | | This includes removing tabs after periods in C comments, which was applied to back branches, so this change should not effect backpatching.
* Clean up temp installations after client program tests.Tom Lane2014-04-25
| | | | | | Commit 7d0f493f19607774fdccb1a1ea06fdd96a3d9698 added infrastructure to perform tests in assorted src/bin/ subdirectories, but forgot to teach "make clean" to clean up the detritus the tests leave behind.
* vacuumdb: Add option --analyze-in-stagesPeter Eisentraut2014-04-15
| | | | | | | | | | Add vacuumdb option --analyze-in-stages which runs ANALYZE three times with different configuration settings, adopting the logic from the analyze_new_cluster.sh script that pg_upgrade generates. That way, users of pg_dump/pg_restore can also use that functionality. Change pg_upgrade to create the script so that it calls vacuumdb instead of implementing the logic itself.
* Add TAP tests for client programsPeter Eisentraut2014-04-14
| | | | | Reviewed-by: Pavel Stěhule <pavel.stehule@gmail.com> Reviewed-by: Erik Rijkers <er@xs4all.nl>
* scripts: Remove newlines from end of generated SQLPeter Eisentraut2014-02-10
| | | | | | | | | This results in spurious empty lines in the server log. Instead, add the newlines only when printing out the --echo output. In some cases, this was already done, leading to two newlines being printed. Clean that up as well. From: Fabrízio de Royes Mello <fabriziomello@gmail.com>
* Move username lookup functions from /port to /commonBruce Momjian2014-01-10
| | | | Per suggestion from Peter E and Alvaro
* Update copyright for 2014Bruce Momjian2014-01-07
| | | | | Update all files in head, and files COPYRIGHT and legal.sgml in all back branches.
* Fix translatability markings in psql, and add defenses against future bugs.Tom Lane2014-01-04
| | | | | | | | | | | | | | | | | | | | | | Several previous commits have added columns to various \d queries without updating their translate_columns[] arrays, leading to potentially incorrect translations in NLS-enabled builds. Offenders include commit 893686762 (added prosecdef to \df+), c9ac00e6e (added description to \dc+) and 3b17efdfd (added description to \dC+). Fix those cases back to 9.3 or 9.2 as appropriate. Since this is evidently more easily missed than one would like, in HEAD also add an Assert that the supplied array is long enough. This requires an API change for printQuery(), so it seems inappropriate for back branches, but presumably all future changes will be tested in HEAD anyway. In HEAD and 9.3, also clean up a whole lot of sloppiness in the emitted SQL for \dy (event triggers): lack of translatability due to failing to pass words-to-be-translated through gettext_noop(), inadequate schema qualification, and sloppy formatting resulting in unnecessarily ugly -E output. Peter Eisentraut and Tom Lane, per bug #8702 from Sergey Burladyan
* Fix incorrect error message reported for non-existent usersBruce Momjian2013-12-18
| | | | | | | | Previously, lookups of non-existent user names could return "Success"; it will now return "User does not exist" by resetting errno. This also centralizes the user name lookup code in libpgport. Report and analysis by Nicolas Marchildon; patch by me