Unix Technical Forum

Re: [GENERAL] table column vs. out param [1:0]

This is a discussion on Re: [GENERAL] table column vs. out param [1:0] within the pgsql Sql forums, part of the PostgreSQL category; --> On 23.08.2007, at 11:55, Albe Laurenz wrote: > CREATE FUNCTION b(status OUT integer, status_text OUT text) > LANGUAGE plpgsql ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Sql

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 05:50 PM
Kristo Kaiv
 
Posts: n/a
Default 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
> $$DECLARE
> RENAME status TO out_status;
> RENAME status_text TO out_status_text;
> BEGIN
> SELECT status, status_text
> FROM a()
> INTO out_status, out_status_text;
> RETURN;
> END;$$;
>
> See
> http://www.postgresql.org/docs/current/static/plpgsql-
> declarations.html#
> PLPGSQL-DECLARATION-RENAMING-VARS
>
> Yours,
> Laurenz Albe

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?

Kristo Kaiv
http://kaiv.wordpress.com (PostgreSQL blog)



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-19-2008, 05:50 PM
Tom Lane
 
Posts: n/a
Default Re: [GENERAL] table column vs. out param [1:0]

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

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-19-2008, 05:50 PM
Kristo Kaiv
 
Posts: n/a
Default Re: [GENERAL] table column vs. out param [1:0]


On 27.08.2007, at 18:07, Tom Lane wrote:

> 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

Tom, the TODO item says:
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)

Kristo Kaiv
http://kaiv.wordpress.com (PostgreSQL blog)



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:36 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com