mercredi 7 janvier 2015

"No Loop" Constraint for hierarchical data in postgresql


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





Aucun commentaire:

Enregistrer un commentaire