Commit Graph

257 Commits

Author SHA1 Message Date
Bruce Momjian 4cb27fef0a o Improve psql's handling of multi-line statements
Currently, while \e saves a single statement as one entry, interactive
	statements are saved one line at a time.  Ideally all statements
	would be saved like \e does.

Sergey E. Koposov
2006-02-11 21:55:35 +00:00
Bruce Momjian 1dc3498251 Standard pgindent run for 8.1. 2005-10-15 02:49:52 +00:00
Bruce Momjian 507465525e \pset numericsep -> numericlocale. 2005-07-18 20:57:53 +00:00
Bruce Momjian 73a7c322c3 Add psql \pset numericsep to allow output numbers like 100,000.0 or
100.000,0.

Eugen Nedelcu
2005-07-10 03:46:13 +00:00
Bruce Momjian c3a69c3b3b Attached is a patch that enhances the "\h" capability in psql. I often
find myself typing a command and then wanting to get the syntax for it.
So I do a ctrl-a and add a \h: but psql does not recognize the command,
because I have stuff attached to it (e.g. "alter table foobar"), so I
have to scroll over and delete everything except the name of the command
itself. This patch gives \h three chances to match: if nothing matches
the complete string (current behavior), it tries to match the first two
words (e.g. "ALTER TABLE"). If that fails, it tries to match the first
word (e.g. "DELETE").

Greg Sabino Mullane
2005-07-06 03:14:48 +00:00
Bruce Momjian 2ee0d5549f Add -L option to psql to log sessions.
Lorne Sunley
2005-06-14 02:57:45 +00:00
Bruce Momjian 0542b1e2fe Use _() macro consistently rather than gettext(). Add translation
macros around strings that were missing them.
2005-02-22 04:43:23 +00:00
Tom Lane 8afe005f42 Consistently use geteuid() not getuid(); there were a few places deviating
from our long-established standard.
2005-01-08 22:51:15 +00:00
Bruce Momjian 2daed8c5b3 Update copyrights that were missed. 2005-01-01 05:43:09 +00:00
PostgreSQL Daemon 2ff501590b Tag appropriate files for rc3
Also performed an initial run through of upgrading our Copyright date to
extend to 2005 ... first run here was very simple ... change everything
where: grep 1996-2004 && the word 'Copyright' ... scanned through the
generated list with 'less' first, and after, to make sure that I only
picked up the right entries ...
2004-12-31 22:04:05 +00:00
Neil Conway e17766c12e Trivial fix for a bug introduced in r1.94 of help.c: we want to only
include "\s" in \? output when readline is enabled, but that commit
supressed "\s" whether readline was enabled or not.
2004-11-24 04:58:42 +00:00
Peter Eisentraut 7d8578a0c2 Clarify some strings 2004-11-09 14:39:44 +00:00
Peter Eisentraut 0fd37839d9 Message style revisions 2004-10-12 21:54:45 +00:00
Bruce Momjian c62a5465fb Suppress psql \s help display for platforms like Win32 that don't
typically install witn readline, and throw an error if they try to
access it.
2004-10-06 18:39:16 +00:00
Bruce Momjian b6b71b85bc Pgindent run for 8.0. 2004-08-29 05:07:03 +00:00
Bruce Momjian da9a8649d8 Update copyright to 2004. 2004-08-29 04:13:13 +00:00
Bruce Momjian 21d16121bf Ignore trailing spaces in psql \h.
Greg Sabino Mullane
2004-08-07 03:36:07 +00:00
Bruce Momjian 93a1fce5cc Add permission display to \db+. 2004-07-15 03:56:06 +00:00
Bruce Momjian bbcee544aa Have \dn+ show permissions and description for schemas.
Dennis Bjorklund
2004-07-13 16:48:16 +00:00
Tom Lane 2467394ee1 Tablespaces. Alternate database locations are dead, long live tablespaces.
There are various things left to do: contrib dbsize and oid2name modules
need work, and so does the documentation.  Also someone should think about
COMMENT ON TABLESPACE and maybe RENAME TABLESPACE.  Also initlocation is
dead, it just doesn't know it yet.

Gavin Sherry and Tom Lane.
2004-06-18 06:14:31 +00:00
Tom Lane 0bd61548ab Solve the 'Turkish problem' with undesirable locale behavior for case
conversion of basic ASCII letters.  Remove all uses of strcasecmp and
strncasecmp in favor of new functions pg_strcasecmp and pg_strncasecmp;
remove most but not all direct uses of toupper and tolower in favor of
pg_toupper and pg_tolower.  These functions use the same notions of
case folding already developed for identifier case conversion.  I left
the straight locale-based folding in place for situations where we are
just manipulating user data and not trying to match it to built-in
strings --- for example, the SQL upper() function is still locale
dependent.  Perhaps this will prove not to be what's wanted, but at
the moment we can initdb and pass regression tests in Turkish locale.
2004-05-07 00:24:59 +00:00
Bruce Momjian 3ceda5eab3 I just noticed that \dp outputs "Table" to indicate relations (tables,
sequences and views).  This patch allows it to handle views and
sequences.

Euler Taveira de Oliveira
2004-03-22 03:38:24 +00:00
Bruce Momjian 5c0d0a2399 Have psql help show \w parameter as requied. 2004-01-09 21:15:51 +00:00
Bruce Momjian 8c4af96fb0 This makes help like this:
\lo_export LOBOID FILE
   \lo_import FILE [COMMENT]
   \lo_list
   \lo_unlink LOBOID    large object operations

Instead of not saying anything about what arguments are required.

Christopher Kings-Lynne
2003-12-01 22:34:48 +00:00
Bruce Momjian 8bb60b6423 attached is a patch that adds display of the groups a user belongs to to
\du and a \dg command to psql. It's against 7.4beta5.

Markus Bertheau <twanger@bluetwanger.de>
2003-12-01 22:21:54 +00:00
PostgreSQL Daemon 969685ad44 $Header: -> $PostgreSQL Changes ... 2003-11-29 19:52:15 +00:00
Peter Eisentraut d938e8b0f4 Add documentation about \pset footer to \?.
from Patrick Welche
2003-10-02 06:39:31 +00:00
Peter Eisentraut 20aaf64252 Allow translation of SQL help in psql. 2003-09-14 22:37:13 +00:00
Bruce Momjian d768cb267b seemed like a typo in one of the appendix tables
Robert Treat
2003-09-11 16:22:42 +00:00
Bruce Momjian d6a9b4e0b5 Update row count for \? output, used by pager. 2003-09-10 21:35:55 +00:00
Tom Lane 2f9c859ea1 Fix some copyright notices that weren't updated. Improve copyright tool
so it won't miss 'em again.
2003-08-04 23:59:41 +00:00
Bruce Momjian 089003fb46 pgindent run. 2003-08-04 00:43:34 +00:00
Bruce Momjian ad73f6b86f Update copyrights to 2003.
print.c: Add one more line to pager calculation to account for the prompt.
help.c: Call PageOutput with correct number of lines within slashUsage
        Add one to line count in helpSQL to account for "Available help:" line.
        Make copyright match COPYRIGHT file. (Just "1994")

Greg Sabino Mullane
2003-07-25 21:48:45 +00:00
Peter Eisentraut c154fc3a20 Apply message style guide to frontend programs. 2003-07-23 08:47:41 +00:00
Bruce Momjian 8de72414ea Document the -h client flag can use a socket directory as well as a host
name.
2003-06-11 05:13:12 +00:00
Bruce Momjian 6bfa2df64e Document file name as optional for \o in psql help (\h). 2003-04-14 16:23:36 +00:00
Peter Eisentraut cf1cf89649 Make the printing code somewhat more independent by not relying on
functions and global variables from the rest of psql.  Also clean up some
data type mismatches created by the last pager patch.
2003-03-18 22:15:44 +00:00
Bruce Momjian 51b2b6433b Cleanup up psql \connect and \pset pager setting display, Dennis
Bj?rklund.
2003-03-10 15:46:03 +00:00
Tom Lane b4b62cff93 Apply the proper version of Christopher Kings-Lynne's describe patch
(ie, the one with describe-schema support).  Minor code review.
Adjust display of casts to use standard type names.
2003-01-07 20:56:07 +00:00
Bruce Momjian 29cdab3d53 Increment libpq major number for 7.3.1 and minor for 7.4. 2002-12-13 22:17:57 +00:00
Bruce Momjian 40c4472e22 TODO marked as done:
* Add schema, cast, and conversion backslash commands to psql

I had to create a new publically available function,
pg_conversion_is_visible, as it seemed to be missing from the catalogs.
This required me to do no small amount of hacking around in namespace.c

I have updated the \? help and sgml docs.

\dc - list conversions [PATTERN]
\dC - list casts
\dn list schemas

I didn't support patterns with casts as there's nothing obvious to match
against.

Catalog version incremented --- initdb required.

Christopher Kings-Lynne
2002-12-12 21:02:25 +00:00
Bruce Momjian b7ebebea1e Move psql \? Formatting above Large Object/Copy. 2002-12-11 23:07:06 +00:00
Bruce Momjian c4a7e5dd9f psql \? rearrangement, suggested by Tom. 2002-12-11 23:03:45 +00:00
Bruce Momjian 721dd19212 Reorder psql \? help into groupings, idea from Harald Armin Massa. 2002-12-11 22:45:13 +00:00
Bruce Momjian 0046d80b97 Back out psql help change. Not done yet. 2002-12-11 04:09:51 +00:00
Bruce Momjian 6ca16d7b80 Bump version for 7.3 and 7.4. 2002-12-11 04:07:39 +00:00
Bruce Momjian b26dfbb0e3 Here is a patch that does just that, while maintaining the
"traditional" behavior, so the change should be transparent. Use the
command "\pset pager always" to turn it on. Anything else does the
normal toggle between "on" and "off"

Greg Sabino Mullane
2002-11-08 19:12:21 +00:00
Bruce Momjian b093f8825d Fix include files for new PageOutput call. 2002-10-24 01:33:50 +00:00
Bruce Momjian 641b658c26 Page \h output and centralize psql paging code in PageOutput(). 2002-10-23 19:23:57 +00:00
Peter Eisentraut 4cff161703 Improve formatting of --help output. 2002-10-18 22:05:36 +00:00
Peter Eisentraut 2972fd5d83 Translation updates, some messages tweaked. 2002-09-22 20:57:21 +00:00
Bruce Momjian e50f52a074 pgindent run. 2002-09-04 20:31:48 +00:00
Bruce Momjian 6deb649cd3 Add '+' mention in \? help. More clean of \? to do. 2002-08-27 18:28:29 +00:00
Tom Lane 8be9bd83ac psql prints its version number in its startup message, per recent
discussion.  Also, cause the \timing command to display time in a
format consistent with the backend's EXPLAIN ANALYZE output.
2002-08-10 19:35:01 +00:00
Peter Eisentraut 029aa97f2d Make sure all clients have the same understanding of default user name
and database.  In particular, make script wrappers understand the
PGDATABASE environment variable.
2002-08-10 16:57:32 +00:00
Bruce Momjian 91dfa1af97 Fix \? and \pset pager handling. \? wasn't honoring pager before. 2002-07-15 01:56:25 +00:00
Bruce Momjian d84fe82230 Update copyright to 2002. 2002-06-20 20:29:54 +00:00
Bruce Momjian 714f7859d8 psql \? cleanups by Ian Barwick 2002-03-19 03:01:01 +00:00
Bruce Momjian a7ade2bb6b Add psql \dD listing of domains, from Jonathan Eisler. 2002-03-19 02:32:21 +00:00
Bruce Momjian 66b6bf67a1 More pgsql \? cleanup for Peter E. 2002-03-11 18:26:20 +00:00
Bruce Momjian 560a2c017c Correct optional args in psql \? as pointed out by Ian Barwick. 2002-03-11 18:22:03 +00:00
Bruce Momjian 7d1b8fe716 Back out psql domain improvements until domain is applied. 2002-03-07 17:54:42 +00:00
Bruce Momjian c666d6fd41 Here is a diff of changes to the psql source code implementing a simple
'list domains' command '\dD'. This is the interface component of
rbt@zort.ca's domain backend modifications.

Jonathan Eisler
2002-03-06 20:39:45 +00:00
Bruce Momjian ed5eb09cce Adds \du documentation line for \? in psqls help.c
Thought I saw a patch earlier converting docs to use []s, so this uses
them.

Rod Taylor
2002-03-05 06:13:19 +00:00
Bruce Momjian 25b0b09fd3 Add \timing patch to psql. Times all queries.
Greg Sabino Mullane
2002-03-05 00:01:03 +00:00
Bruce Momjian b81844b173 pgindent run on all C files. Java run to follow. initdb/regression
tests pass.
2001-10-25 05:50:21 +00:00
Peter Eisentraut 05150e2df3 Add French psql translation. (My rendition of French anyway...)
Fix typo in message.
2001-06-11 18:23:33 +00:00
Peter Eisentraut 0acd843c05 Finish German translation, edit (original) messages a bit. 2001-06-08 23:53:48 +00:00
Peter Eisentraut e542036461 Native Language Support (NLS)
Use --enable-nls to turn it on; see installation instructions for details.
See developer's guide how to make use of it in programs and how to add
translations.

psql sources have been almost fully prepared and an incomplete German
translation has been provided.  In the backend, only elog() calls are
currently translatable, and the provided German translation file is more
of a placeholder.
2001-06-02 18:25:18 +00:00
Peter Eisentraut 232724af0d Add \cd command to psql. 2001-05-07 19:31:33 +00:00
Bruce Momjian 9e1552607a pgindent run. Make it all clean. 2001-03-22 04:01:46 +00:00
Tom Lane d08741eab5 Restructure the key include files per recent pghackers discussion: there
are now separate files "postgres.h" and "postgres_fe.h", which are meant
to be the primary include files for backend .c files and frontend .c files
respectively.  By default, only include files meant for frontend use are
installed into the installation include directory.  There is a new make
target 'make install-all-headers' that adds the whole content of the
src/include tree to the installed fileset, for use by people who want to
develop server-side code without keeping the complete source tree on hand.
Cleaned up a whole lot of crufty and inconsistent header inclusions.
2001-02-10 02:31:31 +00:00
Bruce Momjian 623bf843d2 Change Copyright from PostgreSQL, Inc to PostgreSQL Global Development Group. 2001-01-24 19:43:33 +00:00
Bruce Momjian ebd61ac03f Remove -k unix socketpath option from client side, allow hostname with
leading slash to behave as a unix socket path.
2000-11-13 23:37:54 +00:00
Bruce Momjian 2150c2edf1 UUNET is looking into offering PostgreSQL as a part of a managed web
hosting product, on both shared and dedicated machines.  We currently
offer Oracle and MySQL, and it would be a nice middle-ground.
However, as shipped, PostgreSQL lacks the following features we need
that MySQL has:

1. The ability to listen only on a particular IP address.  Each
   hosting customer has their own IP address, on which all of their
   servers (http, ftp, real media, etc.) run.
2. The ability to place the Unix-domain socket in a mode 700 directory.
   This allows us to automatically create an empty database, with an
   empty DBA password, for new or upgrading customers without having
   to interactively set a DBA password and communicate it to (or from)
   the customer.  This in turn cuts down our install and upgrade times.
3. The ability to connect to the Unix-domain socket from within a
   change-rooted environment.  We run CGI programs chrooted to the
   user's home directory, which is another reason why we need to be
   able to specify where the Unix-domain socket is, instead of /tmp.
4. The ability to, if run as root, open a pid file in /var/run as
   root, and then setuid to the desired user.  (mysqld -u can almost
   do this; I had to patch it, too).

The patch below fixes problem 1-3.  I plan to address #4, also, but
haven't done so yet.  These diffs are big enough that they should give
the PG development team something to think about in the meantime :-)
Also, I'm about to leave for 2 weeks' vacation, so I thought I'd get
out what I have, which works (for the problems it tackles), now.

With these changes, we can set up and run PostgreSQL with scripts the
same way we can with apache or proftpd or mysql.

In summary, this patch makes the following enhancements:

1. Adds an environment variable PGUNIXSOCKET, analogous to MYSQL_UNIX_PORT,
   and command line options -k --unix-socket to the relevant programs.
2. Adds a -h option to postmaster to set the hostname or IP address to
   listen on instead of the default INADDR_ANY.
3. Extends some library interfaces to support the above.
4. Fixes a few memory leaks in PQconnectdb().

The default behavior is unchanged from stock 7.0.2; if you don't use
any of these new features, they don't change the operation.

David J. MacKenzie
2000-11-13 15:18:15 +00:00
Peter Eisentraut 27777b6645 Don't free() the result of getpwuid().
Discovered by Jason Tishler <Jason.Tishler@dothill.com>.
2000-09-22 23:02:00 +00:00
Bruce Momjian be6e7717db Fix \h SELECT to not show SELECT INTO. 2000-05-26 15:47:18 +00:00
Peter Eisentraut 9d31e3a991 /home/peter/commit-msg 2000-05-12 16:13:44 +00:00
Bruce Momjian 7da0f5d7de More psql help cleanup 2000-05-11 18:41:00 +00:00
Bruce Momjian 0fbde5d928 Add options and cleanup psql \? and -? help displays 2000-05-11 01:37:54 +00:00
Bruce Momjian 5a75ad5573 Update psql \? to show file rather than "fname". 2000-05-09 19:08:36 +00:00
Bruce Momjian 297e7f3ef4 Fix \h to not go past array bounds 2000-04-24 22:41:43 +00:00
Bruce Momjian 52f77df613 Ye-old pgindent run. Same 4-space tabs. 2000-04-12 17:17:23 +00:00
Peter Eisentraut 8de482a847 Added configure test for readline's filename_completion_function
Completed psql's \? help
2000-03-05 13:30:20 +00:00
Peter Eisentraut c75adac757 More fixes for psql ^C handling, especially during copy. Still doesn't
cope so well with copy to but that will have to wait for the next release.

Also added -X option to prevent reading .psqlrc startup file.
2000-03-01 21:10:05 +00:00
Peter Eisentraut 718bb2cc9c Moved psql \eset and \eshow to \encoding
Improved psql's Ctrl-C handling
Fixed configure test for sigsetjmp that now even recognizes it if it's a macro
2000-02-20 14:28:28 +00:00
Tom Lane e79b2dd5e7 Fix missing \n in some psql_error calls. 2000-02-20 02:37:40 +00:00
Tatsuo Ishii eb089e7f76 Add new backslash command \eset and \eshow. 2000-02-19 05:01:16 +00:00
Bruce Momjian 78693c89d7 Clean up include files use in psql. 2000-02-16 13:15:26 +00:00
Peter Eisentraut 9672d38f91 Adjusted psql echoing options (-a and -e) 2000-02-13 21:45:15 +00:00
Peter Eisentraut 2fb0ff0c5b Default argument for createdb
Changed EXIT_ON_ERROR to ON_ERROR_STOP in psql
2000-02-10 20:08:58 +00:00
Peter Eisentraut 9ceb5d8a7b Fixed psql double quoting of SQL ids
Fixed libpq printing functions
2000-02-07 23:10:11 +00:00
Peter Eisentraut 2b84cbb60f A few minor psql enhancements
Initdb help correction
Changed end/abort to commit/rollback and changed related notices
Commented out way old printing functions in libpq
Fixed a typo in alter table / alter column
2000-01-29 16:58:54 +00:00
Bruce Momjian 2d5dd7557b Update files. 2000-01-26 16:10:01 +00:00
Bruce Momjian 5c25d60244 Add:
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc

to all files copyright Regents of Berkeley.  Man, that's a lot of files.
2000-01-26 05:58:53 +00:00
Peter Eisentraut 65e0051843 another round of user interface cleanups
removed pg_id
fixed a few bugs in the scripts
2000-01-19 20:08:36 +00:00
Peter Eisentraut f565cf41ab another set of cleanups 2000-01-18 23:30:24 +00:00
Bruce Momjian 0cb6bc70ce Hi!
Here is a patch to bring both libpq and psql to a state where it compiles on
win32 (native) again. A lot of things have changed, and I have not been able
to keep up with them all, so it has been broken for quite a while.
After this patch, at least it compiles. It also talks "basic talk" to the
server, but I have not yet tested all things. Sending queries, and using
e.g. \d or \dt works fine. The rest will have to be tested further.
It also bumps the version on libpq.dll to 7.0.

Everything should be enclosed in #ifdef WIN32, unless I have missed
something. Except for one or maybe two places where I have moved a #include
that should not be used on win32 from the "global area" into a "#ifndef
WIN32 area".


//Magnus
2000-01-18 19:05:31 +00:00
Peter Eisentraut 7c9390caa1 Fixed psql variables vs array syntax, as well as minor psql enhancements 2000-01-14 22:18:03 +00:00
Peter Eisentraut f6689a328f Fixed a few "fixes" and bugs. Adjusted messages and options to GNU suggestions. 2000-01-12 19:36:36 +00:00
Bruce Momjian 78bc83fedf * Includes tab completion. It's not magic, but it's very cool. At any
rate
  it's better than what used to be there.

* Does proper SQL "host variable" substitution as pointed out by Andreas
  Zeugwetter (thanks): select * from :foo; Also some changes in how ':'
  and ';' are treated (escape with \ to send to backend). This does
_not_
  affect the '::' cast operator, but perhaps others that contain : or ;
  (but there are none right now).

* To show description with a <something> listing, append '?' to command
  name, e.g., \df?. This seemed to be the convenient and logical
solution.
  Or append a '+' to see more useless information, e.g., \df+.

* Fixed fflush()'ing bug pointed out by Jan during the regression test
  discussion.

* Added LastOid variable. This ought to take care of TODO item "Add a
  function to return the last inserted oid, for use in psql scripts"
  (under CLIENTS)
  E.g.,
insert into foo values(...);
insert into bar values(..., :LastOid);
\echo $LastOid

* \d command shows constraints, rules, and triggers defined on the table
  (in addition to indices)

* Various fixes, optimizations, corrections

* Documentation update as well


Note: This now requires snprintf(), which, if necessary, is taken from
src/backend/port. This is certainly a little weird, but it should
suffice
until a source tree cleanup is done.

Enjoy.

--
Peter Eisentraut                  Sernanders väg 10:115
1999-11-26 04:24:17 +00:00
Bruce Momjian c6c60302ba Cleanup of psql \copyright 1999-11-10 01:22:37 +00:00
Bruce Momjian 3d1db6ddc6 Update \? display. 1999-11-05 02:12:59 +00:00
Bruce Momjian f0a45ccd0a Clean up \? psql display. 1999-11-05 01:25:39 +00:00
Bruce Momjian dc16399d8d Update to psql, run pgindent. 1999-11-04 23:17:33 +00:00
Bruce Momjian 0e6652e673 psql cleanup 1999-11-04 23:14:30 +00:00
Bruce Momjian a45195a191 Major psql overhaul by Peter Eisentraut. 1999-11-04 21:56:02 +00:00