Commit 5c1b0045 authored by Philip Warner's avatar Philip Warner

Fixed but in _enableTriggersIfNecessary introduced by previous patches by me

which caused segfault in a data-only retore with BLOBs
parent fd5bac6d
...@@ -471,10 +471,17 @@ static void _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreO ...@@ -471,10 +471,17 @@ static void _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreO
* command when one is available. * command when one is available.
*/ */
ahprintf(AH, "-- Enable triggers\n"); ahprintf(AH, "-- Enable triggers\n");
ahprintf(AH, "UPDATE pg_class SET reltriggers = " if (te && te->name && strlen(te->name) > 0)
{
ahprintf(AH, "UPDATE pg_class SET reltriggers = "
"(SELECT count(*) FROM pg_trigger where pg_class.oid = tgrelid) " "(SELECT count(*) FROM pg_trigger where pg_class.oid = tgrelid) "
"WHERE relname = '%s';\n\n", "WHERE relname = '%s';\n\n",
te->name); te->name);
} else {
ahprintf(AH, "UPDATE \"pg_class\" SET \"reltriggers\" = "
"(SELECT count(*) FROM pg_trigger where pg_class.oid = tgrelid) "
"WHERE \"relname\" !~ '^pg_';\n\n");
}
/* /*
* Restore the user connection from the start of this procedure * Restore the user connection from the start of this procedure
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment