0

Newbie to Postgres so naive question here -

what is the difference between schemaname and tableowner? https://www.postgresql.org/docs/8.3/view-pg-tables.html

schemaname -> Name of schema containing table

tableowner -> Name of table's owner

 schemaname |      tablename      | tableowner 
------------+---------------------+------------
 admcdba    | class_dim           | postgres
 admcdba    | product_dim         | postgres
 admcdba    | exch_84041_84057    | postgres
 admcdba    | exch_84041_84061    | postgres
 admcdba    | part_maint_log      | postgres
(5 rows)

in above output schemaname and tableowner are different and hence trying to understand.

Appreciate your response in advance.

Pat
  • 59
  • 1
  • 5
  • Did you expect them to be the same? Why? – Bergi Aug 11 '21 at 23:59
  • Have you read https://www.postgresql.org/docs/current/ddl-schemas.html and https://www.postgresql.org/docs/current/ddl-priv.html? – Bergi Aug 12 '21 at 00:01
  • @Bergi My understanding is, the current user will be owner of a table if I don't specify owner as a part of create statement explicitly, at least this is what is happening in Oracle DB. However, in Postgres I see current user becomes tableowner while specified user along with create table becomes schema owner and hence asked question to clear my understanding behind this concept. – Pat Aug 12 '21 at 19:28
  • What do you mean by "*specified user along with create table becomes schema owner*"? Can you show us the create statements you used for these tables and where you specified a user there? Also your output doesn't show the owner of the `admcdba` schema. – Bergi Aug 12 '21 at 20:15
  • Also notice that in Postgres, schemas work very different than [they do in Oracle](https://stackoverflow.com/questions/880230/difference-between-a-user-and-a-schema-in-oracle). A Postgres schema is nothing but a namespace for database objects. – Bergi Aug 12 '21 at 20:18

0 Answers0