On 11/09/2009 15:53, Rakotomandimby Mihamina wrote:
>
> It returns only one row, like this:
> +----+----------+--------------------+----+-------+
> | id | UserName | Attribute | op | Value |
> +----+----------+--------------------+----+-------+
> | 1 | bartek | Cleartext-Password | := | 1234 |
> +----+----------+--------------------+----+-------+
>
> I would like it to return
> +----+----------+--------------------+----+-------+
> | id | UserName | Attribute | op | Value |
> +----+----------+--------------------+----+-------+
> | 1 | bartek | Cleartext-Password | := | 1234 |
> | 3 | bartek | Simultaneous-Use | := | 1 |
> +----+----------+--------------------+----+-------+
You need to declare the function as returning SETOF radcheck, and then
use the RETURN NEXT construct - see the pl/pgsql docs here:
http://www.postgresql.org/docs/8.4/static/plpgsql-control-structures.html#PLPGSQL-STATEMENTS-RETURNING
There's an example here of how you do this.
> *But*, I would like to _hardcode_ the "Simultaneous-Use" row.
> If I use a FUNCTION to build the "Cleartext-Password" row, it's because
> the data structure
> could not have been feetched simply.
I'm not sure what you're getting at here.
Ray.
------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------