سؤال

If I create the following sequence in Postgres:

CREATE SEQUENCE test
  INCREMENT 1
  MINVALUE 1
  MAXVALUE 9223372036854775807
  START 1
  CACHE 1;
GRANT ALL ON SEQUENCE test TO testuser;
GRANT SELECT ON SEQUENCE test TO testuser2;

And then select the sequence in pgAdmin, right mouse click -> CREATE script, I get:

CREATE SEQUENCE test
  INCREMENT 1
  MINVALUE 1
  MAXVALUE 9223372036854775807
  START 1
  CACHE 1;
ALTER TABLE test
  OWNER TO testuser;
GRANT ALL ON TABLE test TO testuser;
GRANT SELECT ON TABLE test TO testuser2;

So in the GRANT statements I see the keyword "TABLE" and not "SEQUENCE"

  1. Why is that?
  2. How is pgAdmin generating the DDL extract?

This question is related to one of my other questions here:
Query GRANTS granted to a sequence in postgres

هل كانت مفيدة؟

المحلول

In PostgreSQL, sequences are kind of like tables.

The catalog pg_class catalogs tables and most everything else that has columns or is otherwise similar to a table. This includes indexes (but see also pg_index), sequences, views, composite types, and TOAST tables; see relkind.

PostgreSQL docs for pg_class, one of the system catalogs (system tables)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top