Design question, Does postgres provide a simpler solution than the obvious?
От | Greg Stark |
---|---|
Тема | Design question, Does postgres provide a simpler solution than the obvious? |
Дата | |
Msg-id | 87n0ppg90b.fsf@stark.dyndns.tv обсуждение исходный текст |
Ответы |
Re: Design question, Does postgres provide a simpler solution than the obvious?
|
Список | pgsql-general |
I have a design issue and I know how I would normally solve it, but it looks to be a pain in the long term. I'm used to Oracle where the right way is usually the painful way, but being new to Postgres I'm wondering if there are any special features (perhaps arrays? or rules?) that make this issue easier. Basically the issue is that the application needs to work in multiple languages, so every single text field needs to have N different alternate values. Usually two languages will be inserted and updated together. If the desired language isn't present I need to default to another language. So the obvious fully normalized approach is to have a string table and every simple single query insert and update becomes a more complex transaction that inserts or updates multiple records in the string table and stores the key for those strings in the original table. I guess my ideal solution would allow me to issue an insert or update on the original table with some sort of associative array data structure as the value for the string field. The appropriate work would all get done automatically. Then selects would either return the associative array or perhaps even implement the entire logic for looking up the correct string to display. This is a pretty common problem I wonder if anyone has come up with anything easier to work with than the standard normalized string table approach. -- greg
В списке pgsql-general по дате отправления: