4 ms·
Normally, schema means "shape/structure of data". In Postgres it's roughly a container for tables.
by throwaway894345 5y ago
Normally, schema means "shape/structure of data". In Postgres it's roughly a container for tables.
- dragonwriter 5y ago> Normally, schema means "shape/structure of data". In Postgres it's roughly a container for logical databases. No, it's a namespace within a database, not a container for databases; this is not Postgres specific, it is part of the SQL standard and widely used in other implementations.
- throwaway894345 5y agoYeah, you caught me between my post and my edit. I misspoke and said "logical databases" instead of "tables". I'm sure that's not precisely correct either, however.
- atwebb 5y agoIt also seems under-used for how core it is (ex. everything in public/dbo).
- pdpi 5y agoAh I see. Postgres uses the word in the sense that it's used in the SQL spec, though, and it means pretty much what you're describing. The key difference is that I think you're talking about the human-readable file (which in the SQL world is written in SQL DDL), whereas the standard means it as closer to being the internal/runtime representation of that "shape/structure of data". It's helpful to think of "the database" as the actual physical storage, and the schema is what the db uses to make sense of how to manipulate/query that data. From that perspective, the SQL DDL is scripting language to manipulate those schema objects ("objects" in the OOP sense, "schema objects" has an actual specific meaning in SQL).