I'm using, at work, ArcGIS geodatabases and using coded value domains a lot.
Now I'm working with PostgreSQL and I'm trying to create the same sort of data model I would in, for example, a file gdb. And that includes domains.
Coded value domains do not have equivalent to PostgreSQL domains.
For Both I can set up value constraints but the first also prevent repeating long strings by the use of codes without visually losing that information (you see the string, not the code).
That's exactly what I want to accomplish and can't find the way to do it. Maybe it has no sense and it's just a problem of concept as maybe PostgreSQL data modelling simply has a way to approach or deal with this situation that I ignore.
So is this usually done in PostgreSQL? Can it be done without too much extra code? Does it even has sense? Please enlighten me on this.
An illustrative example,
I have a table with all the trees in a city:
tree_id | t_location | t_species | t_health --------+---------------+----------------+-------------- 234 | Arc Cie Av. | Populus nigra | Healthy 235 | Arc Cie Av. | Populus nigra | Deceased 236 | 27th May Str. | Salix alba L. | Healthy 237 | Monolith Sqr. | Quercus alba | Healthy
For species names and health status I use coded value domains. The use of domains is transparent to the user: in the city_trees table I see the domain descriptions despite they are actually populated with coded values.
code | description ------+----------------- PN | Populus nigra SAL | Salix alba L. QA | Quercus alba
code | description -----+----------------- H | Healthy D | Declining L | Deceased C | Cut