| From: | Richard Huxton <dev(at)archonet(dot)com> |
|---|---|
| To: | "Kumar" <sgnerd(at)yahoo(dot)com(dot)sg>, "psql" <pgsql-sql(at)postgresql(dot)org> |
| Subject: | Re: How to return a record set from function. |
| Date: | 2003-08-27 13:50:12 |
| Message-ID: | 200308271450.12485.dev@archonet.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
On Wednesday 27 August 2003 08:18, Kumar wrote:
> Dear Friends,
>
> I am newbie to Postgres. I am running 7.3.4 on Linux 7.3. I am using
> Pgadmin tool. I need to return the table rows via record set.
>
> Create table t1 (c1 int, c2 varchar, c3 varchar);
>
> Create or Replace function sel_t1 () returns setof records as '
> select c1, c2, c3 from t1;
> ' Language SQL;
>
> It was fine and created a function. while i execute it as
>
> select sel_t1;
>
> I got the following error.
>
> ERROR: Cannot display a value of type RECORD
You probably want to return "setof t1" and then do:
SELECT * FROM sel_t1();
--
Richard Huxton
Archonet Ltd
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2003-08-27 14:46:23 | Re: Canceling other backend's query |
| Previous Message | Popeanga Marian | 2003-08-27 13:04:34 | script to create a sample database |