Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-create.sql,v diff -u -r1.65 -r1.66 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-create.sql 21 Feb 2018 14:11:08 -0000 1.65 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-create.sql 3 Sep 2024 15:37:30 -0000 1.66 @@ -197,8 +197,16 @@ storage_area_key varchar(100) default 'CR_FILES' not null, tree_sortkey varbit not null, max_child_sortkey varbit -); +); +-- +-- Avoid potential loops on parent_ids. An item must not be equal to +-- its own parent. Note that this constraint is not guaranteed to +-- avoid all loops; it is still possible to create indirect recursive +-- loops but excludes some real-world problems. +-- +ALTER TABLE cr_items ADD CONSTRAINT cr_items_parent_id_ck CHECK (item_id != parent_id); + create index cr_items_by_locale on cr_items(locale); create index cr_items_by_content_type on cr_items(content_type); create unique index cr_items_by_live_revision on cr_items(live_revision); @@ -841,7 +849,7 @@ A one-to-many mapping table of content folders to content types. Basically, this table restricts the content types a folder may contain. Future releases will add numeric and tagged constraints similar to - thos available for content types. + those available for content types. '; -- RI Indexes