Thread: Language dependent fields

Language dependent fields

From
Volker Krebs
Date:
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


8K Limit, whats the best strategy?

From
Keith Wong
Date:
Hi everyone,

Just wondering what strategies people have used to get around the 8K row 
limit in Postgres.
If anyone has been troubled by this limitation before and has a nice 
solution around it, I would love to hear it.

My application is a web-based system in which needs to store large amounts 
of text.
The text stored needs to searchable as well.

Cheers,
Keith.



Re: Language dependent fields

From
Volker Krebs
Date:
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


Re: 8K Limit, whats the best strategy?

From
Thomas Swan
Date:
At 06:29 AM 8/15/2000, Keith Wong wrote:<br /><blockquote cite="cite" type="cite">Hi everyone,<br /><br /> Just
wonderingwhat strategies people have used to get around the 8K row limit in Postgres.<br /> If anyone has been troubled
bythis limitation before and has a nice solution around it, I would love to hear it.<br /><br /> My application is a
web-basedsystem in which needs to store large amounts of text.<br /> The text stored needs to searchable as
well.</blockquote><br/>  You can you the type LZTEXT which is compressed text so your mileage will vary.<br /><br />
Theother option is to go in and recompile for a larger row size.  Most of the people I have talked to had no problems
withthis route.  I move the size limit on an x86 Linux box to 32K (the max) and have not had any problems.   In the
nextrelease, I don't believe the row size limit will exist (correct me if I'm wrong). <br /><br /> Let me know the
systemyour on, and I will try to help if I can.<br /><br /> - <br /> - <b><u>Thomas Swan</u></b>
                                  <br/> - Graduate Student  - Computer Science<br /> - The University of Mississippi<br
/>- <br /> - "People can be categorized into two fundamental <br /> - groups, those that divide people into two groups
<br/> - and those that don't." 

Re: 8K Limit, whats the best strategy?

From
"Adam Lang"
Date:
I believe you are correct.  Version 7.1 will supposedly eliminate the row
size.

Adam Lang
Systems Engineer
Rutgers Casualty Insurance Company
----- Original Message -----
From: "Thomas Swan" <tswan@olemiss.edu>
To: "Keith Wong" <keith@e-magine.com.au>; <pgsql-sql@postgresql.org>
Sent: Tuesday, August 15, 2000 11:37 AM
Subject: Re: [SQL] 8K Limit, whats the best strategy?


> At 06:29 AM 8/15/2000, Keith Wong wrote:
> >Hi everyone,
> >
> >Just wondering what strategies people have used to get around the 8K row
> >limit in Postgres.
> >If anyone has been troubled by this limitation before and has a nice
> >solution around it, I would love to hear it.
> >
> >My application is a web-based system in which needs to store large
amounts
> >of text.
> >The text stored needs to searchable as well.
>
> You can you the type LZTEXT which is compressed text so your mileage will
vary.
>
> The other option is to go in and recompile for a larger row size.  Most of
> the people I have talked to had no problems with this route.  I move the
> size limit on an x86 Linux box to 32K (the max) and have not had any
> problems.   In the next release, I don't believe the row size limit will
> exist (correct me if I'm wrong).
>
> Let me know the system your on, and I will try to help if I can.
>
> -
> - Thomas Swan
> - Graduate Student  - Computer Science
> - The University of Mississippi
> -
> - "People can be categorized into two fundamental
> - groups, those that divide people into two groups
> - and those that don't."



Re: 8K Limit, whats the best strategy?

From
"Poul L. Christiansen"
Date:
I've just split the text up (in 8 pieces), so it fits into 8K rows. But thats
only a viable solution if your text is less than a couple of 100K's.

You could try to be a daredevil and use the Toast code, even if it's beta. But
I don't know how far the Toast project has come.

Keith Wong wrote:

> Hi everyone,
>
> Just wondering what strategies people have used to get around the 8K row
> limit in Postgres.
> If anyone has been troubled by this limitation before and has a nice
> solution around it, I would love to hear it.
>
> My application is a web-based system in which needs to store large amounts
> of text.
> The text stored needs to searchable as well.
>
> Cheers,
> Keith.



Re: 8K Limit, whats the best strategy?

From
Jan Wieck
Date:
Poul L. Christiansen wrote:
> I've just split the text up (in 8 pieces), so it fits into 8K rows. But thats
> only a viable solution if your text is less than a couple of 100K's.
>
> You could try to be a daredevil and use the Toast code, even if it's beta. But
> I don't know how far the Toast project has come.
   TOAST  is  finished  and will be shipped with 7.1. It's not a   solution for huge items, but medium sized  text  up
to some   hundred K works fine.
 


Jan

>
> Keith Wong wrote:
>
> > Hi everyone,
> >
> > Just wondering what strategies people have used to get around the 8K row
> > limit in Postgres.
> > If anyone has been troubled by this limitation before and has a nice
> > solution around it, I would love to hear it.
> >
> > My application is a web-based system in which needs to store large amounts
> > of text.
> > The text stored needs to searchable as well.
> >
> > Cheers,
> > Keith.
>


--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #