From: Heikki Linnakangas Date: Fri, 19 Feb 2010 06:29:19 +0000 (+0000) Subject: Forbid setval() during recovery. This prevents the PANIC reported by X-Git-Tag: REL9_0_ALPHA4~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=94f610b16342d7727774f6bb9245341cfa6f895c;p=postgresql Forbid setval() during recovery. This prevents the PANIC reported by Erik Rijkers. Patch by Andres Freund. --- diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c index 7215ca91e9..ffb7fcaba9 100644 --- a/src/backend/commands/sequence.c +++ b/src/backend/commands/sequence.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.166 2010/02/14 18:42:14 rhaas Exp $ + * $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.167 2010/02/19 06:29:19 heikki Exp $ * *------------------------------------------------------------------------- */ @@ -736,6 +736,9 @@ do_setval(Oid relid, int64 next, bool iscalled) Buffer buf; Form_pg_sequence seq; + /* setval() writes to database and must be prevented during recovery */ + PreventCommandDuringRecovery(); + /* open and AccessShareLock sequence */ init_sequence(relid, &elm, &seqrel);