| From: | Raymond O'Donnell <rod(at)iol(dot)ie> |
|---|---|
| To: | Rakotomandimby Mihamina <mihamina(at)gulfsat(dot)mg> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: return multiple rows |
| Date: | 2009-09-11 15:41:47 |
| Message-ID: | 4AAA6FBB.2040309@iol.ie |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
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:
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(at)iol(dot)ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Merlin Moncure | 2009-09-11 15:51:01 | Re: constraint definition on an array column? |
| Previous Message | Rakotomandimby Mihamina | 2009-09-11 14:56:33 | Re: return multiple rows |