We actually allow setval() to be called, as long as it's not changing
values. That's required because the relevant code is called from other
contexts as well.
Page page = BufferGetPage(buf);
Form_pg_sequence seq = (Form_pg_sequence) GETSTRUCT(seqtuple);
+ if (seq->last_value != next ||
+ seq->is_called != iscalled)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("cannot call setval() on global sequence %s.%s ",
+ get_namespace_name(RelationGetNamespace(seqrel)),
+ RelationGetRelationName(seqrel))));
+
+
/* ready to change the on-disk (or really, in-buffer) tuple */
START_CRIT_SECTION();