Joined November 2017
·

ygilany

Software developer
·
·
·

Posted to Hierarchical data in postgres over 1 year ago

@wambacher
The trigger will update the parent_path for you. Which means you'd need to insert the id, name, and parent_id and it would update the path for you. -- the inserts will be the same as the first one.

That said, your query still has a couple of small issues:
1. it should be parentpath not parentpath
2. the last element should be root.3.5 not root.3.4
```sql
INSERT INTO section (id, name, parent
path) VALUES (3, 'Section 2', 'root');
INSERT INTO section (id, name, parentpath) VALUES (4, 'Section 2.1', 'root.3');
INSERT INTO section (id, name, parent
path) VALUES (5, 'Section 2.2', 'root.3');
INSERT INTO section (id, name, parent_path) VALUES (6, 'Section 2.2.1', 'root.3.5'); -- this needs to be 3.5 not 3.4
```

Few notes though. If you want to merge a feature branch it might be wiser to actually merge your commits thus having a single point of integration of two distinct branches.
Also the conflict resolving will be now per commit basis, not everything-at-once, so you will have to use git rebase --continue to get to the next batch of conflicts (if you have any).

I’m not sure if I understand what you mean .. can you explain that a little bit

Achievements
1 Karma
0 Total ProTip Views