return multiple rows

From: Rakotomandimby Mihamina <mihamina(at)gulfsat(dot)mg>
To: pgsql-general(at)postgresql(dot)org
Subject: return multiple rows
Date: 2009-09-11 14:53:52
Message-ID: 4AAA6480.5020003@gulfsat.mg
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,
I have a FUNCTION queried like this:
SELECT * FROM f_authorize_check_query2('%{SQL-User-Name}','%{User-Password}' [...];

Built this way:
CREATE FUNCTION f_authorize_check_query2(...) RETURNS radcheck
AS $_$
DECLARE
[...]
v_ret radcheck%ROWTYPE;
[...]
SELECT INTO v_ret '111',username,'Cleartext-Password',pwd,':=' FROM [...]
RETURN v_ret;
END;
$_$
LANGUAGE plpgsql;

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 |
+----+----------+--------------------+----+-------+

*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.

Is SELECTing INTO a second time OK?

--
Architecte Informatique chez Blueline/Gulfsat:
Administration Systeme, Recherche & Developpement
+261 34 29 155 34

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rakotomandimby Mihamina 2009-09-11 14:56:33 Re: return multiple rows
Previous Message Thomas Kellerer 2009-09-11 14:51:46 Re: Open source database design tool , alternative to MicroOLDAP