From a11577f47e5ed1d6271188ec5830fecf1036ce4d Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 12 Jun 2014 20:14:39 -0400 Subject: Fix pg_restore's processing of old-style BLOB COMMENTS data. Prior to 9.0, pg_dump handled comments on large objects by dumping a bunch of COMMENT commands into a single BLOB COMMENTS archive object. With sufficiently many such comments, some of the commands would likely get split across bufferloads when restoring, causing failures in direct-to-database restores (though no problem would be evident in text output). This is the same type of issue we have with table data dumped as INSERT commands, and it can be fixed in the same way, by using a mini SQL lexer to figure out where the command boundaries are. Fortunately, the COMMENT commands are no more complex to lex than INSERTs, so we can just re-use the existing lexer for INSERTs. Per bug #10611 from Jacek Zalewski. Back-patch to all active branches. --- src/bin/pg_dump/pg_backup_archiver.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/bin/pg_dump/pg_backup_archiver.c') diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index 4485d79649c..4863f943664 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -627,7 +627,13 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, _selectOutputSchema(AH, "pg_catalog"); + /* Send BLOB COMMENTS data to ExecuteSimpleCommands() */ + if (strcmp(te->desc, "BLOB COMMENTS") == 0) + AH->outputKind = OUTPUT_OTHERDATA; + (*AH->PrintTocDataPtr) (AH, te, ropt); + + AH->outputKind = OUTPUT_SQLCMDS; } else { -- cgit v1.2.3