I have a PostgreSQL table containing a bunch of foreign keys pointing to another table:
create table foo (
hourly00 uuid references hourly(id),
hourly01 uuid references hourly(id),
-- etc.
hourly23 uuid references hourly(id),
-- omit rest
);
Admittedly, this looks silly (and I am lucky to have only 24 of such keys), but I have not found anything better.
In the meantime, I stumbled on PostgreSQL documentation about arrays (I did not know about PostgreSQL arrays before). I got an idea and I tried this:
create table foo (
hourly uuid[24] references hourly(id)
);
which, of course, immediately resulted in an error:
ERROR: foreign key constraint "main_hourly_fkey" cannot be implemented
DETAIL: Key columns "hourly" and "id" are of incompatible types: uuid[] and uuid.
But then I got another idea — to ask about my situation on StackOverflow. So my question is: does PostgreSQL provide means for doing something like this, i.e. for having an array of foreign keys in a table? Is it perhaps doable with some PL/*? Or perhaps with some other database system? I am willing to do my own research, but I have no idea as to where to look.