You have an enumerated field that can only take certain well-defined values, and want to restrict it to those values (e.g. a day-of-week field, a prime-number field) - you think a foreign key referencing a lookup table isn't right in this case.
Add a CHECK constraint with a boolean expression that returns true when the field's value is valid ref.
In the diary table, the dy_type field can only have certain values.
CREATE TABLE diary (
dy_type text CHECK (dy_type IN ('Created', 'Order', 'Delivery', 'Paid', 'Note')),
...
|
Note that you need to be careful with this - if we add a new diary-type (say 'Message') you will need to change the table definition, whereas with a foreign key you would just add another row to the lookup table.