From: | "D(dot) Dante Lorenso" <dante(at)lorenso(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "D(dot) Dante Lorenso" <dante(at)lorenso(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Postgres-General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Returning RECORD from PGSQL without custom type? |
Date: | 2008-05-12 19:23:29 |
Message-ID: | 48289931.4000908@lorenso.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Tom Lane wrote:
> "D. Dante Lorenso" <dante(at)lorenso(dot)com> writes:
>> I'd like to be able to do this:
>>
>> CREATE OR REPLACE FUNCTION "my_custom_func" (in_value bigint)
>> RETURNS SETOF (col1name BIGINT, col2name TEXT, ...) AS
>
> You realize of course that you can do this *today* if you use OUT
> parameters?
No, I didn't realize. I always assumed OUT parameters were like return
values from a function ... like:
(out1, out2, out3) = somefunction (in1, in2, in3);
I never realized you could return a SETOF those OUT parameters. I guess
it wasn't intuitive, but I'm learning this now.
I think all the functionality I want DOES already exist. Let me go work
with it. Thanks.
-- Dante
>
> CREATE OR REPLACE FUNCTION "my_custom_func" (in_value bigint,
> OUT col1name BIGINT, OUT col2name TEXT, ...)
> RETURNS SETOF RECORD AS
>
> The TABLE syntax is a bit more standards-compliant maybe, but it's not
> offering any actual new functionality.
>
> regards, tom lane
>
From | Date | Subject | |
---|---|---|---|
Next Message | IVO GELOV | 2008-05-12 19:39:07 | Strange behaviour - performance decreases after each TRUNCATE |
Previous Message | Tom Lane | 2008-05-12 19:11:27 | Re: Hung SQL Update Linux Redhat 4U5 Postgres 8.3.1 |