Re: Results of stored procedures in WHERE clause

Поиск
Список
Период
Сортировка
От Justin Pasher
Тема Re: Results of stored procedures in WHERE clause
Дата
Msg-id MX13SOlbpH71yEXUIEA000001c6@mx1.ad.newmediagateway.com
обсуждение исходный текст
Ответ на Results of stored procedures in WHERE clause  (Gordon <gordon.mcvey@ntlworld.com>)
Список pgsql-general
> -----Original Message-----
> From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-
> owner@postgresql.org] On Behalf Of Gordon
> Sent: Tuesday, May 20, 2008 11:03 AM
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] Results of stored procedures in WHERE clause
>
> I have a table representing tree structures of pages on a website.
> they have an itm_id column (integer key) and an itm_parent column
> (pointer to item's parent node).  Any item with an itm_parent of 0 is
> a root node, representing a website.  Anything with a non-zero parent
> is a non-root node representing a folder or document in a website.
>
> I need to be able to do queries that restrict my result set to items
> belonging to a specified site and ignore all nodes that belong to
> different sites.  To determine the ID of the site an item belongs to I
> wrote a stored procedure:

...

I would highly recommend checking out the ltree contrib module. It will make
this task much easier, as long as you are not locked into the current
database design. Manually performing multi-level parent/child relationships
on a table can become quite painful. You will probably get faster results
using ltree also due to the fact that you can perform what you want with one
query instead of looping through multiple queries (very important if your
tree gets big).

http://www.sai.msu.su/~megera/postgres/gist/ltree/


Justin Pasher


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

Предыдущее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: Error: Could not open relation...
Следующее
От: "Gurjeet Singh"
Дата:
Сообщение: Re: Is this correct usage of generate_series?