Repost of Functions Returning Record Datatype

From: A E <cooljoint(at)yahoo(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Repost of Functions Returning Record Datatype
Date: 2004-01-04 04:05:15
Message-ID: 20040104040515.80016.qmail@web12106.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I was wondering if I have a function that returns a record datatype, and I call it using the as keyword to specify the table structure, can I return a different structure than the one specified?

Say I call select * from xy ('abc', 'def') as (samplea char, sampleb char) for a function of

CREATE FUNCTION xy(char, char) RETURNS record AS'
Declare
testout record;
if userallowed = 0 then

else
for testout in ''select * from testtable'' loop
return next testout;
end loop;
end if;
return null;
end;'
language 'plpgsql';

Can I instead send back "errordescription text, errornumber int, errornext int"? How do I do that?

I have a web front end and I have to get custom database errors to the front end. Maybe there is something more simple?

TIA
Alex Erwin

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Conway 2004-01-04 06:56:27 Re: Lock contention (was Re: [PATCHES] update i386
Previous Message Keith C. Perry 2004-01-04 01:58:11 Re: Is my MySQL Gaining ?