Forbid setval() during recovery. This prevents the PANIC reported by
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 19 Feb 2010 06:29:19 +0000 (06:29 +0000)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 19 Feb 2010 06:29:19 +0000 (06:29 +0000)
Erik Rijkers. Patch by Andres Freund.

src/backend/commands/sequence.c

index 7215ca91e9eece4f57cc937703dc7c00d4557f11..ffb7fcaba9dc0d5330701f6455c70adc1881d27b 100644 (file)
@@ -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);