Referential integrity using constant in foreign key

Поиск
Список
Период
Сортировка
От Andrus Moor
Тема Referential integrity using constant in foreign key
Дата
Msg-id d21dtu$imu$1@news.hub.org
обсуждение исходный текст
Ответы Re: Referential integrity using constant in foreign key  (Thomas F.O'Connell <tfo@sitening.com>)
Список pgsql-general
I need to create referential integrity constraints:

CREATE TABLE classifier (
category CHAR(1),
code CHAR(10),
PRIMARY KEY (category,code)  );

-- code1 references to category 1,
-- code2 references to category 2 from classifier table.
CREATE TABLE info (
code1 CHAR(10),
code2 CHAR(10),
FOREIGN KEY ('1', category1) REFERENCES classifier,
FOREIGN KEY ('2', category2) REFERENCES classifier
);

Unfortunately, second CREATE TABLE causes error

ERROR:  syntax error at or near "'1'" at character 171

Any idea how to implement referential integrity for info table ?
It seems that this is not possible in Postgres.

Andrus.



В списке pgsql-general по дате отправления:

Предыдущее
От: Jeff Amiel
Дата:
Сообщение: Persistent data per connection
Следующее
От: Dawid Kuroczko
Дата:
Сообщение: Re: Delay INSERT