| From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
|---|---|
| To: | Nigel Horne <njh(at)bandsman(dot)co(dot)uk> |
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Adam Witney <awitney(at)sgul(dot)ac(dot)uk>, pgsql-general <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: |
| Date: | 2005-08-22 14:20:27 |
| Message-ID: | 20050822071945.M87514@megazone.bigpanda.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Mon, 22 Aug 2005, Nigel Horne wrote:
> On Fri, 2005-08-19 at 17:29, Tom Lane wrote:
> > Adam Witney <awitney(at)sgul(dot)ac(dot)uk> writes:
> > > Ah you want to return a record I suppose?
> >
> > > CREATE TABLE test (id int, name text);
> > > INSERT INTO test VALUES(1, 'me');
> > > INSERT INTO test VALUES(2, 'you');
> >
> > > CREATE FUNCTION test_func() RETURNS SETOF record AS '
> > > SELECT id, name FROM test;
> > > ' LANGUAGE SQL;
> >
> > Or better, "RETURNS SETOF test", so you don't have to describe the
> > output record type every time you call it.
>
> It strikes me that there are two problems with this approach:
>
> 1) It stores the return values in the database, that seems a waste
It shouldn't. It only uses the table's type to describe the type output
of the function, not for actual storage.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Stephan Szabo | 2005-08-22 14:27:41 | Re: SQL error - please help. |
| Previous Message | A. Kretschmer | 2005-08-22 14:12:21 | Re: |