Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0ad14eb

Browse files
committed
Repair --single-transaction patch so it handles blobs correctly.
Simon Riggs
1 parent2d7f694 commit0ad14eb

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

‎src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*
1717
* IDENTIFICATION
18-
*$PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.124 2006/02/13 21:30:19 tgl Exp $
18+
*$PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.125 2006/02/14 23:30:43 tgl Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -214,7 +214,12 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
214214
dumpTimestamp(AH,"Started on",AH->createDate);
215215

216216
if (ropt->single_txn)
217-
ahprintf(AH,"BEGIN;\n\n");
217+
{
218+
if (AH->connection)
219+
StartTransaction(AH);
220+
else
221+
ahprintf(AH,"BEGIN;\n\n");
222+
}
218223

219224
/*
220225
* Establish important parameter values right away.
@@ -377,7 +382,12 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
377382
}
378383

379384
if (ropt->single_txn)
380-
ahprintf(AH,"COMMIT;\n\n");
385+
{
386+
if (AH->connection)
387+
CommitTransaction(AH);
388+
else
389+
ahprintf(AH,"COMMIT;\n\n");
390+
}
381391

382392
if (AH->public.verbose)
383393
dumpTimestamp(AH,"Completed on",time(NULL));
@@ -652,10 +662,13 @@ EndBlob(Archive *AHX, Oid oid)
652662
void
653663
StartRestoreBlobs(ArchiveHandle*AH)
654664
{
655-
if (AH->connection)
656-
StartTransaction(AH);
657-
else
658-
ahprintf(AH,"BEGIN;\n\n");
665+
if (!AH->ropt->single_txn)
666+
{
667+
if (AH->connection)
668+
StartTransaction(AH);
669+
else
670+
ahprintf(AH,"BEGIN;\n\n");
671+
}
659672

660673
AH->blobCount=0;
661674
}
@@ -666,10 +679,13 @@ StartRestoreBlobs(ArchiveHandle *AH)
666679
void
667680
EndRestoreBlobs(ArchiveHandle*AH)
668681
{
669-
if (AH->connection)
670-
CommitTransaction(AH);
671-
else
672-
ahprintf(AH,"COMMIT;\n\n");
682+
if (!AH->ropt->single_txn)
683+
{
684+
if (AH->connection)
685+
CommitTransaction(AH);
686+
else
687+
ahprintf(AH,"COMMIT;\n\n");
688+
}
673689

674690
ahlog(AH,1,"restored %d large objects\n",AH->blobCount);
675691
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp