problem referencing an attrib which is not unique
От | Vic Rowan |
---|---|
Тема | problem referencing an attrib which is not unique |
Дата | |
Msg-id | 450bdf80602070545v56252a49g8dfe0d0d04ae9065@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: problem referencing an attrib which is not unique
Re: problem referencing an attrib which is not unique |
Список | 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 по дате отправления: