Unix Technical Forum

Re: patch fixing the old RETURN NEXT bug

This is a discussion on Re: patch fixing the old RETURN NEXT bug within the Pgsql Patches forums, part of the PostgreSQL category; --> Added to TODO: o Fix problems with RETURN NEXT on tables with dropped/added columns after function creation http://archives.postgresql.org/pgsql-patches/2006-02/msg00165$ --------------------------------------------------------------------------- ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Patches

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-18-2008, 12:44 AM
Bruce Momjian
 
Posts: n/a
Default Re: patch fixing the old RETURN NEXT bug


Added to TODO:

o Fix problems with RETURN NEXT on tables with
dropped/added columns after function creation

http://archives.postgresql.org/pgsql-patches/2006-02/msg00165$


---------------------------------------------------------------------------

Sergey E. Koposov wrote:
> Hello All,
>
> I'm proposing the fix of this bug:
> http://archives.postgresql.org/pgsql...2/msg00498.php
>
> The exact SQL code exposing the error:
>
> ----------
>
> create table usno (ra real, dec real, bmag real, rmag real,ipix int8);
> CREATE OR REPLACE FUNCTION xxx(refcursor) RETURNS refcursor AS '
> DECLARE query varchar;
> BEGIN
> query = ''SELECT * FROM usno'';
> OPEN $1 FOR EXECUTE query;
> RETURN $1;
> END;
> ' LANGUAGE plpgsql;
>
> CREATE OR REPLACE FUNCTION yyy() RETURNS SETOF usno AS '
> DECLARE rec record;
> DECLARE cur refcursor;
> BEGIN
> cur=xxx(''curs_name'');
> LOOP
> FETCH cur into rec;
> EXIT WHEN NOT FOUND;
> RETURN NEXT rec;
> END LOOP;
> RETURN;
> END;
> ' LANGUAGE plpgsql;
>
> insert into usno values(1,2,3,4);
> select * from yyy();
> alter table usno add column errbox box;
> select * from yyy();
> alter table usno drop column errbox;
> select * from yyy();
>
> -------
>
> The problem with that is in fact in pl_exec.c in function
> compatible_tupdesc(), which do not check for the deleted attributes.
>
> The patch is attached.
>
> Regards,
> Sergey
>
> ************************************************** ***
> Sergey E. Koposov
> Max Planck Institute for Astronomy
> Web: http://lnfm1.sai.msu.ru/~math
> E-mail: math@sai.msu.ru
>


Content-Description:

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend


--
Bruce Momjian http://candle.pha.pa.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

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 01:51 PM.


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