]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Change error message for sequence validate_relation_kind()
authorPeter Eisentraut <peter@eisentraut.org>
Mon, 23 Feb 2026 09:56:54 +0000 (10:56 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Mon, 23 Feb 2026 09:56:54 +0000 (10:56 +0100)
We can just say "... is not a sequence" instead of the more
complicated variant from before, which was probably copied from
src/backend/access/table/table.c.

Fix a typo in a comment in passing.

Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/6d3fef19-a420-4e11-8235-8ea534bf2080%40eisentraut.org

src/backend/access/sequence/sequence.c
src/test/regress/expected/sequence.out

index 106af1477e9453066b788868f463ced3eab78e28..6897f8432d676b92e6219fa187b3eefef9756cb9 100644 (file)
@@ -63,7 +63,7 @@ sequence_close(Relation relation, LOCKMODE lockmode)
 /* ----------------
  *             validate_relation_kind - check the relation's kind
  *
- *             Make sure relkind is from a sequence.
+ *             Make sure relkind is a sequence.
  * ----------------
  */
 static inline void
@@ -72,7 +72,6 @@ validate_relation_kind(Relation r)
        if (r->rd_rel->relkind != RELKIND_SEQUENCE)
                ereport(ERROR,
                                (errcode(ERRCODE_WRONG_OBJECT_TYPE),
-                                errmsg("cannot open relation \"%s\"",
-                                               RelationGetRelationName(r)),
-                                errdetail_relkind_not_supported(r->rd_rel->relkind)));
+                                errmsg("\"%s\" is not a sequence",
+                                               RelationGetRelationName(r))));
 }
index c4454e5b435a173d0859d8556863024442fc46c7..a0883b110070bbaef1e10415fc8536fc2e93cd69 100644 (file)
@@ -313,8 +313,7 @@ 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 serialTest1 CYCLE;  -- error, not a sequence
-ERROR:  cannot open relation "serialtest1"
-DETAIL:  This operation is not supported for tables.
+ERROR:  "serialtest1" is not a sequence
 CREATE SEQUENCE sequence_test2 START WITH 32;
 CREATE SEQUENCE sequence_test4 INCREMENT BY -1;
 SELECT nextval('sequence_test2');