summaryrefslogtreecommitdiff
path: root/src/bin/psql/help.c
Commit message (Collapse)AuthorAgeFilesLines
* Code review for psql's helpSQL() function.Tom Lane2021-01-261-21/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The loops to identify word boundaries could access past the end of the input string. Likely that would never result in an actual crash, but it makes valgrind unhappy. The logic to try different numbers of words didn't work when the input has two words but we only have a match to the first, eg "\h with select". (We must "continue" the pass loop, not "break".) The logic to compute nl_count was bizarrely managed, and in at least two code paths could end up calling PageOutput with nl_count = 0, resulting in failing to paginate output that should have been fed to the pager. Also, in v12 and up, the nl_count calculation hadn't been updated to account for the addition of a URL. The PQExpBuffer holding the command syntax details wasn't freed, resulting in a session-lifespan memory leak. While here, improve some comments, choose a more descriptive name for a variable, fix inconsistent datatype choice for another variable. Per bug #16837 from Alexander Lakhin. This code is very old, so back-patch to all supported branches. Kyotaro Horiguchi and Tom Lane Discussion: https://postgr.es/m/16837-479bcd56040c71b3@postgresql.org
* psql documentation fixesPeter Eisentraut2018-01-291-3/+5
| | | | | | | Update the documentation for \pset to mention columns|linestyle|pager_min_lines. Author: Дилян Палаузов <dpa-postgres@aegee.org>
* Update line count totals for psql help displays.Tom Lane2016-08-181-3/+3
| | | | | | | | As usual, we've been pretty awful about maintaining these counts. They're not all that critical, perhaps, but let's get them right at release time. Also fix 9.5, which I notice is just as bad. It's probably wrong further back, but the lack of --help=foo options before 9.5 makes it too painful to count.
* psql: Review of new help output stringsPeter Eisentraut2015-12-201-33/+33
|
* Review program help output for wording and formattingPeter Eisentraut2015-09-161-3/+4
|
* pgindent run for 9.5Bruce Momjian2015-05-231-20/+20
|
* psql: fix \connect with URIs and conninfo stringsAlvaro Herrera2015-04-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-021-2/+2
| | | | | 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-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-311-1/+1
| | | | | | Patch by Szymon Guz, adjustments by me Testing by Michael Paquier, Pavel Stehule
* Add a pager_min_lines setting to psqlAndrew Dunstan2015-03-281-6/+6
| | | | | | | | | | 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-061-2/+2
| | | | Backpatch certain files through 9.0
* psql: Fix \? output alignmentPeter Eisentraut2014-10-131-1/+1
| | | | This was inadvertently changed in commit c64e68fd.
* Add unicode_*_linestyle to \? variablesStephen Frost2014-09-221-1/+5
| | | | | | | | | | 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-121-1/+2
| | | | | | | | | | | 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-101-48/+162
| | | | | | | | | | | | | | | | | | | | | 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-101-0/+1
| | | | | | | | | 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-161-4/+4
| | | | | | | 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-101-0/+1
| | | | Per suggestion from Peter E and Alvaro
* Update copyright for 2014Bruce Momjian2014-01-071-2/+2
| | | | | 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-181-20/+4
| | | | | | | | 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-031-1/+1
| | | | Gilles Darold, reviewed by Pavel Stehule
* Fix line count in slashUsage().Tom Lane2013-04-041-1/+1
| | | | | | | | 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-041-1/+2
| | | | | | 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-041-1/+1
| | | | reviewed by Satoshi Nagayasu
* Add a materialized view relations.Kevin Grittner2013-03-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | 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-021-2/+3
| | | | | | 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-151-5/+7
| | | | | | | 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-151-1/+6
| | | | | Backpatch all the way to 8.3. Fixes bug #7811, per report and diagnosis by Meng Qingzhong.
* Update copyrights for 2013Bruce Momjian2013-01-011-2/+2
| | | | | Fully update git head, and update back branches in ./COPYRIGHT and legal.sgml files.
* Make psql -1 < file behave as expected.Robert Haas2012-08-091-1/+1
| | | | | | | | | | 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-181-0/+1
| | | | | | | | | | | | | | 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-061-1/+1
| | | | | | \copyright output to 2012. Backpatch to 9.2.
* Make documentation of --help and --version options more consistentPeter Eisentraut2012-06-181-2/+2
| | | | | | 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-101-3/+3
| | | | commit-fest.
* psql: Support zero byte field and record separatorsPeter Eisentraut2012-02-091-2/+6
| | | | | | | | 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-011-1/+1
|
* Add a \setenv command to psql.Andrew Dunstan2011-12-041-1/+2
| | | | | | | | 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-121-2/+2
| | | | | | | 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-111-1/+1
| | | | | | | | | | | | | 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-081-2/+2
| | | | | | | | | | | \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-041-1/+1
| | | | | | | | 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-061-1/+2
| | | | | | | | | \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.
* DDL support for collationsPeter Eisentraut2011-02-121-0/+1
| | | | | | | | | | | | | - collowner field - CREATE COLLATION - ALTER COLLATION - DROP COLLATION - COMMENT ON COLLATION - integration with extensions - pg_dump support for the above - dependency management - psql tab completion - psql \dO command
* Core support for "extensions", which are packages of SQL objects.Tom Lane2011-02-081-0/+1
| | | | | | | | | | | | | This patch adds the server infrastructure to support extensions. There is still one significant loose end, namely how to make it play nice with pg_upgrade, so I am not yet committing the changes that would make all the contrib modules depend on this feature. In passing, fix a disturbingly large amount of breakage in AlterObjectNamespace() and callers. Dimitri Fontaine, reviewed by Anssi Kääriäinen, Itagaki Takahiro, Tom Lane, and numerous others
* Update psql's \copyright to match the text we have in the COPYRIGHT file.Heikki Linnakangas2011-01-271-15/+14
|
* Document the "S" option for psql's \dn command in the psql helpPeter Eisentraut2011-01-251-1/+1
| | | | | This option was recently introduced, but the documentation in help.c was not updated.
* Add new psql command \dL to list languages.Robert Haas2011-01-201-0/+1
| | | | | Original patch by Fernando Ike, revived by Josh Kuperschmidt, reviewed by Andreas Karlsson, and in earlier versions by Tom Lane and Peter Eisentraut.
* Basic foreign table support.Robert Haas2011-01-011-1/+3
| | | | | | | | | | | Foreign tables are a core component of SQL/MED. This commit does not provide a working SQL/MED infrastructure, because foreign tables cannot yet be queried. Support for foreign table scans will need to be added in a future patch. However, this patch creates the necessary system catalog structure, syntax support, and support for ancillary operations such as COMMENT and SECURITY LABEL. Shigeru Hanada, heavily revised by Robert Haas
* Stamp copyrights for year 2011.Bruce Momjian2011-01-011-2/+2
|