PL/pgSQL

From: Heni Lolov <hal_bg(at)yahoo(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: PL/pgSQL
Date: 2002-07-26 13:52:04
Message-ID: 20020726135204.20789.qmail@web21007.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi there
I have a problem that I can not solve.
So is there any way to return a couple of rows from a PL/pgSQL function. I need
this because I have to execute a query with undefined depth of subqueryes (not
more than 10). The searched table represents a tree. And I have to find all sub
branches og a given branch.
here is the table:

CREATE SEQUENCE grp_id_seq;
CREATE TABLE grp (
id INT PRIMARY KEY NOT NULL DEFAULT nextval('grp_id_seq'),
name VARCHAR NOT NULL,
info VARCHAR,
type_id INT DEFAULT NULL REFERENCES grp_types(id),
mastergrp_id INT REFERENCES grp(id)
);

I need it to use it in a query like this:

SELECT foo FROM footable WHERE groups IN sub_grp(some_grp_id);

Any idea how to make it?

Thanks in advance!

Hal

__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Elielson Fontanezi 2002-07-26 14:42:04 RES: [GENERAL] set DateStyle to 'SQL'
Previous Message Michael G. Martin 2002-07-26 13:50:28 Re: Postgres performance slowly gets worse over a month