Register
Login

PostgreSQL Recursion
15.3.2009

This isn't really covered anywhere, but PostgreSQL has a built-in language that makes a comment system really easy. You can recursively find the comment hierarchy, which will give you a Reddit-style comment layout. This ends up being much simpler than flat solutions or depth tracking.

Edit: example code here.

comments:
Post

Type the string below:

 _   _ _  _        ____  
| | | | || | ___| _ \
| |_| | || |_ / _ \ | | |
| _ |__ _| __/ |_| |
|_| |_| |_| \___|____/

*Comments may take up to 60 seconds to appear.