Sample Header Ad - 728x90

Is pg_database a catalog or a table?

1 vote
1 answer
1755 views
I am learning about PostgreSQL and am trying to understand basic concepts like schemas, catalogs and tables. I have been reading _PostgreSQL: Up and Running_, and to quote the book: - Schemas are ... the immediate next level of organization within each database, [they] organize your database into logical groups. - Catalogs are system schemas that store PostgreSQL builtin functions and metadata I am currently reading about pg_database , and am confused whether it's a catalog or a table. From the documentation , it says "The **catalog** pg_database stores information about the available databases". But on pgAdmin4, it is listed as a table within the pg_catalog catalog. enter image description here In the book, there's a query that updates the datistemplate column as if it's a table.
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'mydb';
So is pg_database a catalog or a table? Or is it (somehow) both?
Asked by dayuloli (203 rep)
Dec 26, 2021, 06:01 AM
Last activity: Dec 26, 2021, 08:45 AM