The syntax for Foreign Key, as described in official documentation, includes set of column from table A referencing set of column from table B.
Is it possible to use Constant in foreign key declaration?
The problem is, I have table DICTIONARIES which contains all dictionary values, discriminated by TYPE. I know it's not good design, but unfortunatelly, I have not much to say, as the DB admin wants to 'minimize the number of tables'...
Is it possible to achieve something like that:
CREATE TABLE PERSON (
id integer primary key,
country_id integer,
...
FOREIGN KEY ('COUNTRY', country_id) REFERENCES DICTIONARIES(TYPE, ID)
)
It would effectively solve the issue. I'm aware I can add column to the table person, which will has only one possible value 'COUNTRY', or I could write a trigger, but I'd prefer to avoid that to keep design cleaner.