Commit Graph

318 Commits

Author SHA1 Message Date
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
Bruce Momjian 1dc3498251 Standard pgindent run for 8.1. 2005-10-15 02:49:52 +00:00
Peter Eisentraut 1c25594549 Improve messages 2005-09-28 13:11:26 +00:00
Tom Lane e1a7d1b9f3 Avoid changing stdin/stdout to binary mode on Windows unless that is
really the source or destination of the archive.  I think this will
resolve recent complaints that password prompting is broken in pg_restore
on Windows.  Note that password prompting and reading from stdin is an
unworkable combination on Windows ... but that was true anyway.
2005-09-11 00:36:14 +00:00
Tom Lane 188c7c8ccf Add ALTER TABLE ENABLE/DISABLE TRIGGER commands. Change pg_dump to
use these instead of its previous hack of changing pg_class.reltriggers.
Documentation is lacking, will add that later.
Patch by Satoshi Nagayasu, review and some extra work by Tom Lane.
2005-08-23 22:40:47 +00:00
Tom Lane 83357da684 Cause ALTER INDEX OWNER to generate a warning and do nothing, rather than
erroring out as it has done for the last couple weeks.  Document that this
form is now ignored because indexes can't usefully have different owners
from their parent tables.  Fix pg_dump to not generate ALTER OWNER commands
for indexes.
2005-08-22 19:40:37 +00:00
Tom Lane 721e53785d Solve the problem of OID collisions by probing for duplicate OIDs
whenever we generate a new OID.  This prevents occasional duplicate-OID
errors that can otherwise occur once the OID counter has wrapped around.
Duplicate relfilenode values are also checked for when creating new
physical files.  Per my recent proposal.
2005-08-12 01:36:05 +00:00
Tom Lane 7a28de2052 pg_dump can now dump large objects even in plain-text output mode, by
using the recently added lo_create() function.  The restore logic in
pg_restore is greatly simplified as well, since there's no need anymore
to try to adjust database references to match a new set of blob OIDs.
2005-06-21 20:45:44 +00:00
Bruce Momjian ebc8649892 Since I needed this feature badly, I added the -n / --schema switch to
pg_restore. It restores the given schemaname only. It can be used in
conjunction with the -t and other switches to make the selection very
fine grained.

Richard van den Bergg, CISSP
2005-06-09 17:56:51 +00:00
Tom Lane f9ad8a2802 Guard against duplicate IDs in input file in SortTocFromFile().
Per report from Brian Hackett.
2005-05-17 17:30:29 +00:00
Neil Conway 47458f8c2f GCC 4.0 includes a new warning option, -Wformat-literal, that emits
a warning when a variable is used as a format string for printf()
and similar functions (if the variable is derived from untrusted
data, it could include unexpected formatting sequences). This
emits too many warnings to be enabled by default, but it does
flag a few dubious constructs in the Postgres tree. This patch
fixes up the obvious variants: functions that are passed a variable
format string but no additional arguments.

Most of these are harmless (e.g. the ruleutils stuff), but there
is at least one actual bug here: if you create a trigger named
"%sfoo", pg_dump will read uninitialized memory and fail to dump
the trigger correctly.
2005-04-30 08:08:51 +00:00
Tom Lane 348f856dc5 Revert addition of poorly-thought-out DUMP TIMESTAMP archive entry,
which induced bug #1597 in addition to having several other misbehaviors
(like labeling the dump with a completion time having nothing to do with
reality).  Instead just print out the desired strings where RestoreArchive
was already emitting the 'PostgreSQL database dump' and
'PostgreSQL database dump complete' strings.
2005-04-15 16:40:36 +00:00
Tom Lane 2e629080f7 Put 'dump complete' message in the right place, so it comes out where
it's supposed to when --file option is used.
2005-03-18 17:32:55 +00:00
Bruce Momjian 0542b1e2fe Use _() macro consistently rather than gettext(). Add translation
macros around strings that were missing them.
2005-02-22 04:43:23 +00:00
Tom Lane 9d58b9645e Make pg_dump and pg_restore handle binary archive formats correctly
when using stdout/stdin on Windows.
2005-01-26 19:44:43 +00:00
Tom Lane fd5437c78b Fix breakage created by addition of separate 'acl pass' in pg_dump.
Also clean up incredibly poor style in TocIDRequired() usage.
2005-01-25 22:44:31 +00:00
Tom Lane 3e2e58ba37 New routine _getObjectDescription() failed to cope with some aspects of
pre-7.3 pg_dump archive files: namespace isn't there, and in some cases
te->tag may already be quotified.  Per report from Alan Pevec and
followup testing.
2005-01-23 00:03:54 +00:00
Tom Lane 38498a28df Clean up pg_dump's handling of ownership for indexes (including
pkey/unique constraint indexes) and schemas.  Per report from
Michael Fuhr.
2005-01-11 05:14:13 +00:00
Tom Lane 04baa0ebf9 Update pg_dump to use SET DEFAULT_TABLESPACE instead of explicit
tablespace clauses; this should improve compatibility of dump files.
Philip Warner, some rework by Tom Lane.
2004-11-06 19:36:02 +00:00
Peter Eisentraut 77c0204a37 Message styling 2004-10-22 16:04:35 +00:00
Tom Lane 07ccbeb360 Include schema name in pg_restore -l output, per request from Phil Endecott. 2004-10-08 15:03:26 +00:00
Tom Lane 1d681d6cee Fix some problems with restoring databases owned by non-superusers,
as per bug #1249; and remove the last vestiges of using \connect to
change authorization.
2004-09-10 20:05:18 +00:00
Tom Lane c7040429e7 Fix obviously-utterly-untested noTocComments code. 2004-08-30 19:44:14 +00:00
Bruce Momjian b6b71b85bc Pgindent run for 8.0. 2004-08-29 05:07:03 +00:00
Bruce Momjian f7168bd44c They are two different problems; the TOC entry is important for any
multiline command  or to rerun the command easily later.

Whereas displaying the failed SQL command is a matter of fixing the
error
messages.

The latter is complicated by failed COPY commands which, with
die-on-errors
off, results in the data being processed as a command, so dumping the
command will dump all of the data.

In the case of long commands, should the whole command be dumped? eg.
(eg.
several pages of function definition).

In the case of the COPY command, I'm not sure what to do. Obviously, it
would be best to avoid sending the data, but the data and command are
combined (from memory). Also, the 'data' may be in the form of INSERT
statements.

Attached patch produces the first 125 chars of the command:

pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC Entry 26; 1255 16449270
FUNCTION
plpgsql_call_handler() pjw
pg_restore: [archiver (db)] could not execute query: ERROR:  function
"plpgsql_call_handler" already exists with same argument types
     Command was: CREATE FUNCTION plpgsql_call_handler() RETURNS
language_handler
     AS '/var/lib/pgsql-8.0b1/lib/plpgsql', 'plpgsql_call_han...
pg_restore: [archiver (db)] Error from TOC Entry 27; 1255 16449271
FUNCTION
plpgsql_validator(oid) pjw
pg_restore: [archiver (db)] could not execute query: ERROR:  function
"plpgsql_validator" already exists with same argument types
     Command was: CREATE FUNCTION plpgsql_validator(oid) RETURNS void
     AS '/var/lib/pgsql-8.0b1/lib/plpgsql', 'plpgsql_validator'
     LANGU...

Philip Warner
2004-08-20 20:00:34 +00:00
Bruce Momjian daa076c4fd > Please find attached a submission to add a "exit on error" option to
> pg_restore, as it seems that some people have scripts that rely on the
> previous "abort on error" default behavior when restoring data with a
> direct connection.
>
> Fabien Coelho
2004-08-20 04:20:23 +00:00
Tom Lane 2193121fa9 Fix breakage with PUBLIC schema. Try to untwist the remarkably contorted
logic a little bit.
2004-08-13 21:37:28 +00:00
Tom Lane 576856b698 Dump comments on columns of composite types.
Instead of putting all the OWNER TO commands at the end, it dumps then
after each object.  This is WAY more readable and nice.  ACLs are still
at the end.

Christopher Kings-Lynne
2004-08-04 17:13:03 +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
Tom Lane 465edca3ec Fix incorrect tracking of session authorization in the presence of ACLs
that contain rights granted by non-owners.  Per bug report from
Nishad Prakash.
2004-07-19 21:02:17 +00:00
Bruce Momjian dc0e76ca36 Change pg_dump to use ALTER OWNER commands instead of SET SESSION
AUTHORIZATION commands by default.  Move all GRANT and REVOKE commands
to the end of the dump to avoid restore failures in several situations.
Bring back --use-set-session-authorization option to get previous SET
behaviour

Christopher Kings-Lyne
2004-07-13 03:00:17 +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 ec7c4c1b66 Please find attached a small patch so that "pg_restore" ignores some sql
errors. This is the second submission, which integrates Tom comments about
localisation and exit code. I also added some comments about one sql
command which is not ignored.

Fabien COELHO
2004-04-22 02:39:10 +00:00
Bruce Momjian f23cce73b3 Use the new GUC variable default_with_oids in pg_dump, rather than using
WITH/WITHOUT OIDS in dump files.  This makes dump files more portable.

I have updated the pg_dump version so old binary dumps will load fine.

Pre-7.5 dumps use WITHOUT OIDS in SQL were needed, so they should be
fine.
2004-03-24 03:06:08 +00:00
Tom Lane 9e733eab69 Modify pg_dump so that the preferred dump order is by name within
object types, rather than by OID.  This should help ensure consistent
dump output from databases that are logically the same but have different
histories, per recent discussion about 'diffing' databases.  The patch
is bulky because of renaming of fields, but not very complicated.
Also, do some tweaking to cause BLOB restoration to be done in a better
order, and clean up pg_restore's textual output to exactly match pg_dump.
2004-03-03 21:28:55 +00:00
Tom Lane 92bec9a0bc Cause pg_dump to emit a 'SET client_encoding' command at the start of
any restore operation, thereby ensuring that dumped data is interpreted
the same way it was dumped even if the target database has a different
encoding.  Per suggestions from Pavel Stehule and others.  Also,
simplify scheme for handling check_function_bodies ... we may as well
just set that at the head of the script.
2004-02-24 03:35:19 +00:00
Tom Lane 9a4ef0c562 Fix ReadOffset() to work correctly when off_t is wider than int. 2004-01-04 04:02:15 +00:00
Tom Lane 005a1217fb Massive overhaul of pg_dump: make use of dependency information from
pg_depend to determine a safe dump order.  Defaults and check constraints
can be emitted either as part of a table or domain definition, or
separately if that's needed to break a dependency loop.  Lots of old
half-baked code for controlling dump order removed.
2003-12-06 03:00:16 +00:00
PostgreSQL Daemon 969685ad44 $Header: -> $PostgreSQL Changes ... 2003-11-29 19:52:15 +00:00
Tom Lane 3b64171edb Complain if pg_restore is given both -d and -f options; this suggests
the user is confused about whether -f is input or output file.
2003-10-20 21:05:12 +00:00
Tom Lane ef88199f61 Issue 'SET check_function_bodies = false' to suppress possible restore
failures in SQL functions, due to forward references or unqualified
references to objects in other schemas.  Per recent discussion.
2003-10-03 20:10:59 +00:00
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
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
Bruce Momjian 089003fb46 pgindent run. 2003-08-04 00:43:34 +00:00
Peter Eisentraut c154fc3a20 Apply message style guide to frontend programs. 2003-07-23 08:47:41 +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 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 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 b9e8ffcd5d pg_restore failed to restore blobs if -X disable-triggers is specified. 2003-03-09 19:38: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 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 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
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
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 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 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 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 cda776e613 Make pg_dump save for autocommit = off. 2002-10-16 05:46:54 +00:00
Bruce Momjian e50f52a074 pgindent run. 2002-09-04 20:31:48 +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
Peter Eisentraut 6faf8024fa Enable large file support.
Use off_t and size_t in pg_dump to handle file offset arithmetic correctly.
2002-08-20 17:54:45 +00:00
Peter Eisentraut c828ec8820 Make pg_dump output more portable and more pleasing to look at.
The -n and -N options were removed.  Quoting is now smart enough to
supply quotes if and only if necessary.

Numerical types are now printed without quotes, except in cases of
special values such as NaN.

Boolean values printed as true and false.

Most string literals now do not escape whitespace characters (newlines,
etc.) for portability.

SET SESSION AUTHORIZATION argument is a string literal, to follow SQL.

Made commands output by pg_dump use consistent spacing and indentation.
2002-08-18 09:36:26 +00:00
Peter Eisentraut 029aa97f2d Make sure all clients have the same understanding of default user name
and database.  In particular, make script wrappers understand the
PGDATABASE environment variable.
2002-08-10 16:57:32 +00:00
Bruce Momjian d59478c4f3 More clearly document in pg_dump when we are dealing with an object name
as it appears in the schema dump, and index tags.
2002-07-04 15:35:07 +00:00
Bruce Momjian 3722dee6d9 Document function args are required for pg_restore -P.
Fix pg_dump to not quote the function name in the storage tag.
Fix pg_dump so GRANT/REVOKE(ACL) tag entries are not quoted, for
	consistency.
Fix pg_restore to properly handle quotes and some spaces in -P.
2002-07-04 03:04:55 +00:00
Bruce Momjian f4590995c9 The attached patch fixes 2 memory leaks in pg_dump, as well as corrects
a spelling mistake and deletes an antiquated comment.

Neil Conway
2002-07-02 05:49:52 +00:00
Tom Lane 9ca89b4f8c Another place that needs schema qualification. 2002-05-29 01:49:57 +00:00
Tom Lane 49bf04ba8c Fix some more not-schema-aware queries in pg_dump. Also fix some places
that would do the wrong thing with BLOB OIDs exceeding 2G.
2002-05-29 01:38:56 +00:00
Tom Lane 36a1e732a6 Rework pg_dump namespace search criteria so that dumping of user objects
having names conflicting with system objects will work --- the search
path is now user-schema, pg_catalog rather than implicitly the other way
around.  Note this requires being careful to explicitly qualify references
to system names whenever pg_catalog is not first in the search path.
Also, add support for dumping ACLs of schemas.
2002-05-28 22:26:57 +00:00
Tom Lane 9f0ae0c820 First pass at schema-fying pg_dump/pg_restore. Much to do still,
but the basic capability seems to work.
2002-05-10 22:36:27 +00:00
Tom Lane 340b66cc70 Cause fmtId to always use its internal buffer for the returned value,
in hopes of making erroneous usage more apparent.  Per discussion 15-Apr.
2002-05-06 17:34:45 +00:00
Bruce Momjian 8be68479dc Remove compile warnings for lo dump by casting to char *. 2002-04-24 14:03:22 +00:00
Bruce Momjian e975123454 Speed improvement for large object restore.
Mario Weilguni
2002-04-24 02:21:04 +00:00
Tom Lane 15c30b6f9a Be more wary about mixed-case database names and user names. Get
the CREATE DATABASE command right in pg_dump -C case.
2002-02-11 00:18:20 +00:00
Tom Lane 6a67d9def0 Fix failure to reconnect as sequence's owner before issuing setval(). 2002-02-06 17:27:50 +00:00
Bruce Momjian 69f909ba10 You might want to run pg_indent on pg_backup_db.c however ...
tom lane
2002-01-18 19:17:05 +00:00
Tom Lane bb698c25c7 Fix pg_restore to handle the 'set max oid' entry correctly in archives
dumped by pg_dump -o.  Per bug report posted by Bruce; fix is from
Philip Warner, reviewed by Tom Lane.
2002-01-18 17:13:51 +00:00
Tom Lane 64af43a15f Add casts to suppress compiler warnings observed on Darwin platform
(surprised no one has reported these yet...)
2001-11-08 04:05:13 +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
Philip Warner 1ef62bb6fc - Fix compiler warning in pg_restore
- Fix handling of {data/schema}-only restores when using a full
  backup file; prior version was restoring schema in data-only
  restores. Added enum to make code easier to understand.
2001-11-04 04:05:36 +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 b662e321c5 Forbid the switch combination --clean --create, which is pointless
(why bother dropping individual objects in a just-created database?)
as well as dangerous (as the code stands, the drops will be issued in
the wrong database, namely the one you were originally connected to).
2001-10-23 21:26:44 +00:00
Peter Eisentraut fdf07fe14f For consistency with the rest of PostgreSQL, rename BLOBs to large objects
in messages and documentation.
2001-09-21 21:58:30 +00:00
Peter Eisentraut 627c0d4472 Add option to output SET SESSION AUTHORIZATION commands rather than
\connect, to avoid possible password prompts and such, at the drawback of
having to have superuser access.
2001-08-22 20:23:24 +00:00
Peter Eisentraut 30c975e2cb One more round of translations and slight message tweaks 2001-08-19 22:17:03 +00:00
Peter Eisentraut a0c449a0f8 Make pg_dump handle the new privileges.
Don't hardcode the maximum accepted server version, use PG_VERSION instead.
Install a notice processor so notices are handled like error messages.
Word smithing.
2001-08-12 19:02:39 +00:00
Peter Eisentraut 30ab5bd43d More message munging and localization for pg_dump, especially the
--verbose messages, which had not been considered so far.  Output to the
terminal should okay now; comments written into the dump are still English
only, which may or may not be the desirable thing.
2001-07-03 20:21:50 +00:00
Peter Eisentraut b559382134 National language support for pg_dump and pg_restore. Combined with big
message clean up.
2001-06-27 21:21:37 +00:00
Peter Eisentraut f000ffd28e Add -U and -W options to pg_dump and friends to support non-interactive
specification of username (like in psql).  pg_dumpall now works with
password authentication.
2001-05-17 21:12:49 +00:00
Philip Warner bb30d49a2a - Don't dump COMMENTs in data-only dumps
- Fix view dumping SQL for V7.0
 - Fix bug when getting view oid with long view names
 - Treat SEQUENCE SET TOC entries as data entries rather than schema
   entries.
 - Make allowance for data entries that did not have a data dumper
   routine (eg. SEQUENCE SET)
2001-05-12 01:03:59 +00:00
Philip Warner 8dc42a3aa2 - Fixed CONSTRAINT TRIGGER dump to record tgconstrelid properly
- pgsql v7.0 compatbility
2001-04-25 07:03:20 +00:00
Philip Warner 232d8fa3c4 - Get view OID based on rule OID not base table OID
- Fix crash due to null string pointer in some tar files with some libs
2001-04-14 13:11:03 +00:00
Philip Warner 135040d511 Patch to put rudimentary dependency support into pg_dump. This addresses
the UDT/function order problem.

    - Rudimentary support for dependencies in archives.
      Uses dependencies to modify the OID used in sorting TOC
      entries. This will NOT handle multi-level dependencies,
      but will manage simple relationships like UDTs & their functions.

    - Treat OIDs with more respect (avoid using ints, use macros
      for conversion & comparison).
2001-04-01 05:42:51 +00:00
Bruce Momjian 9e1552607a pgindent run. Make it all clean. 2001-03-22 04:01:46 +00:00
Philip Warner cfeccdf80a - Added CVS headers to files
- Avoid forcing table name to lower case in FixupBlobXrefs
 - Removed fmtId calls for all ArchiveEntry name fields. This fixes
   quoting problems in trigger enable/disable code for mixed case
   table names, and avoids commands like 'pg_restore -t '"TblA"'
2001-03-19 02:35:29 +00:00
Philip Warner 5c1b00450c Fixed but in _enableTriggersIfNecessary introduced by previous patches by me
which caused segfault in a data-only retore with BLOBs
2001-03-18 03:45:12 +00:00
Philip Warner ccca223b5c - Use subselect when enabling triggers,
- Use exact table names when enabling/disabling triggers
2001-03-13 13:18:44 +00:00
Philip Warner aa28eebf4c - Only disable triggers in DataOnly (or implied data-only) restores.
- Change -U option to -L to allow -U to specify username in future. (pg_restore)
2001-03-06 04:08:04 +00:00
Tom Lane 2b0f8ae009 Fix pg_dump crashes caused by bogus use of va_start/va_end (only seen
on some platforms, which is not too surprising considering how platform
specific these macros must be).
2001-02-23 22:52:32 +00:00
Bruce Momjian 51cd037746 The following patch is required for successful compilation on Irix.
Robert E. Bruccole
2001-01-29 00:11:41 +00:00
Philip Warner 7fcd675dc3 When dropping the schema, reconnect as owner of each object. 2001-01-27 12:35:29 +00:00
Philip Warner 06ef1ef2ec - Check ntuples == 1 for various SELECT statements.
- Fix handling of --tables=* (multiple tables never worked properly, AFAICT)
- strdup() the current user in DB routines
- Check results of IO routines more carefully.
- Check results of PQ routines more carefully.

Have not fixed index output yet.
2001-01-12 04:32:07 +00:00
Tom Lane 5cf81b3c06 Silence compiler warning. 2000-12-07 02:52:27 +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
Philip Warner 44954fae08 Added long-standing transaction when restoring BLOBS (uses commit every BLOB_BATCH_SIZE)
Prevent dumping of languages from template1.
2000-10-31 14:20:30 +00:00
Philip Warner 3cf6e94844 Use new datlastsysoid field in pg_database + some cleanups & fixes 2000-10-22 18:13:09 +00:00
Philip Warner 1b1dbb861d Fix bug in sequence dumping using new setval function 2000-10-13 00:43:31 +00:00
Philip Warner c2e302071f - Only disable triggers for the table being loaded
- disable triggers prior to BLOB load
- better query for loading blob xrefs
- Fixes to error handling code
2000-08-05 09:57:46 +00:00
Philip Warner 92bd532c1e - Added --create, --no-owner, --superuser, --no-reconnect (pg_dump & pg_restore)
- Added code to dump 'Create Schema' statement (pg_dump)
- Don't bother to disable/enable triggers if we don't have a superuser (pg_restore)
- Cleaned up code for reconnecting to database.
- Force a reconnect as superuser before enabling/disabling triggers.
- Added & Removed --throttle (pg_dump)
- Fixed minor bug in language dumping code: expbuffres were not being reset.
- Fixed version number initialization in _allocAH (pg_backup_archiver.c)
- Added second connection when restoring BLOBs to allow temp. table to survive
  (db reconnection causes temp tables to be lost).
2000-08-01 15:51:45 +00:00
Bruce Momjian 56c754a555 Some pedantic compile syntax errors to fix with the following patch
for today's snapshot

Andreas
2000-07-27 19:49:24 +00:00
Philip Warner bb080400f8 - no longer put ACLs at end of dump
- connect as appropriate user in pg_restore with db connection
- dump owner of rule in pg_dump
2000-07-24 06:24:26 +00:00
Philip Warner e8f69be054 - Support for BLOB output from pg_dump and input via pg_restore
- Support for direct DB connection in pg_restore
- Fixes in support for --insert flag
- pg_dump now outputs in modified OID order
- various other bug fixes
2000-07-21 11:40:08 +00:00
Jan Wieck 43f6ab8654 Please find attached a patch for the pg_dump directory which addresses:
- The problems Jan reported

- incompatibility with configure (now uses HAVE_LIBZ instead of HAVE_ZLIB)

- a problem in auto-detecting archive file format on piped archives

Philip Warner
2000-07-06 18:39:39 +00:00
Bruce Momjian 500b62b057 pg_dump patch from Philip Warner 2000-07-04 14:25:28 +00:00