pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
PostgreSQL :: Catalog Query
3+ messages / 3 participants
[nested] [flat]

* PostgreSQL :: Catalog Query
@ 2018-07-18 10:22  Yogi S <infayogi@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Yogi S @ 2018-07-18 10:22 UTC (permalink / raw)
  To: pgsql-bugs

Hi All,

this might look quite naive. but I see quite a difference in between other
RDBMS database vs PostgreSQL.
usually the categorization of the entities are like what is stated below. I
am sure mysql follows the same.

Cluster --> Catalog --> database --> Schema --> tables

but in postgreSQL the catalog <--> database relation is quite one-to-one.
Question is, is it safe to assume that postgreSQL does not have any *catalog
concept* as such.

Regards
Yogi

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: PostgreSQL :: Catalog Query
@ 2018-07-18 12:52  Thomas Kellerer <spam_eater@gmx.net>
  parent: Yogi S <infayogi@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Thomas Kellerer @ 2018-07-18 12:52 UTC (permalink / raw)
  To: Yogi S <infayogi@gmail.com>; pgsql-bugs

Yogi S schrieb am 18.07.2018 um 12:22:
> this might look quite naive. but I see quite a difference in between other RDBMS database vs PostgreSQL.
> usually the categorization of the entities are like what is stated below. I am sure mysql follows the same.
> 
> Cluster --> Catalog --> database --> Schema --> tables
> 
> but in postgreSQL the catalog <--> database relation is quite one-to-one.
> Question is, is it safe to assume that postgreSQL does not have any /*catalog concept*/ as such.

As far as the SQL standard is concerned Postgres' databases do map to the term "catalog" .

The only difference (or deviation from the standard) is, that they are no real "namespaces". 
In the SQL standard a fully qualified (table) name consists of three parts:

    catalog.schema.table

however in Postgres the catalog (while it exists as a "thing") is not allowed to be used in a fully qualified name. 

So in Postgres it's indeed:

"Cluster" (or "Instance") -> Databases -> Schemas -> Tables

MySQL only has databases (or catalogs) but no schemas - or schemas, but no catalogs as "database" is a synonym for "schema" there. 
And MySQL has no "cluster" the way the term is used in Postgres. So in MySQL it's only 

"Instance" -> Databases -> Tables

Note that in Oracle this is again completely different. And in DB2. 

The only DBMS I know of that actually supports these two namespaces (catalogs, schemas) completely is SQL Server (a catalog is called a "database" there)

But this shouldn't be posted or discussed on the "bugs" mailing list, as it is not a bug. 






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: PostgreSQL :: Catalog Query
@ 2018-07-18 13:48  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Thomas Kellerer <spam_eater@gmx.net>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2018-07-18 13:48 UTC (permalink / raw)
  To: Thomas Kellerer <spam_eater@gmx.net>; +Cc: Yogi S <infayogi@gmail.com>; pgsql-bugs

Thomas Kellerer <spam_eater@gmx.net> writes:
> As far as the SQL standard is concerned Postgres' databases do map to the term "catalog" .
> The only difference (or deviation from the standard) is, that they are no real "namespaces". 
> In the SQL standard a fully qualified (table) name consists of three parts:
>     catalog.schema.table
> however in Postgres the catalog (while it exists as a "thing") is not allowed to be used in a fully qualified name. 

You can in fact use the database/catalog name within qualified names:

select * from mydb.someschema.sometable;

But it's purely for pro forma standards compliance.  If you give a three-
part name and the first part isn't the current database, you'll just get
an error.  In theory we might someday extend this to allow cross-database
accesses, but I wouldn't hold my breath waiting.

In any case, the fact that different DBMSes implement different subsets
of the spec isn't a bug, either ours or theirs.

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2018-07-18 13:48 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-07-18 10:22 PostgreSQL :: Catalog Query Yogi S <infayogi@gmail.com>
2018-07-18 12:52 ` Thomas Kellerer <spam_eater@gmx.net>
2018-07-18 13:48   ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox