How To Return a Row or Result Set

From: Ketema Harris <ketema(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: How To Return a Row or Result Set
Date: 2006-02-01 16:26:47
Message-ID: 983b67500602010826t442e948aw83fa3f84818f5a1a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I believe i figured it out...

CREATE OR REPLACE FUNCTION "public"."recruiting_login" (_username
varchar, _password varchar) RETURNS setof credentials AS
'
declare
user_creds credentials;
begin
if _password = (select "password" from recruiting_users where
username = _username) then
select into user_creds user_id, "admin" from
recruiting_users where username = _username;
else
select into user_creds 0, false from recruiting_users;
end if;
return next user_creds;
end;
'
LANGUAGE 'plpgsql'

is the best and correct way to Return a Row or Result Set?

Browse pgsql-novice by date

  From Date Subject
Next Message Gan Uesli Starling 2006-02-01 22:59:26 Dropping sub-tables
Previous Message Ketema Harris 2006-02-01 16:00:56 How To Return a Row or Result Set