Commit Graph

269 Commits

Author SHA1 Message Date
Bruce Momjian 1dc3498251 Standard pgindent run for 8.1. 2005-10-15 02:49:52 +00:00
Tom Lane c6b9924bec Remove the DELETEs from pg_shadow and pg_group that pg_dumpall used to
emit when given the --clean option, in favor of individual DROP ROLE
commands.  The old technique could not possibly work in 8.1, and was
never a very good idea anyway IMHO.  The DROP ROLE approach has the
defect that the DROPs will fail for roles that own objects or have
privileges, but perhaps we can improve that later.
2005-10-10 22:29:48 +00:00
Tom Lane 0845538f3a dumpUserConfig failed (in a pretty harmless way, but failed nonetheless)
to cope with a group name when dumping from a pre-8.1 installation.
Per report from Stefan Kaltenbrunner.
2005-08-28 16:31:37 +00:00
Tom Lane d42cf5a42a Add per-user and per-database connection limit options.
This patch also includes preliminary update of pg_dumpall for roles.
Petr Jelinek, with review by Bruce Momjian and Tom Lane.
2005-07-31 17:19:22 +00:00
Tom Lane 4a2972d691 Awhile back we replaced all uses of strcasecmp and strncasecmp with
pg_strcasecmp and pg_strncasecmp ... but I see some of the former have
crept back in.
Eternal vigilance is the price of locale independence, apparently.
2005-07-25 04:52:32 +00:00
Tom Lane affcb4371c Avoid use of E'', and thereby creating an unnecessary version-dependency,
by using LIKE...ESCAPE instead.  Per suggestion by andrew@supernews.
2005-07-18 19:12:09 +00:00
Tom Lane 0ed5f90d73 Try connecting to both postgres and template1 databases to do the initial
inspection of shared catalogs.  This allows pg_dumpall to continue to
work with pre-8.1 servers that likely won't have a database named postgres.
Also, suppress output of SYSID options for users and groups, since server
no longer does anything with these except emit a rude message.
There is much more to be done to update pg_dumpall for the roles feature,
but this at least makes it usable again.  Per gripe from Chris K-L.
2005-07-08 16:51:30 +00:00
Bruce Momjian bb3cce4ec9 Add E'' syntax so eventually normal strings can treat backslashes
literally.

Add GUC variables:

        "escape_string_warning" - warn about backslashes in non-E strings
        "escape_string_syntax" - supports E'' syntax?
        "standard_compliant_strings" - treats backslashes literally in ''

Update code to use E'' when escapes are used.
2005-06-26 03:04:37 +00:00
Tom Lane b49d871f6a Fix pg_dumpall to do the right thing with "postgres" database, per
Dave Page.  Also, cause it to emit rather than ignore any ACL and
datconfig options that may be set for these two databases.
2005-06-21 15:22:18 +00:00
Tom Lane 6f7fc0bade Cause initdb to create a third standard database "postgres", which
unlike template0 and template1 does not have any special status in
terms of backend functionality.  However, all external utilities such
as createuser and createdb now connect to "postgres" instead of
template1, and the documentation is changed to encourage people to use
"postgres" instead of template1 as a play area.  This should fix some
longstanding gotchas involving unexpected propagation of database
objects by createdb (when you used template1 without understanding
the implications), as well as ameliorating the problem that CREATE
DATABASE is unhappy if anyone else is connected to template1.
Patch by Dave Page, minor editing by Tom Lane.  All per recent
pghackers discussions.
2005-06-21 04:02:34 +00:00
Tom Lane c822fe05ae pg_dumpall should enforce the server version check for itself, rather
than simply passing it down to pg_dump.  Else, version-related failures
in pg_dumpall itself generate unhelpful error messages.
2005-04-18 23:47:52 +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
PostgreSQL Daemon 2ff501590b Tag appropriate files for rc3
Also performed an initial run through of upgrading our Copyright date to
extend to 2005 ... first run here was very simple ... change everything
where: grep 1996-2004 && the word 'Copyright' ... scanned through the
generated list with 'less' first, and after, to make sure that I only
picked up the right entries ...
2004-12-31 22:04:05 +00:00
Tom Lane 2ee3a720a4 Adjust help message for --no-owner, per Alvaro Herrera. 2004-12-03 18:48:19 +00:00
Tom Lane 90c3ebe4d7 Fix HAVE_OPTRESET to be HAVE_INT_OPTRESET. Typos spotted by Lorne Sunley. 2004-11-27 18:51:08 +00:00
Bruce Momjian 88fd162ef6 Allow pg_ctl to determine the server is up when getting a request for a
password.

Make password error message a #define and use it consistently.

Sean Chittenden
2004-10-16 03:10:17 +00:00
Bruce Momjian a49f6ad014 Add full path in error report for version mismatch of binaries. 2004-10-15 04:32:28 +00:00
Bruce Momjian dedb53f29c Fix pg_dumpall to use double-quote for Win32 arguments.
Luiz K. Matsumura
2004-10-06 17:02:02 +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 640d0dc0f0 Fix compiler warning in the proper way. 2004-08-08 07:00:22 +00:00
Bruce Momjian 6ec4520a5b Supress warning about zero-length format string. 2004-08-08 06:58:00 +00:00
Bruce Momjian 7ee3c35152 Allow libpgport to call memory allocation routines even though
CurrentMemoryContext is DLLIMPORT on Win32.  Work around that by
creating stubs in the backend for palloc/pstrdup.

Also fix pg_dumpall to do proper quoting on Win32.
2004-08-08 06:44:36 +00:00
Tom Lane fcbc438727 Label CVS tip as 8.0devel instead of 7.5devel. Adjust various comments
and documentation to reference 8.0 instead of 7.5.
2004-08-04 21:34:35 +00:00
Bruce Momjian 45995219a0 Here is another patch that fixes a stack of pg_dump bugs:
* Fix help text ordering

* Add back --set-session-authorization to pg_dumpall.  Updated the docs
for that.  Updated help for that.

* Dump ALTER USER commands for the cluster owner ("pgsql").  These are
dumped AFTER the create user and create database commands in case the
permissions to do these have been revoked.

* Dump ALTER OWNER for public schema (because it's possible to change
it).  This was done by adding TOC entries for the public schema, and
filtering them out at archiver time.  I also save the owner in the TOC
entry just for the public schema.

* Suppress dumping single quotes around schema_path and DateStyle
options when they are set using ALTER USER or ALTER DATABASE.  Added a
comment to the steps in guc.c to remind people to update that list.

* Fix dumping in --clean mode against a pre-7.3 server.  It just sets
all drop statements to assume the public schema, allowing it to restore
without error.

* Cleaned up text output.  eg. Don't output -- Tablespaces comment if
there are none.  Same for groups and users.

* Make the commands to DELETE FROM pg_shadow and DELETE FROM pg_group
only be output when -c mode is enabled.  I'm not sure why that hasn't
been done before?!?!

This should be good for application asap, after which I will start on
regression dumping 7.0-7.4 databases.

Christopher Kings-Lynne
2004-07-19 21:39:48 +00:00
Bruce Momjian a0db74a35c This patch adds the following options to pg_dumpall, to be passed to
pg_dump:

-S, --superuser=NAME

-O, --no-owner

-X disable-dollar-quoting, --disable-dollar-quoting

-X disable-triggers, --disable-triggers

Christopher Kings-Lynne
2004-07-12 14:35:45 +00:00
Tom Lane ba6b87f330 Fix pg_dump and pg_dumpall for new names of built-in tablespaces,
per Chris K-L.
2004-06-21 13:36:42 +00:00
Tom Lane 2467394ee1 Tablespaces. Alternate database locations are dead, long live tablespaces.
There are various things left to do: contrib dbsize and oid2name modules
need work, and so does the documentation.  Also someone should think about
COMMENT ON TABLESPACE and maybe RENAME TABLESPACE.  Also initlocation is
dead, it just doesn't know it yet.

Gavin Sherry and Tom Lane.
2004-06-18 06:14:31 +00:00
Bruce Momjian 10a3d19ad4 Handle multiple double-quoted strings using Win32's system() call.
Document limitations.
2004-06-10 16:35:18 +00:00
Bruce Momjian 3a0df651da Use single quotes around pg_dump call from pg_dumpall. 2004-06-09 17:37:28 +00:00
Bruce Momjian 7ac67fd189 Add time.h to pg_dumpall. 2004-06-09 17:05:14 +00:00
Bruce Momjian 9136613803 Add start/stop times for pg_dump/pg_dumpall when verbose output is used. 2004-06-07 20:35:57 +00:00
Bruce Momjian 641c5b565b Slight code cleanup for printf's. 2004-06-05 04:27:48 +00:00
Bruce Momjian 6870843339 Add PGETC (for pg_service.conf) and PGLOCALE (for locale dir)
environment variable processing to libpq.

The patch also adds code to our client apps so we set the environment
variable directly based on our binary location, unless it is already
set. This will allow our applications to emit proper locale messages
that are generated in libpq.
2004-06-03 00:07:38 +00:00
Bruce Momjian 228897774c Make the locale location relocatable.
Adjust get_*_path functions to be limited to MAXPGPATH.
2004-05-25 01:00:30 +00:00
Bruce Momjian bef228d1ee Add end-of-dump markers for pg_dump and pg_dumpall. 2004-05-19 21:21:26 +00:00
Bruce Momjian 9f944f0443 Adjust find_my_exec/find_other_exec() so that the return parameter is
last, not first.  This fits our style better.
2004-05-14 17:04:48 +00:00
Bruce Momjian b1ffacddfc Rename find_my_binary/find_other_binary to
find_my_exec/find_other_exec().  Remove passing of progname to these
functions as they can find that out from argv[0], which they already
have.

Make get_progname return const char *, and update all progname variables
to be const char *.
2004-05-12 13:38:49 +00:00
Bruce Momjian fda15b351a As part of the work for making relocatable installs, I have re-factored
all the code that looks for other binaries.  I move FindExec into
port/exec.c (and renamed it to find_my_binary()).  I also added
find_other_binary that looks for another binary in the same directory as
the calling program, and checks the version string.

The only behavior change was that initdb and pg_dump would look in the
hard-coded bindir directory if it can't find the requested binary in the
same directory as the caller.  The new code throws an error.  The old
behavior seemed too error prone for version mismatches.
2004-05-11 21:57:15 +00:00
Tom Lane 5ad7d65da4 Fix incorrect dumping of database LOCATION from 7.0.* servers.
Per report from Mattias Kregert.
2004-01-22 19:09:32 +00:00
PostgreSQL Daemon 969685ad44 $Header: -> $PostgreSQL Changes ... 2003-11-29 19:52:15 +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
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
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 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
Peter Eisentraut c154fc3a20 Apply message style guide to frontend programs. 2003-07-23 08:47:41 +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
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
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 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
Bruce Momjian d46e643822 Add Win32 path handling for / vs. \ and drive letters. 2003-04-04 20:42:13 +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 0c693b4926 Add missing --globals-only (long form of -g). 2003-03-06 21:45:52 +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 57ce0f84f2 Fix bogus formatting of DROP DATABASE command, per Christopher Kings-Lynne. 2003-01-16 15:27:59 +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
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
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
Peter Eisentraut 4cff161703 Improve formatting of --help output. 2002-10-18 22:05:36 +00:00
Peter Eisentraut 2972fd5d83 Translation updates, some messages tweaked. 2002-09-22 20:57:21 +00:00
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
Bruce Momjian e50f52a074 pgindent run. 2002-09-04 20:31:48 +00:00
Peter Eisentraut b1bacebea0 Fix typos. 2002-09-02 22:18:56 +00:00
Peter Eisentraut d54caa6b34 Break up the long usage messages in pg_dump and pg_restore and
unify the wording, to make life easier for translators.

from Dennis Bjorklund
2002-08-28 20:57:22 +00:00
Peter Eisentraut 2364928814 Dump ALTER DATABASE/USER ... SET ... 2002-08-28 18:25:05 +00:00
Peter Eisentraut f032bccbdd Flush output streams before calling pg_dump subprocess. 2002-08-27 21:33:41 +00:00
Peter Eisentraut 7af5ea736f Reimplement pg_dumpall in C. Currently no change in functionality,
except that it's more robust, reconnects less often, and is NLS'ed.
2002-08-27 18:57:26 +00:00