Re: Out parameters handling

From: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
To: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Asko Oja <ascoja(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Out parameters handling
Date: 2009-03-07 19:29:08
Message-ID: F2EF9431-A335-4E3B-80A7-725E7E4787F2@hi-media.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

In fact, maybe a new option to set the OUT parameters prefix to use
from within the function body would do?

Le 7 mars 09 à 19:56, Dimitri Fontaine a écrit :
> CREATE OR REPLACE FUNCTION test_out
> (
> IN a integer,
> IN b integer,
> OUT s integer
> )
> RETURNS setof integer

SET out_prefix TO 'v_'

> LANGUAGE PLPGSQL
> AS $f$

Those two following lines would be deprecated:

> DECLARE
> v_s ALIAS FOR $3;

> BEGIN
> FOR v_s IN SELECT generate_series(a, b)
> LOOP
> v_s := v_s * v_s;
> RETURN NEXT;
> END LOOP;
> RETURN;
> END;
> $f$;
>
> CREATE FUNCTION
> dim=# SELECT * FROM test_out(2, 4);
> s
> ----
> 4
> 9
> 16
> (3 rows)

--
dim

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2009-03-07 19:38:34 Re: [COMMITTERS] pgsql: Avoid MSVC breakage caused by my previous commit by not using a
Previous Message Dimitri Fontaine 2009-03-07 18:56:12 Re: Out parameters handling