summaryrefslogtreecommitdiff
path: root/src/bin/psql/command.c
AgeCommit message (Collapse)Author
2009-10-05Create an ALTER DEFAULT PRIVILEGES command, which allows users to adjustTom Lane
the privileges that will be applied to subsequently-created objects. Such adjustments are always per owning role, and can be restricted to objects created in particular schemas too. A notable benefit is that users can override the traditional default privilege settings, eg, the PUBLIC EXECUTE privilege traditionally granted by default for functions. Petr Jelinek
2009-09-13Write psql's ~/.psql_history file using history_truncate_file() andTom Lane
append_history(), if libreadline is new enough to have those functions (they seem to be present at least since 4.2; but libedit may not have them). This gives significantly saner behavior when two or more sessions overlap in their use of the history file; although having two sessions exit at just the same time is still perilous to your history. The behavior of \s remains unchanged, ie, overwrite whatever was there. Per bug #5052 from Marek Wójtowicz.
2009-06-118.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef listBruce Momjian
provided by Andrew.
2009-04-21Add agg/normal/trigger/window flags for psql \df and in \df output.Bruce Momjian
David Fetter
2009-03-25No period if it's not a sentencePeter Eisentraut
2009-02-26Add a -w/--no-password option that prevents all password prompts to allPeter Eisentraut
programs that have a -W/--password option. In passing, remove the ancient PSQL_ALWAYS_GET_PASSWORDS compile option.
2009-01-20Make psql \d and \dt consistent for system tables, i.e prevent \d fromBruce Momjian
showing system tables, make \dS pattern show system table details, and have \dtS show system and _user_ tables, to be consistent with other \d* commands.
2009-01-06This makes all the \dX commands (most importantly to most: \df) workBruce Momjian
like \dt does, in that it requires a \dXS to see system items. Greg Sabino Mullane
2009-01-01Update copyright for 2009.Bruce Momjian
2008-12-19SQL/MED catalog manipulation facilitiesPeter Eisentraut
This doesn't do any remote or external things yet, but it gives modules like plproxy and dblink a standardized and future-proof system for managing their connection information. Martin Pihlak and Peter Eisentraut
2008-11-21Fix a few more format argument warnings.Magnus Hagander
2008-11-11Make psql report "SSL connection (unknown cipher)" when libpq has setMagnus Hagander
up a SSL connection, but psql is compiled without support for it. Not a really realistic use-case, but the patch also cuts down on the number of places with #ifdef's...
2008-09-15Avoid compiler warning about variable used before assigned.Peter Eisentraut
2008-09-06Adjust psql's new \ef command to present an empty CREATE FUNCTION templateTom Lane
for editing if no function name is specified. This seems a much cleaner way to offer that functionality than the original patch had. In passing, de-clutter the error displays that are given for a bogus function-name argument, and standardize on "$function$" as the default delimiter for the function body. (The original coding would use the shortest possible dollar-quote delimiter, which seems to create unnecessarily high risk of later conflicts with the user-modified function body.)
2008-09-06Implement a psql command "\ef" to edit the definition of a function.Tom Lane
In support of that, create a backend function pg_get_functiondef(). The psql command is functional but maybe a bit rough around the edges... Abhijit Menon-Sen
2008-08-16Fix version warning bug in recently applied adjustments to psql startup.Bruce Momjian
Gregory Stark
2008-07-01Issue psql connection warnings on connection start and via \c, perBruce Momjian
observation by David Fetter.
2008-06-26Use SYSTEMQUOTE as concatentation to strings, rather than %s printfBruce Momjian
patterns, for clarity.
2008-06-11Add optional on/off argument to \timing.Heikki Linnakangas
David Fetter.
2008-05-14Move the "instr_time" typedef and associated macros into a new headerTom Lane
file portability/instr_time.h, and add a couple more macros to eliminate some abstraction leakage we formerly had. Also update psql to use this header instead of its own copy of nearly the same code. This commit in itself is just code cleanup and shouldn't change anything. It lays some groundwork for the upcoming function-stats patch, though.
2008-05-08Add psql '\pset format wrapped' mode to wrap output to screen width, orBruce Momjian
file/pipe output too if \pset columns' is set. Bryce Nesbitt
2008-05-02One-letter backslash commands now need a space before the first argument.Peter Eisentraut
This has been the only documented and encouraged syntax for a long time, and with extension facilities such as aliases being proposed, it is a good time to clean up the legacy syntax a bit. Author: Bernd Helmle <mailings@oopsware.de>
2008-01-01Update copyrights in source tree to 2008.Bruce Momjian
2007-12-11Remove the long-deprecated -u option from psql, since it does nothing veryTom Lane
useful and confuses people who think it is the same as -U. (Eventually we might want to re-introduce it as being an alias for -U, but that should not happen until the switch has actually not been there for a few releases.) Likewise in pg_dump and pg_restore. Per gripe from Robert Treat and subsequent discussion.
2007-12-09Fix up the PQconnectionUsedPassword mess: create a separateTom Lane
PQconnectionNeedsPassword function that tells the right thing for whether to prompt for a password, and improve PQconnectionUsedPassword so that it checks whether the password used by the connection was actually supplied as a connection argument, instead of coming from environment or a password file. Per bug report from Mark Cave-Ayland and subsequent discussion.
2007-11-15pgindent run for 8.3.Bruce Momjian
2007-10-13Fix the inadvertent libpq ABI breakage discovered by Martin Pitt: theTom Lane
renumbering of encoding IDs done between 8.2 and 8.3 turns out to break 8.2 initdb and psql if they are run with an 8.3beta1 libpq.so. For the moment we can rearrange the order of enum pg_enc to keep the same number for everything except PG_JOHAB, which isn't a problem since there are no direct references to it in the 8.2 programs anyway. (This does force initdb unfortunately.) Going forward, we want to fix things so that encoding IDs can be changed without an ABI break, and this commit includes the changes needed to allow libpq's encoding IDs to be treated as fully independent of the backend's. The main issue is that libpq clients should not include pg_wchar.h or otherwise assume they know the specific values of libpq's encoding IDs, since they might encounter version skew between pg_wchar.h and the libpq.so they are using. To fix, have libpq officially export functions needed for encoding name<=>ID conversion and validity checking; it was doing this anyway unofficially. It's still the case that we can't renumber backend encoding IDs until the next bump in libpq's major version number, since doing so will break the 8.2-era client programs. However the code is now prepared to avoid this type of problem in future. Note that initdb is no longer a libpq client: we just pull in the two source files we need directly. The patch also fixes a few places that were being sloppy about checking for an unrecognized encoding name.
2007-08-21Tsearch2 functionality migrates to core. The bulk of this work is byTom Lane
Oleg Bartunov and Teodor Sigaev, but I did a lot of editorializing, so anything that's broken is probably my fault. Documentation is nonexistent as yet, but let's land the patch so we can get some portability testing done.
2007-07-08Get rid of client-code dependencies on the exact text of the no-passwordTom Lane
error message, by using PQconnectionUsedPassword() instead. Someday we might be able to localize that error message, but not until this coding technique has disappeared everywhere.
2007-03-03Allow \pset and \x, \t to use boolean constants on/off, rather than justBruce Momjian
toggle. Chad Wagner
2007-02-23Add psql \prompt capability.Bruce Momjian
Chad Wagner
2007-01-05Update CVS HEAD for 2007 copyright. Back branches are typically notBruce Momjian
back-stamped for this.
2006-12-28fflush the \o file, if any, after each backslash command. We alreadyTom Lane
do this for ordinary SQL commands, so it seems consistent to do it for backslash commands too. Per gripe from Rajesh Kumar Mallah.
2006-12-16enable \timing oputput for \copy commandsAndrew Dunstan
2006-10-06Message style improvementsPeter Eisentraut
2006-10-04pgindent run for 8.2.Bruce Momjian
2006-08-29Invent an assign-hook mechanism for psql variables similar to the oneTom Lane
existing for backend GUC variables, and use this to eliminate repeated fetching/parsing of psql variables in psql's inner loops. In a trivial test with lots of 'select 1;' commands, psql's CPU time went down almost 10%, although of course the effect on total elapsed time was much less. Per discussion about how to ensure the upcoming FETCH_COUNT patch doesn't cost any performance when not being used.
2006-07-18Mark a few functions as static or NOT_USED.Bruce Momjian
2006-06-11Code review for psql multiline history patch(es). Fix memory leak,Tom Lane
failure to enter commands in history if canceled by control-C, other infelicities.
2006-06-07Prepare code to be built by MSVC:Bruce Momjian
o remove many WIN32_CLIENT_ONLY defines o add WIN32_ONLY_COMPILER define o add 3rd argument to open() for portability o add include/port/win32_msvc directory for system includes Magnus Hagander
2006-06-01Fix up hack to suppress escape_string_warning so that it actually worksTom Lane
and there's only one place that's a kluge, ie, appendStringLiteralConn. Note that pg_dump itself doesn't use appendStringLiteralConn, so its behavior is not affected; only the other utility programs care.
2006-05-31Escape processing patch:Bruce Momjian
o turns off escape_string_warning in pg_dumpall.c o optionally use E'' for \password (undocumented option?) o honor standard_conforming-strings for \copy (but not support literal E'' strings) o optionally use E'' for \d commands o turn off escape_string_warning for createdb, createuser, droplang
2006-04-02Rewrite much of psql's \connect code, for the sake of code clarity andNeil Conway
to fix regressions introduced in the recent patch adding additional \connect options. This is based on work by Volkan YAZICI, although this version of the patch doesn't bear much resemblance to Volkan's version. \connect takes 4 optional arguments: database name, user name, host name, and port number. If any of those parameters are omitted or specified as "-", the value of that parameter from the previous connection is used instead; if there is no previous connection, the libpq default is used. Note that this behavior makes it impossible to reuse the libpq defaults without quitting psql and restarting it; I don't really see the use case for needing to do that.
2006-03-21Fix psql history handling:Bruce Momjian
> 1) Fix the problems with the \s command. > When the saveHistory is executed by the \s command we must not do the > conversion \n -> \x01 (per > http://archives.postgresql.org/pgsql-hackers/2006-03/msg00317.php ) > > 2) Fix the handling of Ctrl+C > > Now when you do > wsdb=# select 'your long query here ' > wsdb-# > and press afterwards the CtrlC the line "select 'your long query here '" > will be in the history > > (partly per > http://archives.postgresql.org/pgsql-hackers/2006-03/msg00297.php ) > > 3) Fix the handling of commands with not closed brackets, quotes, double > quotes. (now those commands are not splitted in parts...) > > 4) Fix the behaviour when SINGLELINE mode is used. (before it was almost > broken ;( Sergey E. Koposov
2006-03-05Update copyright for 2006. Update scripts.Bruce Momjian
2006-03-04Use DEVTTY as 'con' on Win32 as a replacement for /dev/tty.Bruce Momjian
2006-03-03Avoid trying to open /dev/tty on Win32. Some Win32 systems haveBruce Momjian
/dev/tty, but it isn't a device file and doesn't work as expected. This fixes a known bug where psql does not prompt for a password on some Win32 systems. Backpatch to 8.1.X. Robert Kinberg
2006-02-12Add psql option:Bruce Momjian
-1 or --single-transaction Simon Riggs
2006-02-12I've created a new shared catalog table pg_shdescription to storeBruce Momjian
comments on cluster global objects like databases, tablespaces, and roles. It touches a lot of places, but not much in the way of big changes. The only design decision I made was to duplicate the query and manipulation functions rather than to try and have them handle both shared and local comments. I believe this is simpler for the code and not an issue for callers because they know what type of object they are dealing with. This has resulted in a shobj_description function analagous to obj_description and backend functions [Create/Delete]SharedComments mirroring the existing [Create/Delete]Comments functions. pg_shdescription.h goes into src/include/catalog/ Kris Jurka
2006-02-12Please find enclosed a patch that lets you use \c to connectBruce Momjian
(optionally) to a new host and port without exiting psql. This eliminates, IMHO, a surprise in that you can now connect to PostgreSQL on a differnt machine from the one where you started your session. This should help people who use psql as an administrative tool. David Fetter