Referencing a row from another table (PostgreSQL)
问题 I'm new to PostgreSQL and I'm struggling to understand how to use a reference to an 'instance' (or row) from a table as a value within a row of another table. Here is my desired result: class User{ int age; Post[] posts; } class Post{ int postId; ... } // Sql script sqlMain{ User k = new User(20); k.addPost(10, ...); } As you can see, I want an (dynamic prefereably, like an ArrayList) array of posts as an attribute of a user. So far I have the following Script: CREATE TABLE Post( postId INT )