3 ms·
Not a part of the SQL standard, but would PostgreSQL enumerated types be what you're thinking of? https://www.postgresql.org/docs/current/datatype-enum.html ht
by blacktriangle 5y ago
Not a part of the SQL standard, but would PostgreSQL enumerated types be what you're thinking of?
https://www.postgresql.org/docs/current/datatype-enum.html https://www.postgresql.org/docs/current/datatype-enum.html
Although I guess the question is are you thinking sum types at the attribute level or sum types at the relation level? At the relation level I'm not familiar with an answer, but I can see where that would be a nice database-level solution for polymorphic associations.
- throwaway894345 5y agoPostgres enum types are like C enums--a bounded set of identifiers. Sum types requires a bounded set of arbitrarily complex types (not just identifiers). For example: type Event enum { KeyPress(rune) MouseClick{ x int64, y int64 } }