I've been having some issues while trying to learn PostgreSQL. I've created a relational object called person and then a table consisting of a primary integer key and an array of person objects. I have a feeling it's the way I am inserting rows into this array however, I am unsure of how to access specific columns of the object as well (Ex. person.name).
Currently the only way I was able to insert a row is as follows however, I think it may just be making a string object instead of the proper person object.
INSERT INTO towns VALUES (0, '{"(bob,blue,springfield,33)"}');
For reference the schema I created is:
CREATE TYPE person AS (
name text,
favorite_color text,
hometown text,
age integer
);
CREATE TABLE towns (
town_id integer PRIMARY KEY,
people person[]
);