Foreign keys are supported, but composite foreign keys are not. Example code:
create table categories (
name text not null primary key
);
create table subcategories (
name text not null,
category_name text not null references categories(name),
primary key(name, category_name)
);
create table items (
name text not null primary key,
category_name text not null references categories(name),
subcategory_name text,
foreign key (category_name, subcategory_name) references subcategories(category_name, name)
);
I'm able to choose from a set of pre-existing categories in items and subcategories, but I'm not able to choose from a constrained set of subcategories in items. Further, it seems like it won't let me enter one that already exists.