开发者

GRANTs in generated CREATE statement from pgAdmin

开发者 https://www.devze.com 2023-04-03 15:04 出处:网络
If I create the following sequence in Postgres: CREATE SEQUENCE test INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807

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开发者_JAVA百科 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)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号