problem referencing an attrib which is not unique - Mailing list pgsql-sql

From Vic Rowan
Subject problem referencing an attrib which is not unique
Date
Msg-id 450bdf80602070545v56252a49g8dfe0d0d04ae9065@mail.gmail.com
Whole thread Raw
Responses Re: problem referencing an attrib which is not unique  (Richard Huxton <dev@archonet.com>)
Re: problem referencing an attrib which is not unique  (Patrick JACQUOT <patrick.jacquot@anpe.fr>)
List pgsql-sql
<br /><br />---------- Forwarded message ----------<br /><span class="gmail_quote">From: <b
class="gmail_sendername">VicRowan</b> <<a href="mailto:mightymate@gmail.com">mightymate@gmail.com</a>><br />Date:
Feb7, 2006 2:31 PM <br />Subject: problem referencing an attrib which is not unique<br />To: <a
href="mailto:pgsql-sql@postgresql.org">pgsql-sql@postgresql.org</a><br/><br /></span><br />hello everybody,<br /><br
/>Ineed 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
thetables so that displaying a log message is as simple as looking up the event_id from the 'logs' table and similarly
lookingup the event_id and language from the '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. <br /><br
/>CREATETABLE event_msg (<br />  event_id varchar(30) NOT NULL,<br />  language char(2) NOT NULL,<br />  predefined_msg
varchar(250)NOT NULL,<br />  PRIMARY KEY (event_id, language)<br />);<br /><br />CREATE TABLE logs (<br />  id int NOT
NULL,<br />  event_id varchar(30) REFERENCES event_msg (event_id) NOT NULL,  <br />  placeholder_values
varchar(250),<br/>  priority varchar(20) NOT NULL,<br />  timestamp Date NOT NULL,<br />  primary key (id)<br />);<br
/><br/><br />The problem I am facing is the event_id from logs is not able to reference event_id from event_msg as its
notunique. <br />There are as many entries for each event_id as there are languages supported in the 'event_msg' table.
<br/>I would be glad if somebody could suggest some work around here to the above structure. Or alternately do I need
toalter the table structure altogether and if so what is the better way of doing this? <br /><br />Thanks in advance
forany help offered.<br /><br />Cheers,<br /><span class="sg">Vic Rowan.<br /><br /></span> 

pgsql-sql by date:

Previous
From: Achilleus Mantzios
Date:
Subject: Re: passing array to database function
Next
From: Richard Huxton
Date:
Subject: Re: problem referencing an attrib which is not unique