pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Language dependent fields
2+ messages / 1 participants
[nested] [flat]

* Language dependent fields
@ 2000-08-15 08:43  Volker Krebs <volker.krebs@abas.de>
  0 siblings, 1 reply; 2+ messages in thread

From: Volker Krebs @ 2000-08-15 08:43 UTC (permalink / raw)
  To: pgsql-sql

Hi,

I want the content of a field to be language dependent.

Therfore we have a Translation table which looks like this:

tln_id  tln_lng_id      tln_text
---------------------------------
1       de              hallo
1       en              hello
2       de              Herr
2       en              Mister

any language dependent fields reference to this table e.g.

table customer

cst_id  cst_sometext_tln_id
----------------------------
1000    1

I've created a view to get the text:

CREATE VIEW locale_customer AS
SELECT customer.*, tln_text, tln_lng_id FROM customer,translation
WHERE tln_id=cst_sometext_tln_id;

this works fine for tables with only one language dependent field.
But if I have more than one field I've got a problem.

e.g.

table customer2

cst_id  cst_sometext_tln_id     cst_sometext2_tln_id
----------------------------------------------------
1000    1                       2

how can I create a proper view, to get both tln_text fields ??

CREATE VIEW locale_customer2 AS
SELECT customer2.*, tln_text, tln_lng_id FROM customer,translation
WHERE tln_id=cst_sometext_tln_id OR tln_id=cst_sometext2_tln_id;
gives me all tln_text fields, but I can't distinguish between them.

Any help appriciated.

thanks
Volker



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Language dependent fields
@ 2000-08-15 13:24  Volker Krebs <volker.krebs@abas.de>
  parent: Volker Krebs <volker.krebs@abas.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Volker Krebs @ 2000-08-15 13:24 UTC (permalink / raw)
  To: Renato De Giovanni <rdg@u-netsys.com.br>; +Cc: pgsql-sql

Hi,

thanks, that works ok.
But has anybody some suggestions how this
behaves performance wise, if I have like 10 language dependent fields
and translation t1 till translation t10.

Volker

Renato De Giovanni wrote:
> 
> Maybe something like this:
> 
> CREATE VIEW locale_customer2 AS
> SELECT customer2.*, t1.tln_lng_id, t1.tln_text as text1, t2.tln_text as
> text2
> FROM customer, translation t1, translation t2
> WHERE t1.tln_id=cst_sometext_tln_id
> AND t2.tln_id=cst_sometext2_tln_id
> AND t1.tln_lng_id = t2.tln_lng_id;
> 
> HTH,
> --
> Renato
> Sao Paulo - SP - Brasil
> rdg@viafractal.com.br
> 
> > Hi,
> >
> > I want the content of a field to be language dependent.
> >
> > Therfore we have a Translation table which looks like this:
> >
> > tln_id  tln_lng_id      tln_text
> > ---------------------------------
> > 1       de              hallo
> > 1       en              hello
> > 2       de              Herr
> > 2       en              Mister
> >
> > any language dependent fields reference to this table e.g.
> >
> > table customer
> >
> > cst_id  cst_sometext_tln_id
> > ----------------------------
> > 1000    1
> >
> > I've created a view to get the text:
> >
> > CREATE VIEW locale_customer AS
> > SELECT customer.*, tln_text, tln_lng_id FROM customer,translation
> > WHERE tln_id=cst_sometext_tln_id;
> >
> > this works fine for tables with only one language dependent field.
> > But if I have more than one field I've got a problem.
> >
> > e.g.
> >
> > table customer2
> >
> > cst_id  cst_sometext_tln_id     cst_sometext2_tln_id
> > ----------------------------------------------------
> > 1000    1                       2
> >
> > how can I create a proper view, to get both tln_text fields ??
> >
> > CREATE VIEW locale_customer2 AS
> > SELECT customer2.*, tln_text, tln_lng_id FROM customer,translation
> > WHERE tln_id=cst_sometext_tln_id OR tln_id=cst_sometext2_tln_id;
> > gives me all tln_text fields, but I can't distinguish between them.
> >
> > Any help appriciated.
> >
> > thanks
> > Volker



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2000-08-15 13:24 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-08-15 08:43 Language dependent fields Volker Krebs <volker.krebs@abas.de>
2000-08-15 13:24 ` Volker Krebs <volker.krebs@abas.de>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox