Re: [pgsql-patches] pg_dumpall -f filename option

2007-01-25 Thread Dave Page
Bruce Momjian wrote:
 Patch applied.  Thanks.
 
 Docs updated to mention Win32:
 
 Write the output to the specified file.  This is particularly useful
 on Windows because output redirection does not work for child
 processes.

I didn't say that - I said that I couldn't redirect the output from the
child processes in pgAdmin which is a limitation of the way wxWidgets
works from what I can tell. It may (in fact, quite possibly does) apply
to *nix as well. pg_dumpall output can be redirected from a command
prompt on Windows without any problem.

The patch was proposed in this case because a) it gives pg_dumpall more
consistency with pg_dump allowing pgAdmin to use pg_duampall in the same
way it already uses pg_dump, and b) I have a vague chance of getting a
patch into pg_dumpall this century :-)

Regards, Dave.


---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


Re: [pgsql-patches] pg_dumpall -f filename option

2007-01-25 Thread Bruce Momjian
Dave Page wrote:
 Bruce Momjian wrote:
  Patch applied.  Thanks.
  
  Docs updated to mention Win32:
  
  Write the output to the specified file.  This is particularly useful
  on Windows because output redirection does not work for child
  processes.
 
 I didn't say that - I said that I couldn't redirect the output from the
 child processes in pgAdmin which is a limitation of the way wxWidgets
 works from what I can tell. It may (in fact, quite possibly does) apply
 to *nix as well. pg_dumpall output can be redirected from a command
 prompt on Windows without any problem.
 
 The patch was proposed in this case because a) it gives pg_dumpall more
 consistency with pg_dump allowing pgAdmin to use pg_duampall in the same
 way it already uses pg_dump, and b) I have a vague chance of getting a
 patch into pg_dumpall this century :-)

OK, thanks.  I have copied the text from pg_dump -f option now.

-- 
  Bruce Momjian   [EMAIL PROTECTED]
  EnterpriseDBhttp://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [pgsql-patches] pg_dumpall -f filename option

2007-01-24 Thread Bruce Momjian

Patch applied.  Thanks.

Docs updated to mention Win32:

Write the output to the specified file.  This is particularly useful
on Windows because output redirection does not work for child
processes.

---
D ave Page wrote:
 Per discussion on -hackers, the attached patch adds the option
 
 -f, --file=FILENAME
 
 to pg_dumpall. In order to support this, a new (undocumented) format
 option (-Fa) is added to pg_dump which is identical to -Fp, except that
 the output file is opened for append rather than write.
 
 This patch should be applied over the top of my previous patch
 (pg_dumpall_default_database3.diff).
 
 Regards, Dave

 diff -cr pgsql.orig/doc/src/sgml/ref/pg_dumpall.sgml 
 pgsql.append/doc/src/sgml/ref/pg_dumpall.sgml
 *** pgsql.orig/doc/src/sgml/ref/pg_dumpall.sgml   Tue Jan 16 09:36:33 2007
 --- pgsql.append/doc/src/sgml/ref/pg_dumpall.sgml Tue Jan 16 11:19:05 2007
 ***
 *** 128,133 
 --- 128,143 
  /para
 /listitem
/varlistentry
 +  
 +  varlistentry
 +   termoption-f replaceable 
 class=parameterfilename/replaceable/option/term
 +   termoption--file=replaceable 
 class=parameterfilename/replaceable/option/term
 +   listitem
 +para
 + Write the output to the specified file.
 +/para
 +   /listitem
 +  /varlistentry
   
varlistentry
 termoption-g/option/term
 diff -cr pgsql.orig/src/bin/pg_dump/pg_backup.h 
 pgsql.append/src/bin/pg_dump/pg_backup.h
 *** pgsql.orig/src/bin/pg_dump/pg_backup.hMon Jan 15 12:54:05 2007
 --- pgsql.append/src/bin/pg_dump/pg_backup.h  Tue Jan 16 10:21:12 2007
 ***
 *** 46,51 
 --- 46,58 
   archNull = 4
   } ArchiveFormat;
   
 + typedef enum _archiveMode
 + {
 + archModeAppend,
 + archModeWrite,
 + archModeRead
 + } ArchiveMode;
 + 
   /*
*  We may want to have some more user-readable data, but in the mean
*  time this gives us some abstraction and type checking.
 ***
 *** 166,172 
   
   /* Create a new archive */
   extern Archive *CreateArchive(const char *FileSpec, const ArchiveFormat fmt,
 !   const int compression);
   
   /* The --list option */
   extern void PrintTOCSummary(Archive *AH, RestoreOptions *ropt);
 --- 173,179 
   
   /* Create a new archive */
   extern Archive *CreateArchive(const char *FileSpec, const ArchiveFormat fmt,
 !   const int compression, ArchiveMode mode);
   
   /* The --list option */
   extern void PrintTOCSummary(Archive *AH, RestoreOptions *ropt);
 diff -cr pgsql.orig/src/bin/pg_dump/pg_backup_archiver.c 
 pgsql.append/src/bin/pg_dump/pg_backup_archiver.c
 *** pgsql.orig/src/bin/pg_dump/pg_backup_archiver.c   Mon Jan 15 12:54:05 2007
 --- pgsql.append/src/bin/pg_dump/pg_backup_archiver.c Tue Jan 16 11:10:16 2007
 ***
 *** 86,95 
   /* Public */
   Archive *
   CreateArchive(const char *FileSpec, const ArchiveFormat fmt,
 !   const int compression)
   
   {
 ! ArchiveHandle *AH = _allocAH(FileSpec, fmt, compression, archModeWrite);
   
   return (Archive *) AH;
   }
 --- 86,95 
   /* Public */
   Archive *
   CreateArchive(const char *FileSpec, const ArchiveFormat fmt,
 !   const int compression, ArchiveMode mode)
   
   {
 ! ArchiveHandle *AH = _allocAH(FileSpec, fmt, compression, mode);
   
   return (Archive *) AH;
   }
 ***
 *** 203,209 
   
   /*
* Setup the output file if necessary.
 !  */
   if (ropt-filename || ropt-compression)
   sav = SetOutput(AH, ropt-filename, ropt-compression);
   
 --- 203,209 
   
   /*
* Setup the output file if necessary.
 !  */ 
   if (ropt-filename || ropt-compression)
   sav = SetOutput(AH, ropt-filename, ropt-compression);
   
 ***
 *** 940,949 
   else
   #endif
   {   /* Use fopen */
 ! if (fn = 0)
 ! AH-OF = fdopen(dup(fn), PG_BINARY_W);
   else
 ! AH-OF = fopen(filename, PG_BINARY_W);
   AH-gzOut = 0;
   }
   
 --- 940,959 
   else
   #endif
   {   /* Use fopen */
 ! if (AH-mode == archModeAppend)
 ! {
 ! if (fn = 0)
 ! AH-OF = fdopen(dup(fn), PG_BINARY_A);
 ! else
 ! AH-OF = fopen(filename, PG_BINARY_A);
 ! }
   else
 ! {
 ! if (fn = 0)
 ! AH-OF = fdopen(dup(fn), PG_BINARY_W);
 ! else
 ! AH-OF = fopen(filename, PG_BINARY_W);
 ! }
 

[pgsql-patches] pg_dumpall -f filename option

2007-01-16 Thread Dave Page
Per discussion on -hackers, the attached patch adds the option

-f, --file=FILENAME

to pg_dumpall. In order to support this, a new (undocumented) format
option (-Fa) is added to pg_dump which is identical to -Fp, except that
the output file is opened for append rather than write.

This patch should be applied over the top of my previous patch
(pg_dumpall_default_database3.diff).

Regards, Dave
diff -cr pgsql.orig/doc/src/sgml/ref/pg_dumpall.sgml 
pgsql.append/doc/src/sgml/ref/pg_dumpall.sgml
*** pgsql.orig/doc/src/sgml/ref/pg_dumpall.sgml Tue Jan 16 09:36:33 2007
--- pgsql.append/doc/src/sgml/ref/pg_dumpall.sgml   Tue Jan 16 11:19:05 2007
***
*** 128,133 
--- 128,143 
 /para
/listitem
   /varlistentry
+
+  varlistentry
+   termoption-f replaceable 
class=parameterfilename/replaceable/option/term
+   termoption--file=replaceable 
class=parameterfilename/replaceable/option/term
+   listitem
+para
+ Write the output to the specified file.
+/para
+   /listitem
+  /varlistentry
  
   varlistentry
termoption-g/option/term
diff -cr pgsql.orig/src/bin/pg_dump/pg_backup.h 
pgsql.append/src/bin/pg_dump/pg_backup.h
*** pgsql.orig/src/bin/pg_dump/pg_backup.h  Mon Jan 15 12:54:05 2007
--- pgsql.append/src/bin/pg_dump/pg_backup.hTue Jan 16 10:21:12 2007
***
*** 46,51 
--- 46,58 
archNull = 4
  } ArchiveFormat;
  
+ typedef enum _archiveMode
+ {
+   archModeAppend,
+   archModeWrite,
+   archModeRead
+ } ArchiveMode;
+ 
  /*
   *We may want to have some more user-readable data, but in the mean
   *time this gives us some abstraction and type checking.
***
*** 166,172 
  
  /* Create a new archive */
  extern Archive *CreateArchive(const char *FileSpec, const ArchiveFormat fmt,
! const int compression);
  
  /* The --list option */
  extern void PrintTOCSummary(Archive *AH, RestoreOptions *ropt);
--- 173,179 
  
  /* Create a new archive */
  extern Archive *CreateArchive(const char *FileSpec, const ArchiveFormat fmt,
! const int compression, ArchiveMode mode);
  
  /* The --list option */
  extern void PrintTOCSummary(Archive *AH, RestoreOptions *ropt);
diff -cr pgsql.orig/src/bin/pg_dump/pg_backup_archiver.c 
pgsql.append/src/bin/pg_dump/pg_backup_archiver.c
*** pgsql.orig/src/bin/pg_dump/pg_backup_archiver.c Mon Jan 15 12:54:05 2007
--- pgsql.append/src/bin/pg_dump/pg_backup_archiver.c   Tue Jan 16 11:10:16 2007
***
*** 86,95 
  /* Public */
  Archive *
  CreateArchive(const char *FileSpec, const ArchiveFormat fmt,
! const int compression)
  
  {
!   ArchiveHandle *AH = _allocAH(FileSpec, fmt, compression, archModeWrite);
  
return (Archive *) AH;
  }
--- 86,95 
  /* Public */
  Archive *
  CreateArchive(const char *FileSpec, const ArchiveFormat fmt,
! const int compression, ArchiveMode mode)
  
  {
!   ArchiveHandle *AH = _allocAH(FileSpec, fmt, compression, mode);
  
return (Archive *) AH;
  }
***
*** 203,209 
  
/*
 * Setup the output file if necessary.
!*/
if (ropt-filename || ropt-compression)
sav = SetOutput(AH, ropt-filename, ropt-compression);
  
--- 203,209 
  
/*
 * Setup the output file if necessary.
!*/ 
if (ropt-filename || ropt-compression)
sav = SetOutput(AH, ropt-filename, ropt-compression);
  
***
*** 940,949 
else
  #endif
{   /* Use fopen */
!   if (fn = 0)
!   AH-OF = fdopen(dup(fn), PG_BINARY_W);
else
!   AH-OF = fopen(filename, PG_BINARY_W);
AH-gzOut = 0;
}
  
--- 940,959 
else
  #endif
{   /* Use fopen */
!   if (AH-mode == archModeAppend)
!   {
!   if (fn = 0)
!   AH-OF = fdopen(dup(fn), PG_BINARY_A);
!   else
!   AH-OF = fopen(filename, PG_BINARY_A);
!   }
else
!   {
!   if (fn = 0)
!   AH-OF = fdopen(dup(fn), PG_BINARY_W);
!   else
!   AH-OF = fopen(filename, PG_BINARY_W);
!   }
AH-gzOut = 0;
}
  
diff -cr pgsql.orig/src/bin/pg_dump/pg_backup_archiver.h 
pgsql.append/src/bin/pg_dump/pg_backup_archiver.h
*** pgsql.orig/src/bin/pg_dump/pg_backup_archiver.h Mon Jan 15 12:54:05 2007
--- pgsql.append/src/bin/pg_dump/pg_backup_archiver.h   Tue Jan 16 10:20:54 2007
***
*** 122,133 
  
  typedef size_t