Sovvenzioni in una dichiarazione creata da pgadmin
-
27-10-2019 - |
Domanda
Se creo la seguente sequenza 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;
E quindi selezionare la sequenza in pgadmin, fare clic sul mouse destro -> crea script, ottengo:
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;
Quindi nelle dichiarazioni di sovvenzione vedo la parola chiave "tabella" e non "sequenza"
- Perché?
- In che modo pGadmin genera l'estratto DDL?
Questa domanda è legata a una delle mie altre domande qui:
Sovvenzioni di query concesse a una sequenza in Postgres
Soluzione
In PostgreSQL, le sequenze sono un po 'come tabelle.
Le tabelle dei cataloghi PG_Class del catalogo e quasi tutto il resto che hanno colonne o sono altrimenti simili a una tabella. Ciò include indici (ma vedi anche pg_index), sequenze, viste, tipi compositi e tabelle toast; Vedi Relkind.
Documenti postgresql per pg_class, uno dei cataloghi di sistema (tabelle di sistema)
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow