Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 94f610b

Browse files
committed
Forbid setval() during recovery. This prevents the PANIC reported by
Erik Rijkers. Patch by Andres Freund.
1 parent 2f6b456 commit 94f610b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/backend/commands/sequence.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.166 2010/02/14 18:42:14 rhaas Exp $
11+
* $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.167 2010/02/19 06:29:19 heikki Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -736,6 +736,9 @@ do_setval(Oid relid, int64 next, bool iscalled)
736736
Buffer buf;
737737
Form_pg_sequence seq;
738738

739+
/* setval() writes to database and must be prevented during recovery */
740+
PreventCommandDuringRecovery();
741+
739742
/* open and AccessShareLock sequence */
740743
init_sequence(relid, &elm, &seqrel);
741744

0 commit comments

Comments
 (0)