Quantcast
Channel: Question and Answer » postgresql
Viewing all articles
Browse latest Browse all 1138

“No Loop” Constraint for hierarchical data in postgresql

$
0
0

I’ve got table like this in postgres:

  • id primary key
  • parent_id foreign key on id
  • some data columns

I need no a constrain which prevents cycles on the parent relations. There might be more tree in the table (root of a tree is null in parent_id).

How to achieve this goal?

Thanks

Daniel


Viewing all articles
Browse latest Browse all 1138

Trending Articles