Vic Rowan wrote:
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.

The problem is with your event_msg table. You have two concepts - "event" and "event_msg_localised" but only one table.

The logs table should reference "event" (which has one row for each event and a unique event_id). The "event_msg_localised" table also references "event".

The event table might only contain the event_id primary-key, but I'd probably put a description in their for my own use (perhaps saying what values to expect).

HTH
--
  Richard Huxton
  Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to