Commit Graph

267 Commits

Author SHA1 Message Date
Tom Lane 637028afe1 Code review for standard_conforming_strings patch. Fix it so it does not
throw warnings for 100%-SQL-standard constructs, clean up some minor
infelicities, try to un-break ecpg to the best of my ability.  (It's not clear
how ecpg is going to find out the setting of standard_conforming_strings,
though.)  I think pg_dump still needs work, too.
2006-05-11 19:15:36 +00:00
Tom Lane 20ab467d76 Improve parser so that we can show an error cursor position for errors
during parse analysis, not only errors detected in the flex/bison stages.
This is per my earlier proposal.  This commit includes all the basic
infrastructure, but locations are only tracked and reported for errors
involving column references, function calls, and operators.  More could
be done later but this seems like a good set to start with.  I've also
moved the ReportSyntaxErrorPosition logic out of psql and into libpq,
which should make it available to more people --- even within psql this
is an improvement because warnings weren't handled by ReportSyntaxErrorPosition.
2006-03-14 22:48:25 +00:00
Bruce Momjian 19c21d115d Enable standard_conforming_strings to be turned on.
Kevin Grittner
2006-03-06 19:49:20 +00:00
Bruce Momjian f2f5b05655 Update copyright for 2006. Update scripts. 2006-03-05 15:59:11 +00:00
Tom Lane decdaf3592 Improve pg_dump and psql to use libpq's newer COPY support routines,
instead of the old deprecated ones.
Volkan Yazici, with some editorializing by moi.
2006-03-03 23:38:30 +00:00
Tom Lane 6c0d4aabe2 Fix more fallout from line-wrap patch, to wit, arbitrarily changing
the API of PQdsplen without bothering to fix its callers.  Although
ReportSyntaxErrorPosition could probably do with more smarts about
handling control characters, for the moment I'll just get it back to
handling tabs consistently.
2006-02-12 03:30:21 +00:00
Bruce Momjian 436a2956d8 Re-run pgindent, fixing a problem where comment lines after a blank
comment line where output as too long, and update typedefs for /lib
directory.  Also fix case where identifiers were used as variable names
in the backend, but as typedefs in ecpg (favor the backend for
indenting).

Backpatch to 8.1.X.
2005-11-22 18:17:34 +00:00
Tom Lane af331e2526 Ensure that we only create one ConsoleCtrlHandler per psql process,
so as to avoid performance issues and possible ultimate crash on long
psql scripts.  Per Merlin Moncure.
2005-11-04 18:35:40 +00:00
Bruce Momjian 3332e38189 Disable expanded mode only for \d tablename, not for all backslash
commands.  Per complaint that \df+ is clearer in expanded mode.
2005-10-27 13:34:47 +00:00
Bruce Momjian 1dc3498251 Standard pgindent run for 8.1. 2005-10-15 02:49:52 +00:00
Bruce Momjian 8ac386226d The patch updates the documentation to reflect the fact that higher values
of client_min_messages (fatal + panic) are valid and also fixes a slight
issue with how psql tried to display error messages that aren't sent to
the client.

We often tell people to ignore errors in response to requests for things
like "drop if exists", but there's no good way to completely hide this
without upping client_min_messages past ERROR.  When running a file like

SET client_min_messages TO 'FATAL';

DROP TABLE doesntexist;

with "psql -f filename" you get an error prefix of
"psql:/home/username/filename:3" even though there is no error message to
prefix because it isn't sent to the client.

Kris Jurka
2005-10-13 20:58:42 +00:00
Peter Eisentraut a8da71e0c4 Clean up some messages and fix missing translation support. Option --log
renamed to --log-file for clarity.
2005-10-04 19:01:18 +00:00
Bruce Momjian 99bb9c551e Fix interaction between psql \set AUTOCOMMIT and "ON_ERROR_ROLLBACK"
by properly updating transaction state after AUTOCOMMIT.
2005-09-20 21:43:08 +00:00
Tom Lane 4cc7a93d22 Make REINDEX DATABASE do what one would expect, namely reindex all indexes
in the database.  The old behavior (reindex system catalogs only) is now
available as REINDEX SYSTEM.  I did not add the complementary REINDEX USER
case since there did not seem to be consensus for this, but it would be
trivial to add later.  Per recent discussions.
2005-06-22 21:14:31 +00:00
Tom Lane d0a89683a3 Two-phase commit. Original patch by Heikki Linnakangas, with additional
hacking by Alvaro Herrera and Tom Lane.
2005-06-17 22:32:51 +00:00
Bruce Momjian 2ee0d5549f Add -L option to psql to log sessions.
Lorne Sunley
2005-06-14 02:57:45 +00:00
Neil Conway 077811605e Per discussion on -hackers, this patch changes psql's "expanded" output
mode to only affect the presentation of normal query results, not the
output of psql slash commands. Documentation updated. I also made
some unrelated minor psql cleanup. Per suggestion from Stuart Cooper.
2005-06-13 06:36:22 +00:00
Bruce Momjian 92eadf6c4a More Win32 tilde code comments. 2005-06-10 14:49:31 +00:00
Bruce Momjian 3d44763179 Add comment on tilde expansion. 2005-06-10 14:41:32 +00:00
Bruce Momjian 3e8dbc846c Support only octal for psql PROMPT values, rather than the confusing
hex/decimal/octal.  Documentation already updated.

BACKWARD COMPATIBLE CHANGE
2005-05-30 18:28:11 +00:00
Bruce Momjian a65b1b738c Add psql \set ON_ERROR_ROLLBACK to allow statements in a transaction to
error without affecting the entire transaction.  Valid values are
"on|interactive|off".
2005-04-28 13:09:59 +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
Bruce Momjian 2daed8c5b3 Update copyrights that were missed. 2005-01-01 05:43:09 +00:00
Bruce Momjian 7fad5fff0d That's just the lovely way windows handles a "segfault". Gotta be really
interesting for MS to catch all those dumps...

Anyway. Oops. Seems I ran my regression tests with the old psql, and
just managed to update the backend, when I tested that patch. Turns out
there are codepaths where we'd access the Critical Section before it was
initialized. Attached patch breaks the initializeation off to a separate
part and adds that one to a much earlier position in the program.

Magnus Hagander
2004-11-01 19:21:50 +00:00
Tom Lane 44e8a968e3 Invent a new, more thread-safe version of PQrequestCancel, called PQcancel.
Use this new function in psql.  Implement query cancellation in psql for
Windows.  Code by Magnus Hagander, documentation and minor editorialization
by Tom Lane.
2004-10-30 23:11:27 +00:00
Neil Conway 0e72b9d440 Cosmetic improvements/code cleanup:
- replace some function signatures of the form "some_type foo()" with
"some_type foo(void)"
- replace a few instances of a literal 0 being used as a NULL pointer;
there are more instances of this in the code, but I just fixed a few
- in src/backend/utils/mb/wstrncmp.c, replace K&R style function
declarations with ANSI style, remove use of 'register' keyword
- remove an "extern" modifier that was applied to a function definition
(rather than a declaration)
2004-10-10 23:37:45 +00:00
Tom Lane 5b564e5307 Fix some shortcomings in psql's autocommit-off mode concerning detection
of commands for which a transaction block should not be forced.  Recognize
VACUUM and other PreventTransactionChain commands; handle nested /* .. */
comments correctly; handle multibyte encodings correctly.
Michael Paesold with some kibitzing from Tom Lane.
2004-09-20 18:51:19 +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 1abf13db3c Add get_home_path() to use USERPROFILE on Win32 and HOME on Unix. 2004-08-18 02:59:12 +00:00
Neil Conway 256d4639c9 A few cosmetic fixes and code cleanup. 2004-05-23 22:20:10 +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
Tom Lane f938c2b91b Revise syntax-error reporting behavior to give pleasant results for
errors in internally-generated queries, such as those submitted by
plpgsql functions.  Per recent discussions with Fabien Coelho.
2004-03-21 22:29:11 +00:00
Tatsuo Ishii e8c3205037 Add PQmbdsplen() which returns the "display length" of a character.
Still some works needed:
- UTF-8, MULE_INTERNAL always returns 1
2004-03-15 10:41:26 +00:00
Tom Lane 7665d1bc16 Teach psql to show the location of syntax errors visually, per recent
discussions.  Patch by Fabien Coelho and Tom Lane.  Still needs to be
taught about multi-screen-column kanji characters; Tatsuo has promised
to provide the needed infrastructure for that.
2004-03-14 04:25:18 +00:00
Neil Conway e10bb0518a More fallout from the recent psql patch: rename xmalloc and friends to
pg_malloc, to avoid linker failures on same platforms.
2004-01-25 03:07:22 +00:00
Neil Conway 610d33c194 This patch makes some of the memory manipulation performed by psql a
little more sane. Some parts of the code was using a static function
xmalloc() that did safe memory allocation (where "safe" means "bail
out on OOM"), but most of it was just invoking calloc() or malloc()
directly. Now almost everything invokes xmalloc() or xcalloc().
2004-01-24 19:38:49 +00:00
Tom Lane 04cc4e18dd Implement '\copy from -' to support reading copy data from the same
source the \copy came from.  Also, fix prompting logic so that initial
and per-line prompts appear for all cases of reading from an interactive
terminal.  Patch by Mark Feit, with some kibitzing by Tom Lane.
2004-01-20 23:48:56 +00:00
Bruce Momjian 55a92063a7 Allow psql to handle tilde user expansion for file names.
Zach Irmen
2004-01-09 21:12:20 +00:00
PostgreSQL Daemon 969685ad44 $Header: -> $PostgreSQL Changes ... 2003-11-29 19:52:15 +00:00
Tom Lane 27e8ef0535 AcceptResult() was missing a case for PGRES_EMPTY_QUERY --- probably
my fault.  Adding it fixes bogus message display when reading a block
comment at the end of a script file.
2003-11-12 22:53:16 +00:00
Tom Lane 351adb8dfb Fix order of operations within SendQuery() so that the time spent in
data transfer during COPY is included in the \timing display.  Also
avoid portability problems if tv_usec is unsigned on some platform.
2003-10-06 01:11:12 +00:00
Bruce Momjian 22347dc102 Make psql \timing show three digits. 2003-10-05 22:36:00 +00:00
Tom Lane 7e06dbe1c2 Make psql correctly track the effects of SET CLIENT_ENCODING commands.
I thought I'd fixed this earlier, but I didn't get it right ...
2003-09-16 17:59:02 +00:00
Peter Eisentraut 29a20145fd Pass session_authorization to the client and make psql update its prompt
accordingly.
2003-09-03 22:05:09 +00:00
Tom Lane dbb4dd29e9 Remove unnecessary #include's (see c.h). 2003-08-14 18:48:35 +00:00
Bruce Momjian 46785776c4 Another pgindent run with updated typedefs. 2003-08-08 21:42:59 +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
Tom Lane 17d6721e0b Must print server's failure message before trying reconnect, not after. 2003-08-04 19:10:40 +00:00
Bruce Momjian 089003fb46 pgindent run. 2003-08-04 00:43:34 +00:00
Bruce Momjian f766b376f1 Add fflush of stdout when outputing query. 2003-07-31 04:23:40 +00:00
Peter Eisentraut c154fc3a20 Apply message style guide to frontend programs. 2003-07-23 08:47:41 +00:00
Tom Lane f9ebf36970 Update psql for some features of new FE/BE protocol. There is a
client-side AUTOCOMMIT mode now: '\set AUTOCOMMIT off' supports
SQL-spec commit behavior.  Get rid of LO_TRANSACTION hack --- the
LO operations just work now, using libpq's ability to track the
transaction status.  Add a VERBOSE variable to control verboseness
of error message display, and add a %T prompt-string code to show
current transaction-block status.  Superuser state display in the
prompt string correctly follows SET SESSION AUTHORIZATION commands.
Control-C works to get out of COPY IN state.
2003-06-28 00:12:40 +00:00
Bruce Momjian b14295cfe4 Attached is the complete diff against current CVS.
Compiles on BCC 5.5 and VC++ 6.0 (with warnings).

Karl Waclawek
2003-06-12 08:15:29 +00:00
Bruce Momjian ef2ba42717 Attached is a patch that enhances the output of psql's HTML mode.
The output now validates as HTML 4.01 Strict, XHTML 1.0 strict,
and XHTML 1.1 (assuming you wrap it in a valid html/body document).

It also wraps the output of PGRES_COMMAND_OK if the HTML tag is on,
for full compliance: this is why html_escaped_print has to be
externalized.

Greg Sabino Mullane greg@turnstep.com
2003-06-12 07:52:51 +00:00
Bruce Momjian f1792b932c Use PQfreemem() consistently, and document its use for Notify.
Keep PQfreeNotify() around for binary compatibility.
2003-03-25 02:44:36 +00:00
Bruce Momjian 4422fe6017 Remove compile warning. 2003-03-20 15:39:53 +00:00
Bruce Momjian add932ee91 I'm continuing to work on cleaning up code in psql. As things appear
now, my changes seem to work.  Some possible minor bugs got squished
on the way but I can't be sure without more feedback from people who
really put the code to the test.

The new patch mostly simplifies variable handling and reduces code
duplication.  Changes in the command parser eliminate some redundant
variables (boolean state + depth counter), replaces some
"else if" constructs with switches, and so on.  It is meant to be
applied together with my previous patch, although I hope they don't
conflict; I went back to the CVS version for this one.

One more thing I thought should perhaps be changed: an IGNOREEOF
value of n will ignore only n-1 EOFs.  I didn't want to touch this
for fear of breaking existing applications, but it does seem a tad
illogical.

Jeroen T. Vermeulen
2003-03-20 06:43:35 +00:00
Bruce Momjian be1c6e7529 Here's some changes I made last night to psql's common.c (as found in
7.3.2).  It removes some code duplication and #ifdeffing, and some
unstructured ugliness such as tacky breaks and an unneeded continue.
Breaks up a large function into smaller functions and reduces required
nesting levels, and kills a variable or two.

Jeroen T. Vermeulen
2003-03-20 06:00:12 +00:00
Bruce Momjian e733510d5d > Mph. It fails for me too when I use --enable-integer-datetimes. Looks
> like that patch still needs some work...

Yeah.  I'm really, really, *really* sorry for submitting it in the state
it was in.  I shouldn't have done that just before moving to another
country.  I found the problem last night, but couldn't get to a Net
connection until now.

The problem is in src/bin/psql/common.c, around line 250-335 somewhere
depending on the version.  The 2nd and 3rd clauses of the "while" loop
condition:

        (rstatus == PGRES_COPY_IN) &&
        (rstatus == PGRES_COPY_OUT))

should of course be:

        (rstatus != PGRES_COPY_IN) &&
        (rstatus != PGRES_COPY_OUT))

Jeroen T. Vermeulen
2003-03-20 04:49:18 +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
Tom Lane e4704001ea This patch fixes a bunch of spelling mistakes in comments throughout the
PostgreSQL source code.

Neil Conway
2003-03-10 22:28:22 +00:00
Tom Lane 4fff132d1b Revert patch that broke \d commands, until it can be fixed. 2003-02-21 21:34:27 +00:00
Bruce Momjian 1eb9fd49d1 Here's some changes I made last night to psql's common.c (as found in
7.3.2).  It removes some code duplication and #ifdeffing, and some
unstructured ugliness such as tacky breaks and an unneeded continue.
Breaks up a large function into smaller functions and reduces required
nesting levels, and kills a variable or two.

Jeroen T. Vermeulen
2003-02-19 03:54:39 +00:00
Tom Lane 9f1f2bfb66 Fix various places where global s/NOTICE/WARNING/ was applied with too
much enthusiasm.
2003-01-07 22:23:17 +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 6d8c3d4eb3 Add popen/pclose -> _popen/_pclose() mapping for Win32. 2002-10-29 19:35:33 +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
Tom Lane f4a7c257dc Fix unintentional breakage of COPY TO/FROM stdin. Mea culpa. 2002-10-15 16:44:21 +00:00
Tom Lane 951ec872c7 Fix psql to cope with autocommit off, at least during startup.
Behavior of backslash commands (especially for large objects)
may still require some thought.
2002-10-15 02:24:16 +00:00
Bruce Momjian a0bf2503ea The attached patch fixes a number of issues related to compiling the
client
utilities (libpq.dll and psql.exe) for win32 (missing defines,
adjustments to
includes, pedantic casting, non-existent functions) per:
   http://developer.postgresql.org/docs/postgres/install-win32.html.

It compiles cleanly under Windows 2000 using Visual Studio .net. Also
compiles clean and passes all regression tests (regular and contrib)
under Linux.

In addition to a review by the usual suspects, it would be very
desirable for  someone well versed in the peculiarities of win32 to take
a look.

Joe Conway
2002-10-03 17:09:42 +00:00
Tom Lane f7978c6f1d Avoid overflow for large elapsed times in \timing output. Per
Kenji Sugita.
2002-09-14 19:46:01 +00:00
Bruce Momjian e50f52a074 pgindent run. 2002-09-04 20:31:48 +00:00
Peter Eisentraut 7292131c66 Enable locale, so case conversion (identifier processing) and number
formatting (\timing) works correctly.  Change "Total time" to "Time"
since there is nothing that "total" refers to.  Remove non-multibyte
code.
2002-08-27 20:16:49 +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
Bruce Momjian 7015111a19 Move simple_prompt() into its own file to be shared with psql and pg_dump. 2002-07-06 20:12:30 +00:00
Bruce Momjian 92288a1cf9 Change made to elog:
o  Change all current CVS messages of NOTICE to WARNING.  We were going
to do this just before 7.3 beta but it has to be done now, as you will
see below.

o Change current INFO messages that should be controlled by
client_min_messages to NOTICE.

o Force remaining INFO messages, like from EXPLAIN, VACUUM VERBOSE, etc.
to always go to the client.

o Remove INFO from the client_min_messages options and add NOTICE.

Seems we do need three non-ERROR elog levels to handle the various
behaviors we need for these messages.

Regression passed.
2002-03-06 06:10:59 +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 ea08e6cd55 New pgindent run with fixes suggested by Tom. Patch manually reviewed,
initdb/regression tests pass.
2001-11-05 17:46:40 +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
Tom Lane 4fec55af6c Fix several problems with simple_prompt() --- the nastiest being that
the entered password would get echoed on some platforms, eg HPUX.
We have enough copies of this code that I'm thinking it ought to be
moved into libpq, but that's a task for another day.
2001-10-18 21:57:11 +00:00
Bruce Momjian 66b77dbcd6 Prompt for password from /dev/tty and fall back to stdin/stderr. 2001-10-15 16:40:27 +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 15a6cd0091 If the password prompt goes to stderr, then the trailing newline should
also go there.
2001-04-15 00:43:37 +00:00
Tom Lane ea7b4f1f04 Ensure previous setting of pset.queryFout is restored after a failed
backslash-g command.
2001-03-01 18:34:29 +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
Tom Lane 5491233f52 Ensure that 'errno' is saved and restored by all signal handlers that
might change it.  Experimentation shows that the signal handler call
mechanism does not save/restore errno for you, at least not on Linux
or HPUX, so this is definitely a real risk.
2000-12-18 17:33:42 +00:00
Peter Eisentraut 207f6ed3f1 Print the error message before attempting to reset the connection after a
backend crash.
2000-12-15 17:54:43 +00:00
Tom Lane 9c5327b99b Pay attention to failure returns from fgets() in all cases.
Avoid infinite loop prompting for password at stdin EOF.
2000-11-27 02:20:36 +00:00
Tom Lane e8a72c0db2 Prevent simple_prompt() from locking up in a tight loop at stdin EOF. 2000-11-27 01:28:40 +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 ef6164de1d Revert removal of signed, volatile, and signal handler arg type tests. 2000-08-29 09:36:51 +00:00
Peter Eisentraut 79abd73eee Remove configure tests for `signed', `volatile', and signal handler args;
the harm potential outweighs the possible benefits.
2000-08-27 19:00:41 +00:00
Peter Eisentraut 6fb9d2e347 Version number now set in configure, available through Makefile.global
and config.h. Adjusted all referring code.

Scrapped pg_version and changed initdb accordingly. Integrated
src/utils/version.c into src/backend/utils/init/miscinit.c. Changed all
callers.

Set version number to `7.1devel'. (Non-numeric version suffixes now allowed.)
2000-07-02 15:21:27 +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 c8009959c9 Fixed psql's Control-C handling when COPY in progress 2000-02-21 19:40:42 +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
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 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
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
Tom Lane 0e6d72db55 Make PSQLexec's behavior on loss of connection more reasonable;
report original error before attempting reset, not after.
2000-01-14 05:28:31 +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 77a4729936 This should fix the \e (\p, \g, ...) behaviour on an empty query buffer.
Also, minor tweakage of tab completion, and I hope the output is flushed
on time now.

--
Peter Eisentraut                  Sernanders väg 10:115
1999-12-10 03:59:30 +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 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