Thread: Re: [GENERAL] table column vs. out param [1:0]
On 23.08.2007, at 11:55, Albe Laurenz wrote:
CREATE FUNCTION b(status OUT integer, status_text OUT text)LANGUAGE plpgsql STABLE STRICT AS$$DECLARERENAME status TO out_status;RENAME status_text TO out_status_text;BEGINSELECT status, status_textFROM a()INTO out_status, out_status_text;RETURN;END;$$;SeePLPGSQL-DECLARATION-RENAMING-VARSYours,Laurenz Albe
Note: RENAME appears to be broken as of PostgreSQL 7.3. Fixing this is of low priority, since ALIAS covers most of the practical uses of RENAME.
Seems to work though. Could somebody please confirm/reject that this has been fixed?
Kristo Kaiv
http://kaiv.wordpress.com (PostgreSQL blog)
Kristo Kaiv <kristo.kaiv@skype.net> writes: > From http://www.postgresql.org/docs/current/static/plpgsql- > declarations.html#PLPGSQL-DECLARATION-RENAMING-VARS > Note: RENAME appears to be broken as of PostgreSQL 7.3. Fixing this > is of low priority, since ALIAS covers most of the practical uses of > RENAME. > Seems to work though. Could somebody please confirm/reject that this > has been fixed? It "works" only for very small values of "works". See the links in the TODO item for it. regards, tom lane
On 27.08.2007, at 18:07, Tom Lane wrote:
Kristo Kaiv <kristo.kaiv@skype.net> writes:declarations.html#PLPGSQL-DECLARATION-RENAMING-VARSNote: RENAME appears to be broken as of PostgreSQL 7.3. Fixing thisis of low priority, since ALIAS covers most of the practical uses ofRENAME.Seems to work though. Could somebody please confirm/reject that thishas been fixed?It "works" only for very small values of "works". See the links inthe TODO item for it.regards, tom lane
Server-Side Languages
- PL/pgSQL
- Fix RENAME to work on variables other than OLD/NEW
but it seems to already work. I have tested it on 8.2 and have not noticed any problems.
orderdb_test=# \df+ test
List of functions
-[ RECORD 1 ]-------+--------------------------
Schema | public
Name | test
Result data type | text
Argument data types | i_a text, OUT asi text
Owner | kristok
Language | plpgsql
Source code |
: DECLARE
: -- o_asi ALIAS FOR $2;
: RENAME asi TO o_asi;
: BEGIN
: select 32 into o_asi;
: return;
: END;
:
Description |
orderdb_test=# select * from test(123);
asi
-----
32
(1 row)