Re: Database design?

From: David Link <dlink(at)soundscan(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Database design?
Date: 2001-10-23 14:50:50
Message-ID: 3BD583CA.10C085C9@soundscan.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
;

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-10-23 15:08:43 Re: Snapshot is not working
Previous Message Tom Lane 2001-10-23 14:49:08 Re: pg_dump - getTables() problem