I have 2 local docker postgresql-10.7 servers set up. On my hot instance, I have a huge table that I wanted to partition by date (I achieved that). The data from the partitioned table (Let's call it PART\_TABLE) is stored on the other server, only PART\_TABLE\_2019 is stored on HOT instance. And here comes the problem. I don't know how to partition 2 other tables that have foreign keys from PART\_TABLE, based on FK. PART\_TABLE and TABLE2\_PART are both stored on HOT instance.

I was thinking something like this: 

```
create table TABLE2_PART_2019 partition of TABLE2_PART for values in (select uuid from PART_TABLE_2019);

```

But the query doesn't work and I don't know if this is a good idea (performance wise and logically).

Let me just mention that I can solve this with either function or script etc. but I would like to do this without scripting.