Re: Database design? - Mailing list pgsql-general

From David Link
Subject Re: Database design?
Date
Msg-id 3BD583CA.10C085C9@soundscan.com
Whole thread Raw
In response to Database design?  ("Johnny Jørgensen" <johnny@halfahead.dk>)
List pgsql-general
One nice way to implement a multi-language datamodel is with Database
Views.

First you create a language table 'my_table_lang' for each significant
table, called 'my_table_base'.  And you create a view called 'my_table'.
The view joins those tables with the correct language filter.  The
Application generally only looks at the views and not the _lang or _base
tables.

This language table, x_lang will have a column for every language
specific column, needed in the x_base table, like names and
descriptions.  It will also have a language id column.  And of course a
foreign key reference to the x_base table.

create view x
select
  b.type, b.size, b.publisher,
  l.name, l,category
from
  x_base b,
  x_lang l
where
  l.key = b.langkey and
  l.langid = 'FR'   -- "French"  This would be set dynamically
                    -- from the environment


David
;

pgsql-general by date:

Previous
From: Ron Peterson
Date:
Subject: mail list headers
Next
From: Richard Welty
Date:
Subject: openssl & postgresql