summaryrefslogtreecommitdiff
path: root/src/bin/psql
AgeCommit message (Collapse)Author
2012-06-10Run pgindent on 9.2 source tree in preparation for first 9.3Bruce Momjian
commit-fest.
2012-06-07Message style improvementsPeter Eisentraut
2012-05-27psql: Remove notice about readline from --version outputPeter Eisentraut
This was from a time when readline support wasn't standard. And it doesn't help analyzing current line editing library problems.
2012-05-10Only attempt to show collations on servers >= 9.1.Magnus Hagander
Show a proper error message instead of a SQL error. Josh Kupershmidt
2012-05-08psql: Add variable to control keyword case in tab completionPeter Eisentraut
This adds the variable COMP_KEYWORD_CASE, which controls in what case keywords are completed. This is partially to let users configure the change from commit 69f4f1c3576abc535871c6cfa95539e32a36120f, but it also offers more behaviors than were available before.
2012-05-01Tweak psql to print row counts when \x auto chooses non-expanded output.Robert Haas
Noah Misch
2012-04-26psql: Tab completion updatesPeter Eisentraut
Add/complete support for: - ALTER DOMAIN / VALIDATE CONSTRAINT - ALTER DOMAIN / RENAME - ALTER DOMAIN / RENAME CONSTRAINT - ALTER TABLE / RENAME CONSTRAINT
2012-04-23Lots of doc corrections.Robert Haas
Josh Kupershmidt
2012-04-20Recast "ONLY" column CHECK constraints as NO INHERITAlvaro Herrera
The original syntax wasn't universally loved, and it didn't allow its usage in CREATE TABLE, only ALTER TABLE. It now works everywhere, and it also allows using ALTER TABLE ONLY to add an uninherited CHECK constraint, per discussion. The pg_constraint column has accordingly been renamed connoinherit. This commit partly reverts some of the changes in 61d81bd28dbec65a6b144e0cd3d0bfe25913c3ac, particularly some pg_dump and psql bits, because now pg_get_constraintdef includes the necessary NO INHERIT within the constraint definition. Author: Nikhil Sontakke Some tweaks by me
2012-04-18psql: Add tab completion for CREATE/ALTER ROLE name WITHPeter Eisentraut
Previously, the use of the optional key word WITH was not supported. Josh Kupershmidt
2012-04-10psql: Improve tab completion of WITHPeter Eisentraut
Only match when WITH is the first word, as WITH may appear in many other contexts. Josh Kupershmidt
2012-04-06Allow statistics to be collected for foreign tables.Tom Lane
ANALYZE now accepts foreign tables and allows the table's FDW to control how the sample rows are collected. (But only manual ANALYZEs will touch foreign tables, for the moment, since among other things it's not very clear how to handle remote permissions checks in an auto-analyze.) contrib/file_fdw is extended to support this. Etsuro Fujita, reviewed by Shigeru Hanada, some further tweaking by me.
2012-04-04Remove useless PGRES_COPY_BOTH "support" in psql.Tom Lane
There is no existing or foreseeable case in which psql should see a PGRES_COPY_BOTH PQresultStatus; and if such a case ever emerges, it's a pretty good bet that these code fragments wouldn't do the right thing anyway. Remove them, and let the existing default cases do the appropriate thing, namely emit an "unexpected PQresultStatus" bleat. Noted while working on libpq row processor patch, for which I was considering adding a PGRES_SUSPENDED status code --- the same default-case treatment would be appropriate for that.
2012-04-02Fix recently introduced typo in NLS file listsPeter Eisentraut
2012-03-31Fix glitch recently introduced in psql tab completion.Tom Lane
Over-optimization (by me, looks like :-() broke the case of recognizing a word boundary just before a quoted identifier. Reported and diagnosed by Dean Rasheed.
2012-03-30Add new files to NLS file listsPeter Eisentraut
Some of these are newly added, some are older and were forgotten, some don't contain any translatable strings right now but look like they could in the future.
2012-03-22If a role has a password expiration date, show that in psql's \du output.Tom Lane
Per a suggestion from Euler Taveira, it seems like a good idea to include this information in \du (and \dg) output. This costs nothing for people who are not using the VALID UNTIL feature, while for those who are, it's rather critical information. Fabrízio de Royes Mello
2012-03-21Clean up compiler warnings from unused variables with asserts disabledPeter Eisentraut
For those variables only used when asserts are enabled, use a new macro PG_USED_FOR_ASSERTS_ONLY, which expands to __attribute__((unused)) when asserts are not enabled.
2012-03-16psql: Remove inappropriate const qualifiersPeter Eisentraut
Since mbvalidate() can alter the string it validates, having the callers claim that the strings they accept are const is inappropriate.
2012-03-08psql: Remove useless codePeter Eisentraut
Apparently a copy-and-paste mistake introduced in 8ddd22f2456af0155f9c183894f481203e86b76e. found by Coverity
2012-03-07Fix indentation of \d footers for non-ASCII cases.Tom Lane
Multi-line "Inherits:" and "Child tables:" footers were misindented when those strings' translations involved multibyte characters, because we were using strlen() instead of an appropriate display width measurement. In passing, avoid doing gettext() more than once per loop in these places. While at it, fix pg_wcswidth(), which has been entirely broken since about 8.2, but fortunately has been unused for the same length of time. Report and patch by Sergey Burladyan (bug #6480)
2012-03-07psql: Avoid some spurious output if the server croaks.Robert Haas
Fixes a regression in commit 08146775acd8bfe0fcc509c71857abb928697171. Noah Misch
2012-03-07psql: Fix memory leakPeter Eisentraut
In expanded auto mode, a lot of allocated memory was not cleaned up. found by Coverity
2012-03-07psql: Fix invalid memory accessPeter Eisentraut
Due to an apparent thinko, when printing a table in expanded mode (\x), space would be allocated for 1 slot plus 1 byte per line, instead of 1 slot per line plus 1 slot for the NULL terminator. When the line count is small, reading or writing the terminator would therefore access memory beyond what was allocated.
2012-03-03Provide environment overrides for psql file locations.Andrew Dunstan
PSQL_HISTORY provides an alternative for the command history file, and PSQLRC provides an alternative location for the .psqlrc file.
2012-03-01psql: Improve error display for psql -f -Peter Eisentraut
Running "psql -f -" used to print psql:<stdin>:1: ERROR: blah but that got broken between 8.4 and 9.0 (commit b291c0fba83a1e93868e2f69c03be195d620f30c), and now it printed psql:-:1: ERROR: blah This reverts to the old behavior and cleans up some code that was left dead or useless by the mentioned commit.
2012-02-28Add const qualifiers where they are accidentally cast awayPeter Eisentraut
This only produces warnings under -Wcast-qual, but it's more correct and consistent in any case.
2012-02-28psql: when tab-completing, use quotes on file names that need themAlvaro Herrera
psql backslash commands that deal with file or directory names require quotes around those that have spaces, single quotes, or backslashes. However, tab-completing such names does not provide said quotes, and is thus almost useless with them. This patch fixes the problem by having a wrapper function around rl_filename_completion_function that dequotes on input and quotes on output. This eases dealing with such names. Author: Noah Misch
2012-02-09psql: Support zero byte field and record separatorsPeter Eisentraut
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
2012-02-01psql: Case preserving completion of SQL key wordsPeter Eisentraut
Instead of always completing SQL key words in upper case, look at the word being completed and match the case. reviewed by Fujii Masao
2012-01-31psql: Reduce the amount of const lies a bitPeter Eisentraut
2012-01-25Have \copy go through SendQueryAlvaro Herrera
This enables a bunch of features, notably ON_ERROR_ROLLBACK. It also makes COPY failure (either in the server or psql) as a whole behave more sanely in psql. Additionally, having more commands in the same command line as COPY works better (though since psql splits lines at semicolons, this doesn't matter much unless you're using -c). Also tighten a couple of switches on PQresultStatus() to add PGRES_COPY_BOTH support and stop assuming that unknown statuses received are errors; have those print diagnostics where warranted. Author: Noah Misch
2012-01-21psql: Add support for tab completion of GRANT/REVOKE rolePeter Eisentraut
Previously, only GRANT/REVOKE privilege was supported. reviewed by Pavel Stehule
2012-01-18Show psql timing output for failed queries as well as successful onesMagnus Hagander
This is useful for example when a long-runing statement such as CREATE INDEX fails after a long time.
2012-01-16psql: Fix memory leakPeter Eisentraut
The command \password username leaked memory.
2012-01-01Update copyright notices for year 2012.Bruce Momjian
2011-12-27Standardize treatment of strcmp() return valuePeter Eisentraut
Always compare the return value to 0, don't use cute tricks like if (!strcmp(...)).
2011-12-27Remove support for on_exit()Peter Eisentraut
All supported platforms support the C89 standard function atexit() (SunOS 4 probably being the last one not to), and supporting both makes the code clumsy.
2011-12-20Add support for privileges on typesPeter Eisentraut
This adds support for the more or less SQL-conforming USAGE privilege on types and domains. The intent is to be able restrict which users can create dependencies on types, which restricts the way in which owners can alter types. reviewed by Yeb Havinga
2011-12-19Allow CHECK constraints to be declared ONLYAlvaro Herrera
This makes them enforceable only on the parent table, not on children tables. This is useful in various situations, per discussion involving people bitten by the restrictive behavior introduced in 8.4. Message-Id: 8762mp93iw.fsf@comcast.net CAFaPBrSMMpubkGf4zcRL_YL-AERUbYF_-ZNNYfb3CVwwEqc9TQ@mail.gmail.com Authors: Nikhil Sontakke, Alex Hunsaker Reviewed by Robert Haas and myself
2011-12-07Remove spclocation field from pg_tablespaceMagnus Hagander
Instead, add a function pg_tablespace_location(oid) used to return the same information, and do this by reading the symbolic link. Doing it this way makes it possible to relocate a tablespace when the database is down by simply changing the symbolic link.
2011-12-04Add a \setenv command to psql.Andrew Dunstan
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.
2011-12-02psql: Make temporary editor files have .sql extensionPeter Eisentraut
This gives editors a better chance to treat these files as the SQL files that they are.
2011-11-15Don't elide blank lines when accumulating psql command history.Robert Haas
This can change the meaning of queries, if the blank line happens to occur in the middle of a quoted literal, as per complaint from Tomas Vondra. Back-patch to all supported branches.
2011-11-12Add psql expanded auto modePeter Eisentraut
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
2011-11-11Fix psql's \dd version check for operator families.Robert Haas
Report and patch by Josh Kupershmidt; comment revisions by me.
2011-11-10Throw nice error if server is too old to support psql's \ef or \sf command.Tom Lane
Previously, you'd get "function pg_catalog.pg_get_functiondef(integer) does not exist", which is at best rather unprofessional-looking. Back-patch to 8.4 where \ef was introduced. Josh Kupershmidt
2011-11-05Show statistics target for columns in \d+ on a tableMagnus Hagander
2011-11-05Make psql \d on a sequence show the table/column owning itMagnus Hagander
2011-11-04Add missing space in commentMagnus Hagander