2

I'm new to Postgresql and I just saw my friends query on a cakePhp controller that call 'pq_class'. I tried to look up to my PostgreSQL database and find out what's inside using pgAgmin4.

Unfortunately, I can't see any table name with 'pg_class'. I tried to google and find these pages :

https://www.postgresql.org/docs/current/catalog-pg-class.html

postgreSQL - pg_class question

But I am still confused about pg_class. Is there any good or real explanation about pg_class and how to see it using pgAdmin4 without using any query (just right click -> view data)

Maryadi Poipo
  • 1,418
  • 8
  • 31
  • 54
  • What's unclear about the description from your first link: "*pg_class catalogs tables and most everything else that has columns or is otherwise similar to a table.*" –  Dec 13 '18 at 07:36
  • *good or real explanation* all of sources postgresql you can see in documentation.. If you are not understand read carefully documentation and do researching again.. – dwir182 Dec 13 '18 at 07:52
  • @a_horse_with_no_name, what catalogs means there ? why need to catalog tables ?. Sorry, my background is mysql, so can't imagine pg_class. Thank you – Maryadi Poipo Dec 13 '18 at 08:06
  • @dwir182 sure, thank you – Maryadi Poipo Dec 13 '18 at 08:06
  • "catalogs tables" = "stores information about tables" –  Dec 13 '18 at 08:07
  • @a_horse_with_no_name and others - late to party, but it would be easy to guess if it was called `pg_objects` or `pg_tables`. If there is a history or reason to call it specifically `pg_class`, some one can comment. – samshers Dec 26 '22 at 20:04
  • 1
    @samshers: well, there is [a view](https://www.postgresql.org/docs/current/view-pg-tables.html) named `pg_tables`. The name `pg_class` is indeed historical as Postgres has object oriented roots and thus those were treated as "classes" internally. –  Dec 26 '22 at 20:31

2 Answers2

7

pg_class is an internal system table that stores information about tables (and similar objects") available in the database. Every database product has such a collection of system tables (and views) that it maintains.

You can (and in most cases should) use the views from the information_schema if you want to see information about tables, columns, views and other database objects.

0

You can get details from information_schema on pgadmin like this.

` SELECT * FROM information_schema.columns;

select * from information_schema.tables`

s21s
  • 111
  • 1
  • 9