X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1C6539DC81D for ; Tue, 7 Feb 2006 09:45:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48670-05 for ; Tue, 7 Feb 2006 09:45:11 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.201]) by postgresql.org (Postfix) with ESMTP id D427C9DC803 for ; Tue, 7 Feb 2006 09:45:05 -0400 (AST) Received: by zproxy.gmail.com with SMTP id 16so1353290nzp for ; Tue, 07 Feb 2006 05:45:09 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=rfn2m3XrXLH/yxBkRhgeb6a2hcxRI+HvtEnsRTe8MXXhP1uCA1AyXAM+FIdVBVXqm8pD/kOL/StU3yvnEFTf//uussDTP4CEV6N7wrONyxXUYMerC5sCFom+SBl7BAsrcry10a+mMEYW26zEEm8/PJOIpOvdiXLLoARhP1Jjyjo= Received: by 10.65.152.9 with SMTP id e9mr726867qbo; Tue, 07 Feb 2006 05:45:09 -0800 (PST) Received: by 10.65.59.4 with HTTP; Tue, 7 Feb 2006 05:45:09 -0800 (PST) Message-ID: <450bdf80602070545v56252a49g8dfe0d0d04ae9065@mail.gmail.com> Date: Tue, 7 Feb 2006 14:45:09 +0100 From: Vic Rowan To: pgsql-sql@postgresql.org Subject: problem referencing an attrib which is not unique In-Reply-To: <450bdf80602070531w78b687bdj15e640945b15b49@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_13686_28745949.1139319909404" References: <450bdf80602070531w78b687bdj15e640945b15b49@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.203 required=5 tests=[AWL=0.257, HTML_10_20=0.945, HTML_MESSAGE=0.001] X-Spam-Score: 1.203 X-Spam-Level: * X-Archive-Number: 200602/59 X-Sequence-Number: 24069 ------=_Part_13686_28745949.1139319909404 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline ---------- Forwarded message ---------- From: Vic Rowan Date: Feb 7, 2006 2:31 PM Subject: problem referencing an attrib which is not unique To: pgsql-sql@postgresql.org hello everybody, I need some thing like this below for an application which stores log messages in multiple languages. The table 'event_msg' stores predefined messages in multiple languages which can be populated with place holder values from the application. (These of course are language independent). So= , the event_id associates these predefined messages from both the tables so that displaying a log message is as simple as looking up the event_id from the 'logs' table and similarly looking up the event_id and language from th= e 'event_msg' table to retreive the predefined_msg with the correct language = - the application determines the lang from a settings file - and combining them to display the log message. CREATE TABLE event_msg ( event_id varchar(30) NOT NULL, language char(2) NOT NULL, predefined_msg varchar(250) NOT NULL, PRIMARY KEY (event_id, language) ); CREATE TABLE logs ( id int NOT NULL, event_id varchar(30) REFERENCES event_msg (event_id) NOT NULL, placeholder_values varchar(250), priority varchar(20) NOT NULL, timestamp Date NOT NULL, primary key (id) ); The problem I am facing is the event_id from logs is not able to reference event_id from event_msg as its not unique. There are as many entries for each event_id as there are languages supporte= d in the 'event_msg' table. I would be glad if somebody could suggest some work around here to the abov= e structure. Or alternately do I need to alter the table structure altogether and if so what is the better way of doing this? Thanks in advance for any help offered. Cheers, Vic Rowan. ------=_Part_13686_28745949.1139319909404 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline

---------- Forwarded message ----------
From: Vic Rowan <mightymate@gmail.com>
Date: Feb 7, 2006 2:= 31 PM
Subject: problem referencing an attrib which is not unique
To: pgsql-sql@postgresql.org

=

hello everybody,

I need some thing like this below for an= application which stores log messages in multiple languages. The table 'ev= ent_msg' stores predefined messages in multiple languages which can be popu= lated with place holder values from the application. (These of course are l= anguage independent). So, the event_id associates these predefined messages= from both the tables so that displaying a log message is as simple as look= ing up the event_id from the 'logs' table and similarly looking up the even= t_id and language from the 'event_msg' table to retreive the predefined_msg= with the correct language - the application determines the lang from a set= tings file - and combining them to display the log message.

CREATE TABLE event_msg (
  event_id varchar(30) NOT NULL,  language char(2) NOT NULL,
  predefined_msg varchar(250) N= OT NULL,
  PRIMARY KEY (event_id, language)
);

CREATE TAB= LE logs (
  id int NOT NULL,
  event_id varchar(30) REFERENCES event_msg (event_id) NOT NULL,&n= bsp;
  placeholder_values varchar(250),
  priority varchar= (20) NOT NULL,
  timestamp Date NOT NULL,
  primary key (id= )
);


The problem I am facing is the event_id from logs is not= able to reference event_id from event_msg as its not unique.=20
There are as many entries for each event_id as there are languages supp= orted in the 'event_msg' table.
I would be glad if somebody could sugge= st some work around here to the above structure. Or alternately do I need t= o alter the table structure altogether and if so what is the better way of = doing this?=20

Thanks in advance for any help offered.

Cheers,
Vic Rowan.

------=_Part_13686_28745949.1139319909404--