aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/help.c
Commit message (Collapse)AuthorAge
* Put some things in a better order in psql helpPeter Eisentraut2016-07-12
|
* pgindent run for 9.6Robert Haas2016-06-09
|
* Fix loose ends for SQL ACCESS METHOD objectsAlvaro Herrera2016-06-07
| | | | | | | | | | | | | COMMENT ON ACCESS METHOD was missing; add it, along psql tab-completion support for it. psql was also missing a way to list existing access methods; the new \dA command does that. Also add tab-completion support for DROP ACCESS METHOD. Author: Michael Paquier Discussion: https://www.postgresql.org/message-id/CAB7nPqTzdZdu8J7EF8SXr_R2U5bSUUYNOT3oAWBZdEoggnwhGA@mail.gmail.com
* Support \crosstabview in psqlAlvaro Herrera2016-04-08
| | | | | | | | | | | | | | | | | | | \crosstabview is a completely different way to display results from a query: instead of a vertical display of rows, the data values are placed in a grid where the column and row headers come from the data itself, similar to a spreadsheet. The sort order of the horizontal header can be specified by using another column in the query, and the vertical header determines its ordering from the order in which they appear in the query. This only allows displaying a single value in each cell. If more than one value correspond to the same cell, an error is thrown. Merging of values can be done in the query itself, if necessary. This may be revisited in the future. Author: Daniel Verité Reviewed-by: Pavel Stehule, Dean Rasheed
* Reserve the "pg_" namespace for rolesStephen Frost2016-04-08
| | | | | | | | | This will prevent users from creating roles which begin with "pg_" and will check for those roles before allowing an upgrade using pg_upgrade. This will allow for default roles to be provided at initdb time. Reviews by José Luis Tallón and Robert Haas
* Add a \gexec command to psql for evaluation of computed queries.Tom Lane2016-04-04
| | | | | | | | | | | | | | | | | | | | | | | | | \gexec executes the just-entered query, like \g, but instead of printing the results it takes each field as a SQL command to send to the server. Computing a series of queries to be executed is a fairly common thing, but up to now you always had to resort to kluges like writing the queries to a file and then inputting the file. Now it can be done with no intermediate step. The implementation is fairly straightforward except for its interaction with FETCH_COUNT. ExecQueryUsingCursor isn't capable of being called recursively, and even if it were, its need to create a transaction block interferes unpleasantly with the desired behavior of \gexec after a failure of a generated query (i.e., that it can continue). Therefore, disable use of ExecQueryUsingCursor when doing the master \gexec query. We can still apply it to individual generated queries, however, and there might be some value in doing so. While testing this feature's interaction with single-step mode, I (tgl) was led to conclude that SendQuery needs to recognize SIGINT (cancel_pressed) as a negative response to the single-step prompt. Perhaps that's a back-patchable bug fix, but for now I just included it here. Corey Huinker, reviewed by Jim Nasby, Daniel Vérité, and myself
* Add psql \errverbose command to see last server error at full verbosity.Tom Lane2016-04-03
| | | | | | | | | | | | | | | | | | Often, upon getting an unexpected error in psql, one's first wish is that the verbosity setting had been higher; for example, to be able to see the schema-name field or the server code location info. Up to now the only way has been to adjust the VERBOSITY variable and repeat the failing query. That's a pain, and it doesn't work if the error isn't reproducible. This commit adds a psql feature that redisplays the most recent server error at full verbosity, without needing to make any variable changes or re-execute the failed command. We just need to hang onto the latest error PGresult in case the user executes \errverbose, and then apply libpq's new PQresultVerboseErrorMessage() function to it. This will consume some trivial amount of psql memory, but otherwise the cost when the feature isn't used should be negligible. Alex Shulgin, reviewed by Daniel Vérité, some improvements by me
* Update copyright for 2016Bruce Momjian2016-01-02
| | | | Backpatch certain files through 9.1
* psql: Review of new help output stringsPeter Eisentraut2015-12-20
|
* Review program help output for wording and formattingPeter Eisentraut2015-09-16
|
* Rearrange the handling of error context reports.Tom Lane2015-09-05
| | | | | | | | | | | | | | | | | | | | | | | | Remove the code in plpgsql that suppressed the innermost line of CONTEXT for messages emitted by RAISE commands. That was never more than a quick backwards-compatibility hack, and it's pretty silly in cases where the RAISE is nested in several levels of function. What's more, it violated our design theory that verbosity of error reports should be controlled on the client side not the server side. To alleviate the resulting noise increase, introduce a feature in libpq and psql whereby the CONTEXT field of messages can be suppressed, either always or only for non-error messages. Printing CONTEXT for errors only is now their default behavior. The actual code changes here are pretty small, but the effects on the regression test outputs are widespread. I had to edit some of the alternative expected outputs by hand; hopefully the buildfarm will soon find anything I fat-fingered. In passing, fix up (again) the output line counts in psql's various help displays. Add some commentary about how to verify them. Pavel Stehule, reviewed by Petr Jelínek, Jeevan Chalke, and others
* Add psql \ev and \sv commands for editing and showing view definitions.Tom Lane2015-07-03
| | | | | | These are basically just like the \ef and \sf commands for functions. Petr Korobeinikov, reviewed by Jeevan Chalke, some changes by me
* pgindent run for 9.5Bruce Momjian2015-05-23
|
* psql: fix \connect with URIs and conninfo stringsAlvaro Herrera2015-04-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the second try at this, after fcef1617295 failed miserably and had to be reverted: as it turns out, libpq cannot depend on libpgcommon after all. Instead of shuffling code in the master branch, make that one just like 9.4 and accept the duplication. (This was all my own mistake, not the patch submitter's). psql was already accepting conninfo strings as the first parameter in \connect, but the way it worked wasn't sane; some of the other parameters would get the previous connection's values, causing it to connect to a completely unexpected server or, more likely, not finding any server at all because of completely wrong combinations of parameters. Fix by explicitely checking for a conninfo-looking parameter in the dbname position; if one is found, use its complete specification rather than mix with the other arguments. Also, change tab-completion to not try to complete conninfo/URI-looking "dbnames" and document that conninfos are accepted as first argument. There was a weak consensus to backpatch this, because while the behavior of using the dbname as a conninfo is nowhere documented for \connect, it is reasonable to expect that it works because it does work in many other contexts. Therefore this is backpatched all the way back to 9.0. Author: David Fetter, Andrew Dunstan. Some editorialization by me (probably earning a Gierth's "Sloppy" badge in the process.) Reviewers: Andrew Gierth, Erik Rijkers, Pavel Stěhule, Stephen Frost, Robert Haas, Andrew Dunstan.
* Revert "psql: fix \connect with URIs and conninfo strings"Robert Haas2015-04-02
| | | | | This reverts commit fcef1617295c074f2684c887627184d2fc26ac04, about which both the buildfarm and my local machine are very unhappy.
* psql: fix \connect with URIs and conninfo stringsAlvaro Herrera2015-04-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | psql was already accepting conninfo strings as the first parameter in \connect, but the way it worked wasn't sane; some of the other parameters would get the previous connection's values, causing it to connect to a completely unexpected server or, more likely, not finding any server at all because of completely wrong combinations of parameters. Fix by explicitely checking for a conninfo-looking parameter in the dbname position; if one is found, use its complete specification rather than mix with the other arguments. Also, change tab-completion to not try to complete conninfo/URI-looking "dbnames" and document that conninfos are accepted as first argument. There was a weak consensus to backpatch this, because while the behavior of using the dbname as a conninfo is nowhere documented for \connect, it is reasonable to expect that it works because it does work in many other contexts. Therefore this is backpatched all the way back to 9.0. To implement this, routines previously private to libpq have been duplicated so that psql can decide what looks like a conninfo/URI string. In back branches, just duplicate the same code all the way back to 9.2, where URIs where introduced; 9.0 and 9.1 have a simpler version. In master, the routines are moved to src/common and renamed. Author: David Fetter, Andrew Dunstan. Some editorialization by me (probably earning a Gierth's "Sloppy" badge in the process.) Reviewers: Andrew Gierth, Erik Rijkers, Pavel Stěhule, Stephen Frost, Robert Haas, Andrew Dunstan.
* psql: add asciidoc output formatBruce Momjian2015-03-31
| | | | | | Patch by Szymon Guz, adjustments by me Testing by Michael Paquier, Pavel Stehule
* Add a pager_min_lines setting to psqlAndrew Dunstan2015-03-28
| | | | | | | | | | If set, the pager will not be used unless this many lines are to be displayed, even if that is more than the screen depth. Default is zero, meaning it's disabled. There is probably more work to be done in giving the user control over when the pager is used, particularly when wide output forces use of the pager regardless of how many lines there are, but this is a start.
* Update copyright for 2015Bruce Momjian2015-01-06
| | | | Backpatch certain files through 9.0
* psql: Fix \? output alignmentPeter Eisentraut2014-10-13
| | | | This was inadvertently changed in commit c64e68fd.
* Add unicode_*_linestyle to \? variablesStephen Frost2014-09-22
| | | | | | | | | | In a2dabf0 we added the ability to have single or double unicode linestyle for the border, column, or header. Unfortunately, the \? variables output was not updated for these new psql variables. This corrects that oversight. Patch by Pavel Stehule.
* Add unicode_{column|header|border}_style to psqlStephen Frost2014-09-12
| | | | | | | | | | | With the unicode linestyle, this adds support to control if the column, header, or border style should be single or double line unicode characters. The default remains 'single'. In passing, clean up the border documentation and address some minor formatting/spelling issues. Pavel Stehule, with some additional changes by me.
* Add new psql help topics, accessible to both --help and \?.Andres Freund2014-09-10
| | | | | | | | | | | | | | | | | | | | | Add --help=<topic> for the commandline, and \? <topic> as a backslash command, to show more help than the invocations without parameters do. "commands", "variables" and "options" currently exist as help topics describing, respectively, backslash commands, psql variables, and commandline switches. Without parameters the help commands show their previous topic. Some further wordsmithing or extending of the added help content might be needed; but there seems little benefit delaying the overall feature further. Author: Pavel Stehule, editorialized by many Reviewed-By: Andres Freund, Petr Jelinek, Fujii Masao, MauMau, Abhijit Menon-Sen and Erik Rijkers. Discussion: CAFj8pRDVGuC-nXBfe2CK8vpyzd2Dsr9GVpbrATAnZO=2YQ0s2Q@mail.gmail.com, CAFj8pRA54AbTv2RXDTRxiAd8hy8wxmoVLqhJDRCwEnhdd7OUkw@mail.gmail.com
* Add new ECHO mode 'errors' that displays only failed commands in psql.Fujii Masao2014-07-10
| | | | | | | | | When the psql variable ECHO is set to 'erros', only failed SQL commands are printed to standard error output. Also this patch adds -b option into psql. This is equivalent to setting the variable ECHO to 'errors'. Pavel Stehule, reviewed by Fabrízio de Royes Mello, Samrat Revagade, Kumar Rajeev Rastogi, Abhijit Menon-Sen, and me.
* psql: update --help output for unaligned mode paramsBruce Momjian2014-04-16
| | | | | | | Previously it wasn't clear from --help that -F, -R, -z, -0 only controlled psql unaligned output. Initial patch from Jov <amutu@amutu.com>, adjustments by me
* 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 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
* psql: Make \pset without arguments show all settings.Robert Haas2013-10-03
| | | | Gilles Darold, reviewed by Pavel Stehule
* Fix line count in slashUsage().Tom Lane2013-04-04
| | | | | | | | Counting newlines shows that quite a few recent patches have neglected to update the output-lines count given to PageOutput(). Fortunately it's not terribly critical that this be exact, since we long since exceeded the height of most people's terminal windows. Still, maybe we ought to think of a way to not have to maintain this manually anymore.
* Add \watch [SEC] command to psql.Tom Lane2013-04-04
| | | | | | This allows convenient re-execution of commands. Will Leinweber, reviewed by Peter Eisentraut, Daniel Farina, and Tom Lane
* psql: Let \l accept a patternPeter Eisentraut2013-03-04
| | | | reviewed by Satoshi Nagayasu
* Add a materialized view relations.Kevin Grittner2013-03-03
| | | | | | | | | | | | | | | | | | | | | | A materialized view has a rule just like a view and a heap and other physical properties like a table. The rule is only used to populate the table, references in queries refer to the materialized data. This is a minimal implementation, but should still be useful in many cases. Currently data is only populated "on demand" by the CREATE MATERIALIZED VIEW and REFRESH MATERIALIZED VIEW statements. It is expected that future releases will add incremental updates with various timings, and that a more refined concept of defining what is "fresh" data will be developed. At some point it may even be possible to have queries use a materialized in place of references to underlying tables, but that requires the other above-mentioned features to be working first. Much of the documentation work by Robert Haas. Review by Noah Misch, Thom Brown, Robert Haas, Marko Tiikkaja Security review by KaiGai Kohei, with a decision on how best to implement sepgsql still pending.
* Create a psql command \gset to store query results into psql variables.Tom Lane2013-02-02
| | | | | | This eases manipulation of query results in psql scripts. Pavel Stehule, reviewed by Piyush Newe, Shigeru Hanada, and Tom Lane
* Make \? help message more clear when not connected.Heikki Linnakangas2013-01-15
| | | | | | | On second thought, "none" could mislead to think that you're connected a database with that name. Duplicate the whole string, so that it can be more easily translated. In back-branches, thought, just use an empty string in place of the database name, to avoid adding a translatable string.
* Don't pass NULL to fprintf, if not currently connected to a database.Heikki Linnakangas2013-01-15
| | | | | Backpatch all the way to 8.3. Fixes bug #7811, per report and diagnosis by Meng Qingzhong.
* Update copyrights for 2013Bruce Momjian2013-01-01
| | | | | Fully update git head, and update back branches in ./COPYRIGHT and legal.sgml files.
* Make psql -1 < file behave as expected.Robert Haas2012-08-09
| | | | | | | | | | Previously, the -1 option was silently ignored. Also, emit an error if -1 is used in a context where it won't be respected, to avoid user confusion. Original patch by Fabien COELHO, but this version is quite different from the original submission.
* Syntax support and documentation for event triggers.Robert Haas2012-07-18
| | | | | | | | | | | | | | They don't actually do anything yet; that will get fixed in a follow-on commit. But this gets the basic infrastructure in place, including CREATE/ALTER/DROP EVENT TRIGGER; support for COMMENT, SECURITY LABEL, and ALTER EXTENSION .. ADD/DROP EVENT TRIGGER; pg_dump and psql support; and documentation for the anticipated initial feature set. Dimitri Fontaine, with review and a bunch of additional hacking by me. Thom Brown extensively reviewed earlier versions of this patch set, but there's not a whole lot of that code left in this commit, as it turns out.
* Run updated copyright.pl on HEAD and 9.2 trees, updating the psqlBruce Momjian2012-07-06
| | | | | | \copyright output to 2012. Backpatch to 9.2.
* Make documentation of --help and --version options more consistentPeter Eisentraut2012-06-18
| | | | | | Before, some places didn't document the short options (-? and -V), some documented both, some documented nothing, and they were listed in various orders. Now this is hopefully more consistent and complete.
* Run pgindent on 9.2 source tree in preparation for first 9.3Bruce Momjian2012-06-10
| | | | commit-fest.
* psql: Support zero byte field and record separatorsPeter Eisentraut2012-02-09
| | | | | | | | Add new psql settings and command-line options to support setting the field and record separators for unaligned output to a zero byte, for easier interfacing with other shell tools. reviewed by Abhijit Menon-Sen
* Update copyright notices for year 2012.Bruce Momjian2012-01-01
|
* Add a \setenv command to psql.Andrew Dunstan2011-12-04
| | | | | | | | This can be used to set (or unset) environment variables that will affect programs called by psql (such as the PAGER), probably most usefully in a .psqlrc file. Andrew Dunstan, reviewed by Josh Kupershmidt.
* Add psql expanded auto modePeter Eisentraut2011-11-12
| | | | | | | This adds the "auto" option to the \x command, which switches to the expanded mode when the normal output would be wider than the screen. reviewed by Noah Misch
* Change psql's \dd command to do something more useful.Robert Haas2011-08-11
| | | | | | | | | | | | | Instead of displaying comments on an arbitrary subset of the object types which support them, make \dd display comments on exactly those object types which don't have their own backlash commands. We now regard the display of comments as properly the job of the relevant backslash command (though many of them do so only in verbose mode) rather than something that \dd should be responsible for. However, a handful of object types have no backlash command, so make \dd give information about those. Josh Kupershmidt
* Teach psql to display the comments on conversions and domains.Robert Haas2011-08-08
| | | | | | | | | | | \dc and \dD now accept a "+" option, which will cause the comments to be displayed. Along the way, correct a few oversights in the previous commit in this area, 3b17efdfdd846c9bfad1637686e6f18198ea3df5 - namely, (1) when \dL+ is used, make description still be the last column, for consistency with what we've done elsewhere; and (2) document the difference between \dC and \dC+. Josh Kupershmidt, with a couple of doc changes by me.
* Teach psql to display comments on languages and casts.Robert Haas2011-08-04
| | | | | | | | The output of \dL (list languages) is fairly narrow, so we just always display the comment. \dC (list casts) can get fairly wide, so we only display comments if the new \dC+ option is specified. Josh Kupershmidt
* Add \ir command to psql.Robert Haas2011-07-06
| | | | | | | | | \ir is short for "include relative"; when used from a script, the supplied pathname will be interpreted relative to the input file, rather than to the current working directory. Gurjeet Singh, reviewed by Josh Kupershmidt, with substantial further cleanup by me.