Re:Postgres Guide
by egeozcan on Monday August 03, 2015 @03:22AM
(#9994247)
What is "relations as types"? I googled to no avail.
[ Parent
| on HN ]
Re:Postgres Guide
by icebraining on Monday August 03, 2015 @04:57AM
(#9994535)
Relations are tables, indexes, views, etc. When you create one, PG will also create a composite data type[1] that corresponds to one of its rows. And you can use those types in interesting ways - for example, you can have a column in a table that stores a complete composite value.
Re:Postgres Guide
by sbuttgereit on Monday August 03, 2015 @09:32AM
(#9995610)
Yes, this is exactly why I think a guide examining such a topic would be good. You get a doc page for it (see icebraining's comment), but that's about it. Performance gets covered often, thinking about how to get the most of PostgreSQL's type system doesn't.
I don't really use this feature to drive structure (really at all), but do use it extensively when programming functions in PL/pgSQL. I also exploit this in queries sometimes as well. It's not a life changing feature to be sure, but it is relatively unique and can help solve problems that are more cumbersome to solve without the feature.