HeapTuple seqtuple;
HeapTuple newdatatuple;
- /* Open and lock sequence. */
- relid = RangeVarGetRelid(stmt->sequence,
- ShareRowExclusiveLock,
- stmt->missing_ok);
+ /* Open and lock sequence, and check for ownership along the way. */
+ relid = RangeVarGetRelidExtended(stmt->sequence,
+ ShareRowExclusiveLock,
+ stmt->missing_ok,
+ false,
+ RangeVarCallbackOwnsRelation,
+ NULL);
if (relid == InvalidOid)
{
ereport(NOTICE,
init_sequence(relid, &elm, &seqrel);
- /* allow ALTER to sequence owner only */
- if (!pg_class_ownercheck(relid, GetUserId()))
- aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_CLASS,
- stmt->sequence->relname);
-
rel = heap_open(SequenceRelationId, RowExclusiveLock);
seqtuple = SearchSysCacheCopy1(SEQRELID,
ObjectIdGetDatum(relid));
ALTER SEQUENCE IF EXISTS sequence_test2 RESTART WITH 24
INCREMENT BY 4 MAXVALUE 36 MINVALUE 5 CYCLE;
NOTICE: relation "sequence_test2" does not exist, skipping
-ALTER SEQUENCE pg_class CYCLE; -- error, not a sequence
-ERROR: "pg_class" is not a sequence
+ALTER SEQUENCE serialTest1 CYCLE; -- error, not a sequence
+ERROR: "serialtest1" is not a sequence
CREATE SEQUENCE sequence_test2 START WITH 32;
CREATE SEQUENCE sequence_test4 INCREMENT BY -1;
SELECT nextval('sequence_test2');
ALTER SEQUENCE IF EXISTS sequence_test2 RESTART WITH 24
INCREMENT BY 4 MAXVALUE 36 MINVALUE 5 CYCLE;
-ALTER SEQUENCE pg_class CYCLE; -- error, not a sequence
+ALTER SEQUENCE serialTest1 CYCLE; -- error, not a sequence
CREATE SEQUENCE sequence_test2 START WITH 32;
CREATE SEQUENCE sequence_test4 INCREMENT BY -1;