Hi!
Is it possible to create a “FOREIGN KEY CONSTRAINT” with references to multiple columns of the reference table?
For example:
Table parm:
CREATE TABLE parm
(
complex varchar(20) NOT NULL,
para varchar(50) NOT NULL,
sort int4 NOT NULL DEFAULT 10,
value varchar(50) NULL,
CONSTRAINT parm_pkey PRIMARY KEY (complex, para, sort)
)
Table user
CREATE TABLE user
(
name varchar(20) NOT NULL,
type integer NULL
)
Now I want to create FOREIGN KEY on user.type with references on parm.value and param.para WHERE param.para = ‘user_type’
Something like this:
ALTER TABLE user ADD CONSTRAINT user_type_fkey FOREIGN KEY (type) REFERENCES parm (value,para) WHERE parm.para = 'user_type';
Regards …