Why not nested schemas in PostgreSQL? [closed]

Posted on

Question :

I only use PostgreSQL, and never will switch databases softwares ever again in my life, so I don’t care about being compatible with some theoretical “SQL standard” which for all practical purposes doesn’t exist in reality.

I like the idea of “schemas”, and I know very well what they are, but one thing that bothers me is that you cannot nest them. Thus, you can only have one “category” and any “sub-categories” will have to be part of the table name.

Why not have nested schema support? Since “schemas” are not in the SQL standard anyway, why did they not go the whole way and allow nested schemas?

Granted, I have not yet really needed this, but it seems like it would be useful in theory and for various complex situations.

Answer :

Why not have nested schema support

Because the SQL standard doesn’t define them. And yes, schemas are defined in the SQL standard, as are catalogs (which are another level of namespace).

Postgres’ databases are roughly equivalent to the standard’s catalog, except that the standard would require the ability to do-cross catalog (=database) queries.

In the standard some_catalog.some_schema.some_table is a valid table reference and could be use with other_catalog.some_schema.some_table in the same query. – a-horse-with-no-name

Leave a Reply

Your email address will not be published. Required fields are marked *