Re: variant column type
От | Ben Chobot |
---|---|
Тема | Re: variant column type |
Дата | |
Msg-id | 4CDD442C-640E-4827-A8F5-161A568BDB88@silentmedia.com обсуждение исходный текст |
Ответ на | variant column type (salah jubeh <s_jubeh@yahoo.com>) |
Список | pgsql-general |
On Jul 26, 2011, at 10:02 AM, salah jubeh wrote:
Hello,suppose the following scenariothe car speed is 240the car has an airbagHere the first value is integer and the second value is boolean. Consider that I have this table structurefeature (feature id feature name)car (car id, .... )car_feature (car id, feature id, value). the value attribute might have different domains. How can I model this using postgres and using ANSI compliant design ?
You haven't been very clear but it sounds like maybe you're asking how to get both EAV "flexibility" and type safety? There isn't any good way to do that but you might consider something ugly, like:
car (id, ...)
car_boolean_features (car_id, ....)
car_int_features (car_id, ...)
A better thing to consider, of course, is how you might avoid the need for anything like EAV in the first place.
В списке pgsql-general по дате отправления: