Commit Graph

1884 Commits

Author SHA1 Message Date
Tom Lane a9e9abebd9 Issue CREATE SCHEMA as the originally connecting user, with an
AUTHORIZATION clause to specify the desired owner.  This allows a
superuser to restore schemas owned by users without CREATE-SCHEMA
permissions (ie, schemas originally created by a superuser using
AUTHORIZATION).  --no-owner can be specified to suppress the
AUTHORIZATION clause if need be.
2003-09-23 23:31:52 +00:00
Tom Lane 6767cebc6f pg_dump/pg_restore now always use SET SESSION AUTHORIZATION, not \connect,
to control object ownership.  The use-set-session-authorization and
no-reconnect switches are obsolete (still accepted on the command line,
but they don't do anything).  This is a precursor to fixing handling
of CREATE SCHEMA, which will be a separate commit.
2003-09-23 22:48:53 +00:00
Peter Eisentraut 278a13fe47 Translation updates 2003-09-22 00:27:01 +00:00
Peter Eisentraut 6f57d63cb4 Message wording improvements 2003-09-22 00:23:35 +00:00
Tom Lane f72a93b4c9 pg_dump missed comments attached to primary key or unique constraints
(as distinct from their underlying indexes).  Per bug report from
Hiroshi Saito.
2003-09-19 23:15:18 +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 7ce5f25b5b Translation updates 2003-09-15 20:42:40 +00:00
Peter Eisentraut 20aaf64252 Allow translation of SQL help in psql. 2003-09-14 22:37:13 +00:00
Bruce Momjian 9182481bea Remove WIN32_CONSOLE support, at the request of the author. 2003-09-12 02:40:10 +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 48beecda7c Remove geqo_random_seed parameter. Having geqo reset the global random()
sequence every time it's called is bogus --- it interferes with user
control over the seed, and actually decreases randomness overall
(because a seed based on time(NULL) is pretty predictable).  If you really
want a reproducible result from geqo, do 'set seed = 0' before planning
a query.
2003-09-07 15:26:54 +00:00
Bruce Momjian 4b407f6c3c Changes for MinGW/WIN32:
o allow configure to see include/port/win32 include files
        o add matching Win32 accept() prototype
        o allow pg_id to compile with native Win32 API
        o fix invalide mbvalidate() function calls (existing bug)
        o allow /scripts to compile with native Win32 API
        o add win32.c to Win32 compiles (already in *.mak files)
2003-09-07 03:43:57 +00:00
Tom Lane 7703e55c32 Make the default pg_hba.conf include an entry for ::1 only if configure
set HAVE_IPV6.  Per recent discussions.
2003-09-07 03:36:03 +00:00
Bruce Momjian 4060f07578 Rename variables for clarity. 2003-09-06 01:41:56 +00:00
Bruce Momjian 04aabb034f Clean up WIN32_CONSOLE code. 2003-09-05 02:31:10 +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
Peter Eisentraut defc7a972d Translation update 2003-08-31 17:38:06 +00:00
Tom Lane 209a8d63df pg_dump and pg_restore -r had managed to diverge on the ordering of
different object types.  Fix, and centralize logic to try to prevent
the same mistake in future.
2003-08-28 20:21:34 +00:00
Tom Lane 80bc61c849 Ensure that FK constraints are dumped after primary/unique constraints,
rather than relying on OID order of pg_constraint entries.  Per gripe
from Greg Stark.
2003-08-28 18:59:06 +00:00
Bruce Momjian 0b511f07e3 psql's HISTSIZE from .psqlrc do not want to be set so I did it for psql
that HISTSIZE might take effect from my .psqlrc

Andriy Tkachuk
2003-08-26 18:35:31 +00:00
Tom Lane f63cbccac7 Mop-up for previous change to determine default shared_buffers and
max_connections at initdb time.  Get rid of DEF_NBUFFERS and DEF_MAXBACKENDS
macros, which aren't doing anything useful anymore, and put more likely
defaults into postgresql.conf.sample.
2003-08-26 15:38:25 +00:00
Peter Eisentraut 3b87c1f8b6 Translation updates 2003-08-25 21:29:53 +00:00
Peter Eisentraut 478bb0268f Fix translation mistake. 2003-08-24 21:26:34 +00:00
Peter Eisentraut 903fe8fc6f Translation updates 2003-08-24 21:18:53 +00:00
Peter Eisentraut ef38ca9b3d Translation updates 2003-08-20 21:10:01 +00:00
Tom Lane 4529d2cf27 Add missing quotes. 2003-08-14 18:56:41 +00:00
Tom Lane 80cedf9ba0 Someone moved PageOutput here from common.c, but forgot to move all
the #includes it depends on.
2003-08-14 18:49:42 +00:00
Tom Lane dbb4dd29e9 Remove unnecessary #include's (see c.h). 2003-08-14 18:48:35 +00:00
Tom Lane 2b5f049f7c Handle double-quotes correctly in user names in ACL lists.
Christopher Kings-Lynne
2003-08-14 14:19:11 +00:00
Peter Eisentraut 7078441af0 Translation updates 2003-08-11 15:19:58 +00:00
Bruce Momjian 329a1b7270 I get the following warning when I compile src/bin/pg_id/pg_id.c:
gcc -pipe -g -Wall -Wmissing-prototypes -Wmissing-declarations
-I../../../src/include   -c -o pg_id.o pg_id.c -MMD
pg_id.c: In function `main':
pg_id.c:35: warning: unused variable `optarg'

The attached trivial patch fixes the warning by removing the variable.

Neil Conway
2003-08-09 01:25:46 +00:00
Bruce Momjian cf3cc7576c This makes psql use the new pg_get_viewdef function. It also puts one
extra line break in to improve formatting.

Christopher Kings-Lynne
2003-08-09 01:21:54 +00:00
Bruce Momjian 46785776c4 Another pgindent run with updated typedefs. 2003-08-08 21:42:59 +00:00
Bruce Momjian 360162b172 Remove, no in /port. 2003-08-08 18:43:49 +00:00
Peter Eisentraut 0bf70870db Translation updates by Dennis Björklund 2003-08-08 11:03:29 +00:00
Bruce Momjian 63c4d156e0 Move simple_prompt()/sprompt.c into /port. 2003-08-08 04:52:22 +00:00
Bruce Momjian cce40d15d5 Remove space between function name and opening paren in pg_dump, for
clarity.
2003-08-08 01:21:02 +00:00
Tom Lane 33ab177a56 Don't assume that struct option is available just because we can find a
getopt_long().  This is more or less the same problem as we saw earlier
with getaddrinfo() and struct addrinfo, and for the same reason: random
user-added libraries might contain the subroutine, but there's no
guarantee we will find the matching header files.
2003-08-07 21:11:58 +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
Peter Eisentraut fb19e2f41d Translation updates 2003-08-04 14:01:37 +00:00
Bruce Momjian f3c3deb7d0 Update copyrights to 2003. 2003-08-04 02:40:20 +00:00
Bruce Momjian 089003fb46 pgindent run. 2003-08-04 00:43:34 +00:00
Tom Lane 75619cff56 Get the include ordering right for TCL includes vs whatever is coming
from --with-includes.
2003-08-01 19:01:49 +00:00
Peter Eisentraut ec506c12cd Russian translation updates by Serguei Mokhov 2003-08-01 16:19:14 +00:00
Tom Lane 8488f25425 Upgrade parsing code for ACLs to be less hokey and more cognizant of
the actual logical structure and quoting rules being used.  Fixes bug
reported by Chris K-L on 7/8/03.
2003-07-31 17:21:57 +00:00
Bruce Momjian f766b376f1 Add fflush of stdout when outputing query. 2003-07-31 04:23:40 +00:00
Tom Lane f353f8e83b There is no reason to cast valuntil to timestamp, and a very good
reason not to: it fails for an 'invalid' abstime.  Per bug report
of today's date.
2003-07-29 14:17:37 +00:00
Tom Lane 9c2a7c2269 Apply (a somewhat revised version of) Greg Mullane's patch to eliminate
heuristic determination of day vs month in date/time input.  Add the
ability to specify that input is interpreted as yy-mm-dd order (which
formerly worked, but only for yy greater than 31).  DateStyle's input
component now has the preferred spellings DMY, MDY, or YMD; the older
keywords European and US are now aliases for the first two of these.
Per recent discussions on pgsql-general.
2003-07-29 00:03:19 +00:00
Tom Lane 02d79e765b Rename psql's VERBOSE variable to VERBOSITY, per suggestion from Bruce. 2003-07-28 00:14:43 +00:00
Tom Lane 81b5c8a136 A visit from the message-style police ... 2003-07-28 00:09:16 +00:00
Bruce Momjian 38fb906f93 > Joe Conway <mail@joeconway.com> writes:
>>ISTM that "source" is worth knowing.
>
> Hm, possibly.  Any other opinions?

This version has the seven fields I proposed, including "source". Here's
an example that shows why I think it's valuable:

regression=# \x
Expanded display is on.
regression=# select * from pg_settings where name = 'enable_seqscan';
-[ RECORD 1 ]-----------
name    | enable_seqscan
setting | on
context | user
vartype | bool
source  | default
min_val |
max_val |

regression=# update pg_settings set setting = 'off' where name =
'enable_seqscan';
-[ RECORD 1 ]---
set_config | off

regression=# select * from pg_settings where name = 'enable_seqscan';
-[ RECORD 1 ]-----------
name    | enable_seqscan
setting | off
context | user
vartype | bool
source  | session
min_val |
max_val |

regression=# alter user postgres set enable_seqscan to 'off';
ALTER USER

(log out and then back in again)

regression=# \x
Expanded display is on.
regression=# select * from pg_settings where name = 'enable_seqscan';
-[ RECORD 1 ]-----------
name    | enable_seqscan
setting | off
context | user
vartype | bool
source  | user
min_val |
max_val |

In the first case, enable_seqscan is set to its default value. After
setting it to off, it is obvious that the value has been changed for the
session only. In the third case, you can see that the value has been set
specifically for the user.

Joe Conway
2003-07-27 04:35:54 +00:00
Bruce Momjian 9ae6905520 This is a totally trivial patch for something that was a very minor nit that
annoyed me the other day while I was documenting my current project. It
makes pg_dump use the same layout for types as for tables, by putting "\n\t"
before the first field and "\n" before the final ");"

Can't really justify this too much except to say I had an itch and I
scratched it ;-)

Andrew Dunstan
2003-07-27 03:47:22 +00:00
Bruce Momjian 9df48371c2 here are the patches for psql on Win32:
psql4win32.patch  - changes in the psql source code
  psql-ref.patch    - changes in the documentation psql-ref.sgml
                      (for new builtin variable WIN32_CONSOLE)

To apply them use "patch -p 1" in the root directory of the
postgres source directory.

These patches fix the following problems of psql on Win32
(all changes only have effect #ifdef WIN32):

  a) Problem:  Static library libpq.a did not work
     Solution: Added WSAStartup() in fe-connect.c

  b) Problem:  Secret Password was echoed by psql
     Solution: Password echoing disabled in sprompt.c

  c) Problem:  8bit characters were displayed/interpreted wrong in psql
               This is due to the fact that the Win32 "console" uses a
               different encoding than the rest of the Windows system
     Solution: Introduced a new psql variable WIN32_CONSOLE
               When set with "\set WIN32_console", the function OemToChar()
               is applied after reading input and CharToOem() before
               displaying Output

Christoph Dalitz
2003-07-27 03:32:26 +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
Bruce Momjian 57748fc25d > Having read the list, and noticed the message about table inheritance I
> thought that I would see if I could come up with a simple solution, and
> have my first delve into the code for PostgreSQL.
>
> Attached is a diff against 7.3.3 source, of changes to describe.c for
> psql. This should print out a list of parent tables in a similar style
> to that of the index listing. I have done some testing on my side and it
> all seems fine, can some other people have a quick look? What do people
> think? Useful?

Nick Barr
2003-07-25 21:42:26 +00:00
Tom Lane b92d055b56 Recent patch to dump nondefault attstorage settings broke pg_dump for
dropped columns.  Fix by using LEFT JOIN rather than straight join
between pg_attribute and pg_type.  Also, use pg_type.oid as input to
format_type, so that we don't get a failure on deleted types of deleted
columns (this may be a change we ought to backpatch to 7.3....).
2003-07-25 21:02:52 +00:00
Bruce Momjian 9fecf302f7 Seems my check constraint change did break stuff.
Alias the appropriate columns back to their original name.

Fixed formatting of a few other places as I went along (indenting)
--
Rod Taylor <rbt@rbt.ca>
2003-07-25 19:37:21 +00:00
Bruce Momjian 187e865174 > Rod Taylor <rbt@rbt.ca> writes:
> > It seems that readline() on my system (FreeBSD 4.8) isn't declared to
> > take the prompt as a const.  Thus, remove const from gets_interactive()
> > to remove the warning.
>
> I think it would be a lot cleaner to just put a cast to char * into the
> readline call (with a note about why).

Ok.. that works.

I must say it's a little strange being able to take a constant and say
its no longer constant anymore -- but I suppose it's no different than
defining then undefining pre-processor constants.

Rod Taylor <rbt@rbt.ca>
2003-07-25 19:27:06 +00:00
Peter Eisentraut cf16f51a43 Fix grant option dumping and related cross-version compatibility issues. 2003-07-24 15:52:53 +00:00
Peter Eisentraut 56b8a6f5d1 Czech translation updates from Karel Zak 2003-07-23 09:36:43 +00:00
Peter Eisentraut ef889e925e Update German translations. 2003-07-23 08:49:30 +00:00
Peter Eisentraut c154fc3a20 Apply message style guide to frontend programs. 2003-07-23 08:47:41 +00:00
Bruce Momjian 0fe252b5da Don't report sequendces in pg_tables. 2003-07-22 00:02:55 +00:00
Bruce Momjian 82f18c4a2c Fix relkind test for pg_tables.
Mike Quinn
2003-07-21 15:20:27 +00:00
Tom Lane 9117e55493 Tweak original coding so that we can determine the platform-specific
shared_buffers and max_connections values to use before we run the
bootstrap process.  Without this, initdb would fail on platforms where
the hardwired default values are too large.  (We could get around that
by making the hardwired defaults tiny, perhaps, but why slow down
bootstrap by starving it for buffers...)
2003-07-15 00:11:14 +00:00
Tom Lane de98a7e23a The default values for shared_buffers and max_connections are now 1000
and 100 respectively, if the platform will allow it.  initdb selects
values that are not too large to allow the postmaster to start, and
places these values in the installed postgresql.conf file.  This allows
us to continue to start up out-of-the-box on platforms with small SHMMAX,
while having somewhat-realistic default settings on platforms with
reasonable SHMMAX.  Per recent pghackers discussion.
2003-07-14 20:00:23 +00:00
Tom Lane b700a672fe Add --help-config facility to dump information about GUC parameters
without needing a running backend.  Reorder postgresql.conf.sample
to match new layout of runtime.sgml.  This commit re-adds work lost
in Wednesday's crash.
2003-07-04 16:41:22 +00:00
Peter Eisentraut c5faf2cf3c Translation update 2003-07-01 00:05:49 +00:00
Tom Lane 6115224448 Rename plpython to plpythonu, and update documentation to reflect its
now-untrusted status.
2003-06-30 18:31:42 +00:00
Tom Lane 219e29784d Add GUC option log_error_verbosity to control which fields of error
reports get put into the postmaster log.  Options are TERSE, DEFAULT,
VERBOSE, with the same behavior as implemented on the client side in
libpq.
2003-06-30 16:47:02 +00:00
Peter Eisentraut 823bd7d129 Add missing PO files from last commit. 2003-06-29 10:13:13 +00:00
Peter Eisentraut df7618020b Merge PO file updates from 7.3 branch. 2003-06-28 22:31:01 +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
Tom Lane 7dc5472d48 Missing calls to PQclear in large_obj.c and describe.c.
Greg Sabino Mullane
2003-06-27 16:55:23 +00:00
Bruce Momjian a09ccc70dd If they're not, the below causes problems, as the foreign key is added
after the CHECK.  Cluster depends on the index name, so I thought it
wise to ensure all names are available, rather than leaving off the
CONSTRAINT "$n" portion for internally named constraints.

CREATE TABLE jkey (col integer primary key);
CREATE TABLE j (col integer REFERENCES jkey);
ALTER TABLE j ADD CHECK(col > 5);

This is a problem in 7.3 series as well as -Tip.

Rod Taylor <rbt@rbt.ca>
2003-06-25 04:08:19 +00:00
Bruce Momjian ca64391d6c Updated the pg_get_constraintdef() to use conbin. Update pg_dump to use
pg_get_constraintdef() for >= 70400.

Rod Taylor <rbt@rbt.ca>
2003-06-25 03:56:31 +00:00
Tom Lane dd81eee222 Use libpq's new logic to get the server version, instead of doing it ourselves. 2003-06-22 00:56:58 +00:00
Peter Eisentraut f374a9dae9 Change clusterdb and vacuumdb into C programs. 2003-06-18 12:19:11 +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 752a4dac50 psql: tab completion for \encoding
Ian Barwick
2003-06-12 01:38:08 +00:00
Bruce Momjian 240dc5cddc Add add_missing_from GUC variable.
Nigel J. Andrews
2003-06-11 22:13:22 +00:00
Bruce Momjian b952d61c54 Add log_min_duration_statement.
Christopher Kings-Lynne
2003-06-11 18:01:14 +00:00
Tom Lane 8bfe93c5c8 pg_dump and pg_restore were stripping quotes and downcasing some but
not all SQL identifiers taken from command line arguments.  We decided
years ago that that was a bad idea: identifiers taken from the command
line should be treated as literally correct.  Remove the inconsistent
code that has crept in recently.  Also fix pg_dump so that the combination
of --schema and --table does what you'd expect, namely dump exactly one
table from exactly one schema.  Per gripe from Deepak Bhole of Red Hat.
2003-06-11 16:29:42 +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 b4b3e340e3 Add -DFRONTEND for non-MinGW Win32 ports. 2003-06-06 22:17:42 +00:00
Tom Lane 5369190220 Make the world at least marginally safe for usernames with embedded spaces.
Per recent gripe.
2003-06-02 19:00:29 +00:00
Tom Lane 9e1e72b698 Cause pg_dumpall to support the -a, -s, -x options of pg_dump. 2003-05-30 23:55:10 +00:00
Tom Lane df1df6bb90 Cause pg_dumpall to include GRANT/REVOKE for database-level permissions
in its output.  Make it work with server versions back to 7.0, too.
2003-05-30 22:55:16 +00:00
Tom Lane 4df52b28f0 Fix things so that an error occuring during standalone-backend processing
in initdb will result in exit(1), allowing the initdb script to realize
that there's something wrong.
2003-05-28 18:19:09 +00:00
Tom Lane aae078198d In bootstrap and standalone-backend modes, do not sort LOG elevel out
of order; the 'server log' output is actually client output in these
scenarios and we ought to treat elevels the same way as in the client
case.  This allows initdb to not send backend stderr to /dev/null anymore,
which makes it much more likely that people will notice problems during
initdb.
2003-05-28 17:25:02 +00:00
Tom Lane fc8d970cbc Replace functional-index facility with expressional indexes. Any column
of an index can now be a computed expression instead of a simple variable.
Restrictions on expressions are the same as for predicates (only immutable
functions, no sub-selects).  This fixes problems recently introduced with
inlining SQL functions, because the inlining transformation is applied to
both expression trees so the planner can still match them up.  Along the
way, improve efficiency of handling index predicates (both predicates and
index expressions are now cached by the relcache) and fix 7.3 oversight
that didn't record dependencies of predicate expressions.
2003-05-28 16:04:02 +00:00
Peter Eisentraut a6f01d1aa6 Internationalize interactive yes/no responses. 2003-05-27 19:36:55 +00:00
Tom Lane 6d8c774f55 Fix breakage induced by recent patch (careless use of fmtId()). 2003-05-17 15:53:12 +00:00
Peter Eisentraut 2c0556068f Indexing support for pattern matching operations via separate operator
class when lc_collate is not C.
2003-05-15 15:50:21 +00:00
Tom Lane f85f43dfb5 Backend support for autocommit removed, per recent discussions. The
only remnant of this failed experiment is that the server will take
SET AUTOCOMMIT TO ON.  Still TODO: provide some client-side autocommit
logic in libpq.
2003-05-14 03:26:03 +00:00
Tom Lane 45d04099df Reinstate pg_type's typsend and typreceive columns. They don't do much
yet, but they're there.  Also some editorial work on CREATE TYPE reference
page.
2003-05-08 22:19:58 +00:00
Tom Lane 228697179a Fix erroneous space calculation leading to core dump in dumpProcLangs,
per report from Olivier Prenant.  Also fix off-by-one space calculation
in ReadToc; this woould not have hurt us until we had more than 100
dependencies for a single object, but wrong is wrong.
2003-05-03 22:18:59 +00:00
Tom Lane 6687650ce6 COPY and pg_dump failed to cope with zero-column tables. Fix 'em. 2003-04-25 02:28:22 +00:00
Tom Lane 54b38d293e Fix breakage from recent variable-handling changes. 2003-04-18 23:38:47 +00:00
Tom Lane 1719fd55d3 Fix some problems exposed by building outside the source tree. 2003-04-16 05:23:55 +00:00
Bruce Momjian 6bfa2df64e Document file name as optional for \o in psql help (\h). 2003-04-14 16:23:36 +00:00
Bruce Momjian d46e643822 Add Win32 path handling for / vs. \ and drive letters. 2003-04-04 20:42:13 +00:00
Bruce Momjian 9bad936f67 Handle cp, rm, and exec for Win32. 2003-04-04 20:40:45 +00:00
Tom Lane 9c264975d5 Fix some signed-vs-unsigned-int issues; make print_aligned_vertical
safe for zero-column tables.
2003-04-04 15:48:38 +00:00
Tom Lane 3b4ca4c0d9 Code review for pg_stat_get_backend_activity_start patch --- fix
return type, make protection condition agree with recent change to
pg_stat_get_backend_activity, clean up documentation.
2003-04-04 03:03:54 +00:00
Tom Lane c19354dfb5 const-ify functions used with completion_matches(), to suppress
cast-away-const warnings from compilers pickier than gcc.
2003-04-03 20:18:16 +00:00
Bruce Momjian d307a954e7 Skip START WITH in sequence definition when it's the default value --
and hasn't been called yet.

Fixes bug where it wasn't supplied (due to being NULL).

Rod Taylor
2003-03-31 20:48:45 +00:00
Bruce Momjian c7d7788d07 Fix NULL casting warning, pointed out by Joe Conway 2003-03-28 16:34:50 +00:00
Bruce Momjian c75d65485d New \d format:
Example:

test=# \d test
     Table "public.test"
 Column |  Type   | Modifiers
--------+---------+-----------
 a      | integer | not null
Indexes:
    "test_pkey" PRIMARY KEY btree (a)
Check Constraints:
    "$2" CHECK (a > 1)
Foreign Key Constraints:
    "$1" FOREIGN KEY (a) REFERENCES parent(b)
Rules:
    myrule AS ON INSERT TO test DO INSTEAD NOTHING
Triggers:
    "asdf asdf" AFTER INSERT OR DELETE ON test FOR EACH STATEMENT EXECUTE
PROCEDURE update_pg_pwd_and_pg_group(),
    mytrigger AFTER INSERT OR DELETE ON test FOR EACH ROW EXECUTE PROCEDURE
update_pg_pwd_and_pg_group()

I have minimised the double quoting of identifiers as much as I could
easily, and I will submit another patch when I have time to work on it that
will use a 'fmtId' function to determine it exactly.

I think it's a significant improvement in legibility...

Obviously the table example above is slightly degenerate in that not many
tables in production have heaps of (non-constraint) triggers and rules.

Christopher Kings-Lynne
2003-03-27 16:57:39 +00:00
Bruce Momjian a6699f6185 Attached are two patches for psql's tab-completion.c.
The first cleans up a couple of minor errors and ommissions
and adds tab completion support to more slash commands, e.g.
\dv.

The second is an attempt to add tab completion for schemas
and fully qualified relation names (e.g. public.mytable ).
I think this covers the TODO-item:
"Allow psql to do table completion for SELECT * FROM schema_part and table
completion for SELECT * FROM schema_name."

This happens via union selects querying:
 - relation_name in current search path;
 - schema_name;
 - schema.relation_name
matching the current input string.

E.g:
  SELECT p[TAB]
will produce a list of all appropriate relation names in the current search
path which begin with 'p', and also all schema names which begin with 'p';
  \d pub[TAB]
will produce any relation names in the current search path and also
any schema names beginning with 'pub';
  \d public.[TAB]
will produce a list of all relations in the schema 'public';
  \d public.my[TAB]
produces all relation names beginning with 'my' in schema 'public'.

It seems to work for me; comments, suggestions, particularly regarding
the coding and queries, are very welcome.

Note that tables, indexes, views and sequences relations in the
'pg_catalog' namespace are excluded even though they are in
the current search path. I found not doing this produced annoying behaviour
when expanding names beginning with 'p'. People who work with system
tables a lot may not like this though; I can look for another solution
if necessary.

Ian Barwick
2003-03-27 16:45:01 +00:00
Bruce Momjian 9d6f5ee860 Adds
ALTER TABLE foo CLUSTER ON bar;

In pg_dumps, to preserve cluster settings.

Christopher Kings-Lynne
2003-03-27 16:43:07 +00:00
Bruce Momjian b099d9e7eb Reorder language creation to restore constistently.
Laurent FAILLIE
2003-03-27 16:39:17 +00:00
Peter Eisentraut 5e5c5cd31a Merge documentation into one book. (Build with "make html".) Replace
vague cross-references with real links.
2003-03-25 16:15:44 +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 7542f10325 Improve psql comment coding. 2003-03-21 03:28:29 +00:00
Bruce Momjian 5ae424529b Fix multiline C comments in psql. 2003-03-20 22:08:50 +00:00
Bruce Momjian 8819213534 Now that the CLUSTER ALL machinery is in place, the clusterdb script can
be simplified (I'd thought that it can even be removed).  This patch
does that.

Alvaro Herrera
2003-03-20 18:53:18 +00:00
Bruce Momjian 26a6378e84 Remove extern for cancelConn, from Karel Zak 2003-03-20 15:44:17 +00:00
Bruce Momjian 4422fe6017 Remove compile warning. 2003-03-20 15:39:53 +00:00
Bruce Momjian cf4cee1b17 At present, dates are put into a dump in the format specified by the
default datestyle.  This is not portable between installations.

This patch sets DATESTYLE to ISO at the start of a pg_dump, so that the
dates written into the dump will be restorable onto any database,
regardless of how its default datestyle is set.

Oliver Elphick
2003-03-20 07:05:21 +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 1b3d4cefe8 It has been tested only against CVS backend, however. Some checking of the
changes to the SQL to retrieve attributes for older versions of Postgres is
probably wise.  Also, please make sure that I have mapped the storage types
to the correct storage names, as this is relatively poorly documented.

I think that this patch might need to be considered for back-porting to
7.3.3 since at the moment, people will be losing valuable information after
upgrades.

Will dump:

CREATE TABLE test (
    a text,
    b text,
    c text,
    d text
);
ALTER TABLE ONLY test ALTER COLUMN a SET STATISTICS 55;
ALTER TABLE ONLY test ALTER COLUMN a SET STORAGE PLAIN;
ALTER TABLE ONLY test ALTER COLUMN b SET STATISTICS 1000;
ALTER TABLE ONLY test ALTER COLUMN c SET STORAGE EXTERNAL;
ALTER TABLE ONLY test ALTER COLUMN d SET STORAGE MAIN;

Christopher Kings-Lynne
2003-03-20 06:26:30 +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 8000fdd462 > > - Move SEQ_MAXVALUE, SEQ_MINVALUE definitions to sequence.h
> >
> > - Add check in pg_dump to see if the value returned is the max /min
> > values and replace with NO MAXVALUE, NO MINVALUE.
> >
> > - Change START and INCREMENT to use START WITH and INCREMENT BY syntax.
> > This makes it a touch easier to port to other databases with sequences
> > (Oracle).  PostgreSQL supports both syntaxes already.
>
> +       char            bufm[100],
> +                               bufx[100];
>
> This seems to be an arbitary size. Why not set it to the actual maximum
> length?
>
> Also:
>
> +       snprintf(bufm, 100, INT64_FORMAT, SEQ_MINVALUE);
> +       snprintf(bufx, 100, INT64_FORMAT, SEQ_MAXVALUE);
>
> sizeof(bufm), sizeof(bufx) is probably the more
> maintenance-friendly/standard way to do it.

I changed the code to use sizeof - but will wait for a response from
Peter before changing the size.  It's consistent throughout the sequence
code to be 100 for this purpose.

Rod Taylor <rbt@rbt.ca>
2003-03-20 05:18:15 +00:00
Bruce Momjian 54ca7a7b13 (Now featuring documentation: fixed some typos, expanded the
Envrironment and Files section, explained exactly what -w
does)

This is a patch which allows pg_ctl to make an intelligent
guess as to the proper port when running 'psql -l' to
determine if the database has started up (the -w flag).

The environment variable PGPORT is used. If that is not found,
it checks if a specific port has been set inside the postgresql.conf
file. If it is has not, it uses the port that Postgres was
compiled with.

Greg Sabino Mullane  greg@turnstep.com
2003-03-20 05:00:14 +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
Bruce Momjian a18331004a Add start time to pg_stat_activity
Neil Conway
2003-03-20 03:34:57 +00:00
Bruce Momjian ddd50a0bab This patch fixes a very small memory leak in psql, spotted with
valgrind.

Neil Conway
2003-03-19 22:49:43 +00:00
Peter Eisentraut 8cb041aada Set up the privileges on the default schemas in initdb with real GRANT
commands, to arrive at a valid and dumpable state.
2003-03-19 16:08:59 +00:00
Peter Eisentraut 9e0ab7126d Reimplement create and drop scripts in C, to reduce repetitive
connections, increase robustness, add NLS, and prepare for Windows port.
(vacuumdb and clusterdb will follow later.)
2003-03-18 22:19:47 +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
Peter Eisentraut a14424a9d2 Fix off-by-one error in the maxlen parameter handling. 2003-03-18 22:09:37 +00:00
Tom Lane 2a44306396 pg_dumpall failed on groups having no members. Per report from
Nick Eskelinen.
2003-03-14 22:45:49 +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
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 b9e8ffcd5d pg_restore failed to restore blobs if -X disable-triggers is specified. 2003-03-09 19:38:52 +00:00
Tom Lane 0c693b4926 Add missing --globals-only (long form of -g). 2003-03-06 21:45:52 +00:00
Tom Lane bf3e675384 Avoid using a separate query to fetch the default expressions for
columns.  Improved version of patch by mallah@trade-india.com.
2003-02-24 03:54:06 +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 69c049cef4 Back out LOCKTAG changes by Rod Taylor, pending code review. Sorry. 2003-02-19 23:41:15 +00:00
Bruce Momjian adc3b34b9c Here's the patch I promised over on HACKERS - it alters the
implementation
of '\e' history tracking for systems that have a readline compatability
library without replace_history_entry.  I fall back to pushing the query
onto the history stack after the \e, rather than replacing it.

The patch adds one more place to look for readline headers, and a test
for replace_history_entry. I've only included the patch for configure.in

Ross J. Reedstrom
2003-02-19 04:04:04 +00:00
Bruce Momjian d0f3a7e9c4 - Modifies LOCKTAG to include a 'classId'. Relation receive a classId of
RelOid_pg_class, and transaction locks XactLockTableId. RelId is renamed
to objId.

- LockObject() and UnlockObject() functions created, and their use
sprinkled throughout the code to do descent locking for domains and
types. They accept lock modes AccessShare and AccessExclusive, as we
only really need a 'read' and 'write' lock at the moment.  Most locking
cases are held until the end of the transaction.

This fixes the cases Tom mentioned earlier in regards to locking with
Domains.  If the patch is good, I'll work on cleaning up issues with
other database objects that have this problem (most of them).

Rod Taylor
2003-02-19 04:02:54 +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
Bruce Momjian 71f35f5916 At present it is impossible to kill createuser except with kill -9
Oliver Elphick
2003-02-19 03:52:57 +00:00
Bruce Momjian ba16df979c Propogate pg_ctl -D to the postmaster as a -D flag for identification by
ps for multiple postmasters, for Kevin Brown.
2003-02-14 22:18:25 +00:00
Bruce Momjian 3f6333357f Make pg_dump/restore safer for autocommit=off in postgresql.conf. 2003-02-14 19:40:42 +00:00
Tom Lane 57892e74db Result of lo_read() is int, not size_t. Per Oleg Drokin. 2003-02-13 22:56:52 +00:00
Bruce Momjian 0064031f99 This patch fixes an error in the usage message for 'clusterdb', and
makes a few editorial changes to the documentation.


Neil Conway
2003-02-13 05:37:44 +00:00
Bruce Momjian 2bd63117c1 [ dumping schemas ]
> I don't care what you use for short options if all useful ones are taken.
> But the long option should be --schema.

Ok, fair enough: a revised patch is attached that uses the '-n' short
option and the '--schema' long option.

Neil Conway
2003-02-13 04:54:16 +00:00
Bruce Momjian 6d8b8a5e4d [ Have readline save edit history.]
>
> > I already posted a one-line patch to implement this, but it doesn't
> > seem to hve come through to the list. Here it is inline, instead of as
> > an attachment:
>
> We need this to work without readline as well.  (Of course there won't be
> any history, but it needs to compile.)

<blush> Even after slogging my way through the nesting #ifdefs for readline
and win32, I forgot! Let's make that a three line patch, then.

Ross J. Reedstrom
2003-02-13 04:08:16 +00:00
Peter Eisentraut d6b043eb63 Fix buffer clearing bug. 2003-02-11 21:06:58 +00:00
Tom Lane 77ede8900d Create a GUC variable REGEX_FLAVOR to control the type of regular
expression accepted by the regex operators, per discussion yesterday.

Along the way, reduce deadlock_timeout from PGC_POSTMASTER to PGC_SIGHUP
category.  It is probably best to insist that all backends share the same
setting, but that doesn't mean it has to be frozen at startup.
2003-02-06 20:25:33 +00:00
Tom Lane e0a1ee2053 Cleaner solution to the problem of loading pre-7.3 dumps containing
columns of type lo (see contrib/lo).  Rather than hacking the function
definitions on-the-fly, just modify the queries issued by FixupBlobRefs
so that they work even if CREATE CAST hasn't been issued.
2003-02-01 22:06:59 +00:00
Tom Lane 330b4e4215 Changes of 6-Sep-02 broke pg_restore's ability to recognize tar-format
files.  Fix it.
2003-02-01 19:29:16 +00:00
Tom Lane 4b833d080b Prevent core dump when die_horribly() is called with null AH pointer.
Problem reported and fixed by Oliver Elphick.
2003-01-27 00:23:38 +00:00
Tom Lane 9f5f212475 Allow the planner to collapse explicit inner JOINs together, rather than
necessarily following the JOIN syntax to develop the query plan.  The old
behavior is still available by setting GUC variable JOIN_COLLAPSE_LIMIT
to 1.  Also create a GUC variable FROM_COLLAPSE_LIMIT to control the
similar decision about when to collapse sub-SELECT lists into their parent
lists.  (This behavior existed already, but the limit was always
GEQO_THRESHOLD/2; now it's separately adjustable.)
2003-01-25 23:10:30 +00:00
Peter Eisentraut ef7422510e Grant options, and cascading revoke. Grant options are allowed only for
users right now, not groups.  Extension of has_foo_privileges functions to
query the grant options.  Extension of aclitem type to store grantor.
2003-01-23 23:39:07 +00:00
Peter Eisentraut 980acc8329 Fix sed expression for BSD sed. 2003-01-21 10:11:52 +00:00
Tom Lane 57ce0f84f2 Fix bogus formatting of DROP DATABASE command, per Christopher Kings-Lynne. 2003-01-16 15:27:59 +00:00
Peter Eisentraut 828822bc96 Add remaining documentation tables to information schema. 2003-01-15 23:37:28 +00:00
Peter Eisentraut 2160c9177d Add sql_features table to information schema. Generate the features list
in the documentation from that same data.
2003-01-14 23:19:34 +00:00
Hiroshi Inoue de432ce39e Change Adjust_lo_type() so that it doesn't cause an error
even when cast functions are allowed to be volatile.
2003-01-13 04:28:55 +00:00
Tom Lane c83702606c Add missing <limits.h> for INT64_IS_BUSTED case. 2003-01-10 23:49:06 +00:00
Peter Eisentraut b65cd56240 Read-only transactions, as defined in SQL. 2003-01-10 22:03:30 +00:00
Peter Eisentraut b7ca9bdf18 Do not shell-quote the name of the editor, so that the editor can be a
command with arguments.
2003-01-10 21:57:44 +00:00
Bruce Momjian c9967a4909 Enhanced error/help message for pg_controldata.
Serguei Mokhov
2003-01-08 22:26:34 +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
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
Peter Eisentraut 939a59ffc6 Use our own version of getopt_long() if the OS doesn't have one. 2003-01-06 18:53:25 +00:00
Hiroshi Inoue 150ffb2d50 Adjust lo type in contrib during pg_restore so that pg_restore could
reload the type.
2003-01-03 18:05:02 +00:00
Bruce Momjian d82794ee33 Attached is a patch to provide makefiles, etc. to allow the compilation
of the libpq interface static and dynamic libraries with the freely
downloadable Borland C++ compiler version 5.5 and/or C++ Builder.

Lester Godwin
2002-12-30 21:07:26 +00:00
Tom Lane 2e1f2c3109 Make use of TCL_INCLUDE_SPEC if available (it's new in Tcl 8.4, too bad
it took 'em this long to realize it's needed...)
2002-12-30 17:19:54 +00:00
Tom Lane 6c08905d4c Remove overenthusiastic free'ing of comment dependencies; could lead to
core dump in pg_dump when dumping views having comments.  See bug #855.
2002-12-27 17:10:45 +00:00
Tom Lane b222867534 pg_dump should consider information_schema to be a system schema.
Also, tweak -C option (emit CREATE DATABASE command) to emit encoding
name rather than encoding number, for consistency with pg_dumpall
and better cross-version portability.
2002-12-21 22:45:09 +00:00
Tom Lane f1f5978603 Fix possible buffer overrun in \d command: substr(..., 128) produces
a result of at most 128 chars, but that could be more than 128 bytes.
Also ensure we don't try to pfree uninitialized pointers during error
cleanup.
2002-12-21 01:07:07 +00:00
Peter Eisentraut 1b42ad7e59 Initial version of the SQL information schema 2002-12-14 00:24:35 +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 1b706651b6 Here's the patch I mentioned on HACKERS to fix up ALTER command tab
completion. Note that it's based on 7.3 tarball, not CVS HEAD, or 7.3rel
branch. Damn, looking at CVS, this will patch into 7.3rel (just tested,
it does) probably collide with Rod Taylor's patch adding ALTER TRIGGER
stuff. O.K, second patch attached against HEAD - not tested, hand
merged.

Ross Reedstrom
2002-12-13 05:36:24 +00:00
Tom Lane b73251686f Don't produce bogus COPY command when there are no undropped columns
in a table.
2002-12-12 21:03:24 +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
Tom Lane 4ad0aa3efb Don't force rebuild of all of backend/parser when we only need
keywords.o.
2002-12-12 21:02:00 +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
Tom Lane 9ee7409ef7 Fix pg_dump failure against 7.1 or older servers, per
report from Philip Warner.
2002-12-01 18:44:00 +00:00
Bruce Momjian 3026493ff2 This patch fixes two tiny memory leaks in pg_dump and two in pg_dumpall.
Neil Conway
2002-11-29 16:38:42 +00:00
Bruce Momjian 9645fa8ccd Remove check for pg_group file as part of initdb -W password assignment
--- not needed.
2002-11-25 21:41:46 +00:00
Bruce Momjian f9e23827b0 Heres a patch which will create the sql_help.h file on Win32 if it
doesn't already exist using an installed copy of perl. I've tested it
using perl v5.6.1 from ActiveState and all appears to work.

Al Sutton
2002-11-23 04:06:32 +00:00
Bruce Momjian 1b7f3cc02d This patch implements FOR EACH STATEMENT triggers, per my email to
-hackers a couple days ago.

Notes/caveats:

        - added regression tests for the new functionality, all
          regression tests pass on my machine

        - added pg_dump support

        - updated PL/PgSQL to support per-statement triggers; didn't
          look at the other procedural languages.

        - there's (even) more code duplication in trigger.c than there
          was previously. Any suggestions on how to refactor the
          ExecXXXTriggers() functions to reuse more code would be
          welcome -- I took a brief look at it, but couldn't see an
          easy way to do it (there are several subtly-different
          versions of the code in question)

        - updated the documentation. I also took the liberty of
          removing a big chunk of duplicated syntax documentation in
          the Programmer's Guide on triggers, and moving that
          information to the CREATE TRIGGER reference page.

        - I also included some spelling fixes and similar small
          cleanups I noticed while making the changes. If you'd like
          me to split those into a separate patch, let me know.

Neil Conway
2002-11-23 03:59:09 +00:00
Tom Lane 1f79360907 Quote database name properly when invoking pg_dump. Per report from
Christopher Kings-Lynne.
2002-11-22 03:09:43 +00:00
Tom Lane 6c1d4662af Finish implementation of hashed aggregation. Add enable_hashagg GUC
parameter to allow it to be forced off for comparison purposes.
Add ORDER BY clauses to a bunch of regression test queries that will
otherwise produce randomly-ordered output in the new regime.
2002-11-21 00:42:20 +00:00
Bruce Momjian 5b7eb4dd45 Clean up psql:
Add simple ALTER DATABASE, ALTER TRIGGER, CHECK POINT, CREATE
CONVERSION, CREATE DOMAIN, CREATE LANGUAGE, DEALLOCATE, DROP CONVERSION,
DROP DOMAIN, DROP LANGUAGE, EXECUTE, PREPARE

Complete CAST in CREATE CAST and DROP CAST but doesn't suggest what
should follow.

Add many more SET / SHOW variables to the list.  Taken from SHOW ALL
output.

Complete a case sensitive search to allow \dD, \dd, \dS, \ds, \h, \H to
complete properly.  But there are no matches, then try a case
insensitive search to allow case conversion.  Add all missing help
options.

\Q<tab>    -> \q
\dD<tab>   -> \dD
\dd<tab>   -> \dd
\D<tab><tab><tab> -> \d (with listing of \d? commands)
sel<tab>   -> SELECT

Rod Taylor
2002-11-15 03:07:52 +00:00
Bruce Momjian 93e54678a3 pg_dump for domain constraints.
Rod Taylor
2002-11-15 02:52:18 +00:00
Bruce Momjian d36aa2e885 Rename:
! #show_parser_stats = false
! #show_planner_stats = false
! #show_executor_stats = false
! #show_statement_stats = false

TO:

! #log_parser_stats = false
! #log_planner_stats = false
! #log_executor_stats = false
! #log_statement_stats = false
2002-11-15 00:47:22 +00:00
Bruce Momjian 001d5a7aa5 Rename server_min_messages to log_min_messages. Part of consolidation
of log_ settings.
2002-11-14 23:53:27 +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
Tom Lane d2c744aa56 Add extra_float_digits GUC parameter to allow adjustment of displayed
precision for float4, float8, and geometric types.  Set it in pg_dump
so that float data can be dumped/reloaded exactly (at least on platforms
where the float I/O support is properly implemented).  Initial patch by
Pedro Ferreira, some additional work by Tom Lane.
2002-11-08 17:37:52 +00:00
Tom Lane 16cc5372e4 Avoid malloc(0) when printing a table of no columns. On some platforms
this returns NULL, which confuses the code.
2002-11-01 15:12:19 +00:00
Bruce Momjian 6d8c3d4eb3 Add popen/pclose -> _popen/_pclose() mapping for Win32. 2002-10-29 19:35:33 +00:00
Bruce Momjian b064206c09 getopt.c now in /port, for MS Win. 2002-10-29 04:23:30 +00:00
Tom Lane 7a0671a37c Suppress compile warnings on OS X. 2002-10-27 02:52:10 +00:00
Bruce Momjian 3fd6d3260f Change to fseeko(), per Philip. 2002-10-25 03:47:30 +00:00
Bruce Momjian fc5c577e34 Allow fseeko in pg_dump only if fseeko() will work for all supported file
sizes.
2002-10-25 01:33:17 +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
Bruce Momjian 2b287020f4 Allow 8-byte off_t to properly pg_dump, from Philip Warner with mods by Bruce. 2002-10-22 19:15:23 +00:00
Bruce Momjian 2110be0465 Cleanup for CLUSTERDB failure:
On Sat, Oct 19, 2002 at 12:11:32AM +0200, Peter Eisentraut wrote:
> $ ./clusterdb
> psql: could not connect to server: No such file or directory
>         Is the server running locally and accepting
>         connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
> psql: could not connect to server: No such file or directory
>         Is the server running locally and accepting
>         connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
> clusterdb: While clustering peter, the following failed:
> $
>
> This could probably handled a little more gracefully.

Yes, sorry.  A patch for this is attached.  Please apply.

Alvaro Herrera
2002-10-21 20:32:33 +00:00
Peter Eisentraut 20f77d79a2 Translation updates 2002-10-21 18:51:03 +00:00
Tatsuo Ishii 29eabaa958 Returns exit status 1 if invalid encoding name or
encoding number is given.
2002-10-20 11:33:48 +00:00
Tom Lane 0d93e385b0 Make psql's \df display functions that return sets as having return type
'setof something'; formerly you could not tell at all that the function
returns set.
2002-10-19 20:50:44 +00:00
Tom Lane 44dc9c1faa Fix psql's \copy to accept table names containing schemas, as well as
a column list.  Bring its parsing of quoted names and quoted strings
somewhat up to speed --- I believe it now handles all non-error cases
the same way the backend would, but weird boundary conditions are not
necessarily done the same way.
2002-10-19 00:22:14 +00:00
Peter Eisentraut 4cff161703 Improve formatting of --help output. 2002-10-18 22:05:36 +00:00
Tom Lane dad34ba567 Un-break createlang build. 2002-10-18 19:35:28 +00:00
Bruce Momjian aa4c702eac Update /contrib for "autocommit TO 'on'".
Create objects in public schema.

Make spacing/capitalization consistent.

Remove transaction block use for object creation.

Remove unneeded function GRANTs.
2002-10-18 18:41:22 +00:00
Bruce Momjian cda776e613 Make pg_dump save for autocommit = off. 2002-10-16 05:46:54 +00:00
Bruce Momjian 6b0e166644 Improve appearance of SET command. 2002-10-16 03:44:28 +00:00
Bruce Momjian 5d8c67462d Fix script to handle autocommit = 'off' by prepending autocommit 'on' to
the start of the psql commandline.  This is better than adding BEGIN/END
because it handles multiple queries well, and allows the return code for
psql to return the proper value.
2002-10-16 03:24:09 +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
Peter Eisentraut 50634c13e4 Translation updates 2002-10-14 19:04:28 +00:00
Tom Lane f94e5bde60 psql thought that backslash is an escape character inside double quotes.
It isn't.
2002-10-12 23:09:34 +00:00
Bruce Momjian ba8e20a6dd > Alvaro Herrera <alvherre@atentus.com> writes:
> > I'm looking at pg_dump/common.c:flagInhAttrs() and suspect that it can
> > be more or less rewritten completely, and probably should to get rigth
> > all the cases mentioned in the past attisinherited discussion.  Is this
> > desirable for 7.3?  It can probably be hacked around and the rewrite
> > kept for 7.4, but I think it will be much simpler after the rewrite.
>
> If it's a bug then it's fair game to fix in 7.3.  But keep in mind that
> pg_dump has to behave at least somewhat sanely when called against older
> servers ... will your rewrite behave reasonably if the server does not
> offer attinhcount values?

Nah.  I don't think it's worth it: I had forgotten that older versions
should be supported.  I just left the code as is and added a
version-specific test.

This patch allows pg_dump to dump correctly local definition of columns.
In particular,

CREATE TABLE p1 (f1 int, f2 int);
CREATE TABLE p2 (f1 int);
CREATE TABLE c () INHERITS (p1, p2);
ALTER TABLE ONLY p1 DROP COLUMN f1;
CREATE TABLE p3 (f1 int);
CREATE TABLE c2 (f1 int) INHERITS (p3);

Will be dumped as
CREATE TABLE p1 (f2 int);
CREATE TABLE p2 (f1 int);
CREATE TABLE c (f1 int) INHERITS (p1, p2);
CREATE TABLE c2 (f1 int) INHERITS (p3);

(Previous version will dump
CREATE TABLE c () INHERITS (p1, p2)
CREATE TABLE c2 () INHERITS (p3) )

Alvaro Herrera
2002-10-09 16:20:25 +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 71e74a2f58 Re-enable pg_resetxlog to accept -l values in hexadecimal (it used to
be able to do that, but the ability seems to have got lost in the
shuffle).  Add a -o nextOID switch for completeness.  Improve the
documentation to explain how and why to use these switches.
2002-10-02 21:30:13 +00:00
Tom Lane 388ad64dc7 pg_resetxlog was missing support for the pg_control fields added in 7.3. 2002-10-02 19:45:47 +00:00
Bruce Momjian 3468ed586a > Fix clusterdb to be schema-aware
Please apply the patch attached and this should be solved.

Alvaro Herrera
2002-09-27 17:51:10 +00:00
Tom Lane c6367df506 Change default privileges for languages and functions to be PUBLIC USAGE
and PUBLIC EXECUTE, respectively.  Per discussion about easing updates
from prior versions.
2002-09-24 23:14:25 +00:00
Peter Eisentraut 2972fd5d83 Translation updates, some messages tweaked. 2002-09-22 20:57:21 +00:00
Tom Lane 286fb25243 Make \dS work more like it used to, viz, show only system objects. 2002-09-22 20:44:22 +00:00
Tom Lane b26dfb9522 Extend pg_cast castimplicit column to a three-way value; this allows us
to be flexible about assignment casts without introducing ambiguity in
operator/function resolution.  Introduce a well-defined promotion hierarchy
for numeric datatypes (int2->int4->int8->numeric->float4->float8).
Change make_const to initially label numeric literals as int4, int8, or
numeric (never float8 anymore).
Explicitly mark Func and RelabelType nodes to indicate whether they came
from a function call, explicit cast, or implicit cast; use this to do
reverse-listing more accurately and without so many heuristics.
Explicit casts to char, varchar, bit, varbit will truncate or pad without
raising an error (the pre-7.2 behavior), while assigning to a column without
any explicit cast will still raise an error for wrong-length data like 7.3.
This more nearly follows the SQL spec than 7.2 behavior (we should be
reporting a 'completion condition' in the explicit-cast cases, but we have
no mechanism for that, so just do silent truncation).
Fix some problems with enforcement of typmod for array elements;
it didn't work at all in 'UPDATE ... SET array[n] = foo', for example.
Provide a generalized array_length_coerce() function to replace the
specialized per-array-type functions that used to be needed (and were
missing for NUMERIC as well as all the datetime types).
Add missing conversions int8<->float4, text<->numeric, oid<->int8.
initdb forced.
2002-09-18 21:35:25 +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
Peter Eisentraut d73f8137d2 Translation updates 2002-09-14 13:46:24 +00:00
Bruce Momjian b2711a0aee > BTW, clusterdb is not schema-aware and will surely fail in any database
> where more than one schema is in use, because it doesn't trouble to
> schema-qualify table names.

Ok, the following patch should solve this concern.  It also tries to
connect as little times as possible (the previous one would connect one
time per table plus one per database; this one connects two times per
database).

Alvaro Herrera
2002-09-12 00:18:14 +00:00
Bruce Momjian 6309033b16 Add sprompt.obj to Win32 makefiles. 2002-09-11 17:36:13 +00:00
Bruce Momjian 68ba17d406 Add comment about sharing of sprompt.c file. 2002-09-11 17:32:37 +00:00
Tom Lane 87e76d0d4a Fix portability problem (size_t != int). 2002-09-10 18:25:13 +00:00
Peter Eisentraut 6555177f24 Use different sed separator for configure arguments. 2002-09-09 18:35:04 +00:00
Peter Eisentraut 40853dd445 Allow pg_dumpall to work with previous releases again. Don't pass the -c
option down to pg_dump, where it's useless, and clarify the meaning of -c
in the documentation.
2002-09-07 16:14:33 +00:00
Peter Eisentraut 123baf8310 Fix help output. 2002-09-07 16:12:27 +00:00
Peter Eisentraut 38e444aae6 Make sure the pg_dump tar archiver can handle members larger than 2 GB, but
does not create members larger than allowed by the tar format.  Also, fix
the generation of the tar header to conform to POSIX.
2002-09-06 21:58:36 +00:00
Bruce Momjian 847f8b39d7 Fix printf() quote handling and improper exit(), per Tom. 2002-09-06 02:33:47 +00:00
Bruce Momjian 5fc10c3d17 Remove PGPASSWORDFILE and default to always trying $HOME/.pgpass.
Cleanup up memory allocation for $HOME in related psql places.

Update mention of $HOME/.pgpass in the docs;  add mention in pg_dumpall.
2002-09-05 22:05:50 +00:00
Tom Lane 5b69f695ac Seems like a good idea for template1 to contain ANALYZE stats for the
system tables.
2002-09-05 19:56:57 +00:00
Bruce Momjian e50f52a074 pgindent run. 2002-09-04 20:31:48 +00:00
Tom Lane d61de58906 Arrange for the default permissions on a database to allow temp table
creation to world, but disallow temp table creation in template1.  Per
latest round of pghackers discussion.
I did not force initdb, but the permissions lockdown on template1 will
not take effect unless you do one (or manually REVOKE TEMP ON DATABASE template1 FROM public).
2002-09-03 22:17:35 +00:00