I have created a Table as follows
CREATE TABLE parentChild
(
id serial NOT NULL,
parentID integer,
childIds integer[],
CONSTRAINT PARENTCHILD_pkey PRIMARY KEY (id)
)
I have also Inserted several elements in this table
Initial Table View
id | ParentID | ChildIDs
------------------------
1 | 0 |
2 | 0 |
When I insert Child of "1" where child ID will be 3 and its parent ID will be 1, I wish to append 3 to the Child IDs integer array at id=1 as shown below.
id | ParentID | ChildIDs
------------------------
1 | 0 | 3,4
2 | 0 |
3 | 1 |
Could you please let me know how to achieve this?