Commit Graph

2542 Commits

Author SHA1 Message Date
Bruce Momjian 4fff9d7290 Document issues with non-default tablespaces and pg_dumpall restores.
Backpatch documentation addition to 8.1.X.
2006-06-16 22:01:17 +00:00
Tom Lane f3164c0200 Clean up psql's control-C handling to avoid longjmp'ing out of random
places --- that risks corrupting data structures, losing sync with the
backend, etc.  We now longjmp only from calls to readline, fgets, and
fread, which we assume are coded to protect themselves against interrupts
at undesirable times.  This requires adding explicit tests for
cancel_pressed in long-running loops, but on the whole it's far cleaner.
Martijn van Oosterhout and Tom Lane.
2006-06-14 16:49:03 +00:00
Tom Lane e2e2a9db4c Code review for psql multiline history patch(es). Fix memory leak,
failure to enter commands in history if canceled by control-C, other
infelicities.
2006-06-11 23:06:00 +00:00
Tom Lane b773987fc2 Repair remarkably-inefficient query for dumping large object comments: it
was invoking obj_description() for each large object chunk, instead of once
per large object.  This code is new as of 8.1, which may explain why the
problem hadn't been noticed already.
2006-06-09 19:46:09 +00:00
Bruce Momjian 399a36a75d Prepare code to be built by MSVC:
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-07 22:24:46 +00:00
Bruce Momjian ca9d50304f For psql multi-line history, save backslash commands right away, rather
than only if there is already history.
2006-06-07 13:18:37 +00:00
Bruce Momjian 6ca917adff Update comment. 2006-06-06 22:41:09 +00:00
Bruce Momjian 62e7ad6603 On Win32, return original patch if GetShortPathName() fails (no short
name, path does not exist), rather than returning nothing.

Backpatch to 8.1.X.
2006-06-06 22:32:19 +00:00
Bruce Momjian b7af62e4a9 Avoid longjump/vfork warning about line_saved_in_history variable by
making it volatile.
2006-06-05 14:47:38 +00:00
Bruce Momjian a073a70415 Have psql history save \e editor contents to history before query is
executed, like it did for 8.1.X.
2006-06-05 03:55:00 +00:00
Bruce Momjian a837851dc0 Fix psql so \r is separate in the history, rather than at the end of
the query.
2006-06-04 04:35:55 +00:00
Bruce Momjian be05b260a9 Remove pg_resetxlog -r flag, feature has problems referenced here:
http://archives.postgresql.org/pgsql-hackers/2006-05/msg00002.php
2006-06-03 02:19:24 +00:00
Tom Lane 87e8014d31 Respond to Jeremy Drake's original gripe that \copy needs to recognize
E'...' syntax for strings in order to track the backend.
2006-06-01 01:28:00 +00:00
Tom Lane 6178762fcf Fix up hack to suppress escape_string_warning so that it actually works
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-06-01 00:15:36 +00:00
Tom Lane c6d3c1b817 Fix seriously broken patch for psql '' ... per its comment, emit() is
NOT the thing to use here.
2006-05-31 22:11:44 +00:00
Bruce Momjian c3c3902611 Support '' for literal ' in psql single-quote strings, documentation update. 2006-05-31 11:35:17 +00:00
Bruce Momjian eaca1175e9 Escape processing patch:
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-05-31 11:02:42 +00:00
Bruce Momjian fa54cd0432 Add PQclear() calls, for completeness (exits shortly anyway). 2006-05-29 19:52:46 +00:00
Tom Lane 134b463f02 Fix up pg_dump to do string escaping fully correctly for client encoding
and standard_conforming_strings; likewise for the other client programs
that need it.  As per previous discussion, a pg_dump dump now conforms
to the standard_conforming_strings setting of the source database.
We don't use E'' syntax in the dump, thereby improving portability of
the SQL.  I added a SET escape_strings_warning = off command to keep
the dumps from getting a lot of back-chatter from that.
2006-05-28 21:13:54 +00:00
Alvaro Herrera 117d73a9e7 Don't call PQclear until the struct is really no longer going to be used.
Per Coverity bug #304.  Thanks to Martijn van Oosterhout for reporting it.

Zero out the pointer fields of PGresult so that these mistakes are more
easily catched, per discussion.
2006-05-28 17:23:29 +00:00
Alvaro Herrera 3d58a1c168 Remove traces of otherwise unused RELKIND_SPECIAL symbol. Leave the psql bits
in place though, so that it plays nicely with older servers.

Per discussion.
2006-05-28 02:27:08 +00:00
Tom Lane 58a2dbc740 Fix initdb to properly escape quotes and backslashes in the supplied
superuser password, and also in the paths of the various files it issues
SQL COPY commands for.  Per bug #2424.
2006-05-27 18:07:06 +00:00
Bruce Momjian 7a846ecc00 Use E'' strings internally only when standard_conforming_strings =
'off'. This allows pg_dump output with standard_conforming_strings =
'on' to generate proper strings that can be loaded into other databases
without the backslash doubling we typically do.  I have added the
dumping of the standard_conforming_strings value to pg_dump.

I also added standard backslash handling for plpgsql.
2006-05-26 23:48:54 +00:00
Tom Lane 223ae6957f Support binary COPY through psql. Also improve detection of write errors
during COPY OUT.  Andreas Pflug, some editorialization by moi.
2006-05-26 19:51:29 +00:00
Tom Lane c76cb77105 Fix pg_restore to process BLOB COMMENT entries correctly; they aren't
really tables and shouldn't get DISABLE TRIGGER processing.  Per bug
#2452 from Robert Treat.
2006-05-24 21:20:11 +00:00
Peter Eisentraut 79e371037b Add strerror to pg_dump error messages where missing. 2006-05-22 11:21:54 +00:00
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 82a2881c5b Code review for GRANT CONNECT patch. Spell the privilege as CONNECT not
CONNECTION, fix a number of places that were missed (eg pg_dump support),
avoid executing an extra search of pg_database during startup.
2006-04-30 21:15:33 +00:00
Bruce Momjian 2882241c23 Add SSL include needed for psql, after libpq adjustments. 2006-04-27 02:58:08 +00:00
Bruce Momjian a1e5331b07 Add tablespace display to psql \l+.
Philip Yarra
2006-04-26 23:15:45 +00:00
Bruce Momjian cae5671945 In pg_resetxlog.c, uint -> uint32, for Win32 port. 2006-04-26 21:52:31 +00:00
Bruce Momjian 1865fb66fa Add missing ControlFile.checkPointCopy.ThisTimeLineID line for 'guess'
pg_resetxlog.

Simon
2006-04-26 18:56:56 +00:00
Bruce Momjian 0df32e3cbe Allow pg_resetxlog -f to reset pg_control counters using xlog
information, and add a -r option to reset pg_control without affecting
xlog.

yuanjia lee
2006-04-26 02:17:15 +00:00
Tom Lane 3224f2ee25 Fix a couple of rather-pointless-but-easily-fixed Coverity warnings.
Per Martijn van Oosterhout.
2006-04-19 16:02:17 +00:00
Tom Lane 3ef151e0b7 Fix pg_restore -n option to do what the man page says it does. The
original coding only worked if one of the selTypes restriction options
was also given.  Per report from Nick Johnson.
2006-04-12 22:18:48 +00:00
Tom Lane 74bdf965a6 Fix pg_dumpall to do something sane when a pre-8.1 installation has
identically named user and group: we merge these into a single entity
with LOGIN permission.  Also, add ORDER BY commands to ensure consistent
dump ordering, for ease of comparing outputs from different installations.
2006-04-07 21:26:29 +00:00
Tom Lane 09b5271ebd Add a field to the first page of each WAL file to indicate the
XLOG_BLCKSZ.  This ought to help in preventing configuration mismatch
problems if anyone tries to ship PITR files between servers compiled
with different XLOG_BLCKSZ settings.  Simon Riggs
2006-04-05 03:34:05 +00:00
Tom Lane e6140d9052 Don't use BLCKSZ for the physical length of the pg_control file, but
instead a dedicated symbol.  This probably makes no functional difference
for likely values of BLCKSZ, but it makes the intent clearer.
Simon Riggs, minor editorialization by Tom Lane.
2006-04-04 22:39:59 +00:00
Tom Lane eaef111396 Define a separately configurable XLOG_BLCKSZ symbol for the page size
used within WAL files.  Historically this was the same as the data file
BLCKSZ, but there's no necessary connection, and it's possible that
performance gains might ensue from reducing XLOG_BLCKSZ.  In any case
distinguishing two symbols should improve code clarity.  This commit
does not actually change the page size, only provide the infrastructure
to make it possible to do so.  initdb forced because of addition of a
field to pg_control.
Mark Wong, with some help from Simon Riggs and Tom Lane.
2006-04-03 23:35:05 +00:00
Neil Conway 7815ca7bef Rewrite much of psql's \connect code, for the sake of code clarity and
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-04-02 20:08:22 +00:00
Alvaro Herrera 643b022bed Add tab-completion for REASSIGN OWNED BY and DROP OWNED BY. Also fix some
whitespace issues nearby.

DROP OWNED BY is actually a bit kludgy, but it seems better to do it this way
rather than duplicating the words_after_create list just to add a single
element.
2006-04-02 09:02:41 +00:00
Andrew Dunstan bee34e9930 Fix bad SQL, per Stefan Kaltenbrunner. 2006-03-30 01:08:15 +00:00
Alvaro Herrera c4826cf0b0 Merge the loading of shared object descriptions with regular descriptions,
both in code and in the messages emitted to the user.
2006-03-21 17:54:28 +00:00
Bruce Momjian af00c04c42 Fix psql history handling:
> 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-21 13:38:12 +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 f3d99d160d Add CVS tag lines to files that were lacking them. 2006-03-11 04:38:42 +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 5e3bcac1d9 Fix psql history handling so 'execute' backslash commands (\g)
remain as part of the multi-line query.
2006-03-06 15:09:04 +00:00
Bruce Momjian ca8f27998a In psql, save history of backslash commands used in multi-line
statements before the multi-line statement, rather than inside the
multi-line statement.
2006-03-06 04:45:21 +00:00
Bruce Momjian f2f5b05655 Update copyright for 2006. Update scripts. 2006-03-05 15:59:11 +00:00