Search Postgresql Archives

Re: return multiple rows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux