How to represent a tree-structure in a relational database

Поиск
Список
Период
Сортировка
От Frank Joerdens
Тема How to represent a tree-structure in a relational database
Дата
Msg-id 3A379A5F.97FFAF01@joerdens.de
обсуждение исходный текст
Ответы Re: How to represent a tree-structure in a relational database  (Mathijs Brands <mathijs@ilse.nl>)
Re: How to represent a tree-structure in a relational database  (miguel sofer <mig@utdt.edu>)
RE: How to represent a tree-structure in a relational database  ("Stuart Statman" <stu@slammedia.com>)
Re: How to represent a tree-structure in a relational database  (hubert depesz lubaczewski <depesz@depesz.pl>)
Список pgsql-sql
I am just thinking about the data model for a little content management system that I am
currently planning. Individual articles are sorted under different categories which branch
into subcategories, sub-subcategories etc. up to a depth of about 6 or 7 levels. The
structure should be extensible, i.e. it must be possible to add levels. What I am thinking
now is that you would keep the index in a separate index table (linked with the primary
key in the articles table), which would have 6 or 7 fields initially, and that you'd add
columns with the alter table command, if need be, to make the structure deeper. Is this
the recommended way to go about it? It feels pretty 'right' to me now but since the
problem should be fairly common, there must be other people who have thought and written
about it and there might even be a recognized 'optimal' solution to the problem.

Comments?

- Frank


В списке pgsql-sql по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: SQL parse error
Следующее
От: Kyle
Дата:
Сообщение: Strange slow behavior in backend