Ensure referential integrity of the materialized path?

I am trying to implement a tree-like structure using the materialized path model described here: http://www.dbazine.com/oracle/or-articles/tropashko4 .

Is it possible to force referential integrity in the [path] field? I don’t see how SQL can do this, do I need to do it manually in DAL?

+5
source share
4 answers

Yes, you need to ensure data integrity in the DAL when you use Materialized Path or Nested Sets for hierarchical data.

Adjacency List , , " "( " ").

+3

" ", , ( " - ".).

" " - , " " , , , " ", , - .

SQL , . (: , SQL , .) , RM , SQL , , SQL , .

(@Bill Karwin: +1 . , "" . , SQL .)

, RM =

+3

(, unicode, 256 ) "x.y.z". - . (, PostgreSQL)

check(parent_id = substring(id from 1 for char_length(id)-1)),

create table. "x.y.z", , , .

+1

, " []". , :

0
source

All Articles