On Tue, 2006-02-14 at 09:57 -0500, Tom Lane wrote:
> Simon Riggs <[EMAIL PROTECTED]> writes:
> > How should it work?
> 
> > 1. Remove the BEGIN and COMMIT around blobs?
> > 2. Use SAVEPOINT ?
> 
> > Presumably (1).
> 
> Yeah, there is no need for the per-blob begin/commit if we've got one
> around the whole restore.

Just put an if test around that blob-handling behaviour. The code looks
very simple, so patch enclosed to augment the already-applied patch.

Chris, do you have a set-up to test out the blob behaviour? If your
using them in production you'll spot any further slip-ups; they weren't
intentionally ignored in the original patch.

> One thing to be careful of is not to suppress BEGINs that are sent on
> the dumping side --- it's sometimes hard to tell which parts of pg_dump
> execute when.

Not touched, nothing fancy going on.

[It's a shame we don't support nested BEGINs, for use in nested function
calls. I guess we took that out infavour of SAVEPOINTs? I seem to
remember some idiot (me wasn't it?) suggesting we should do that.]

Best Regards, Simon Riggs
Index: src/bin/pg_dump/pg_backup_archiver.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v
retrieving revision 1.124
diff -c -r1.124 pg_backup_archiver.c
*** src/bin/pg_dump/pg_backup_archiver.c	13 Feb 2006 21:30:19 -0000	1.124
--- src/bin/pg_dump/pg_backup_archiver.c	14 Feb 2006 15:49:30 -0000
***************
*** 652,661 ****
  void
  StartRestoreBlobs(ArchiveHandle *AH)
  {
! 	if (AH->connection)
! 		StartTransaction(AH);
! 	else
! 		ahprintf(AH, "BEGIN;\n\n");
  
  	AH->blobCount = 0;
  }
--- 652,664 ----
  void
  StartRestoreBlobs(ArchiveHandle *AH)
  {
!     if (!AH->ropt->single_txn)
!     {
!     	if (AH->connection)
!             StartTransaction(AH);
!     	else
!     		ahprintf(AH, "BEGIN;\n\n");
!     }
  
  	AH->blobCount = 0;
  }
***************
*** 666,675 ****
  void
  EndRestoreBlobs(ArchiveHandle *AH)
  {
! 	if (AH->connection)
! 		CommitTransaction(AH);
! 	else
! 		ahprintf(AH, "COMMIT;\n\n");
  
  	ahlog(AH, 1, "restored %d large objects\n", AH->blobCount);
  }
--- 669,681 ----
  void
  EndRestoreBlobs(ArchiveHandle *AH)
  {
!     if (AH->ropt->single_txn)
!     {
!     	if (AH->connection)
!     		CommitTransaction(AH);
!         else
! 		    ahprintf(AH, "COMMIT;\n\n");
!     }
  
  	ahlog(AH, 1, "restored %d large objects\n", AH->blobCount);
  }
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to