Skip site navigation (1) Skip section navigation (2)

Re: New PL/Perl failure with Safe 2.2x due to recursion (8.x & 9.0)

From: Alex Hunsaker <badalex(at)gmail(dot)com>
To: Tim Bunce <Tim(dot)Bunce(at)pobox(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org, "David E(dot) Wheeler" <david(dot)wheeler(at)pgexperts(dot)com>, Rafael Garcia-Suarez <rgs(at)consttype(dot)org>
Subject: Re: New PL/Perl failure with Safe 2.2x due to recursion (8.x & 9.0)
Date: 2010-02-25 02:17:52
Message-ID: 34d269d41002241817o6f7c0639k7a3d80cc9d3ea5f3@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-bugs
On Tue, Feb 23, 2010 at 15:23, Tim Bunce <Tim(dot)Bunce(at)pobox(dot)com> wrote:

> I believe (but haven't yet confirmed) that the problem here is recursion.
> This affects all versions of PostgreSQL.

Hrm... This seems to work for me in HEAD.  It certainly breaks in 8.3.
 Am I missing something?

----
$ bin/psql postgres
psql (9.0devel)
Type "help" for help.

postgres=#  CREATE OR REPLACE FUNCTION foo( integer) RETURNS SETOF INT
LANGUAGE plperl AS $$ $$;
CREATE FUNCTION
postgres=# \q
$ bin/psql postgres
psql (9.0devel)
Type "help" for help.

postgres=#  CREATE OR REPLACE FUNCTION try() RETURNS VOID LANGUAGE plperl AS $$
       my $sth = spi_query("SELECT id FROM foo( 0 ) AS g(id)");
       while( my $row = spi_fetchrow($sth) ) {
       }
   $$;
CREATE FUNCTION
postgres=# SELECT try();
 try
-----

(1 row)

Seems like assuming I did the above correctly we just have a bug in
the older branches where the "SELECT id FROM foo(0)..." part is
getting compiled/executed in the wrong perl context.  In-fact I would
not be surprised at all if there are other dragons lurking when plperl
calls something that tries to compile/call a plperl function.  Safe
>2.20 or older.

Ill keep digging.

In response to

Responses

pgsql-bugs by date

Next:From: Alex HunsakerDate: 2010-02-25 03:00:49
Subject: Re: New PL/Perl failure with Safe 2.2x due to recursion (8.x & 9.0)
Previous:From: Tom LaneDate: 2010-02-24 21:03:10
Subject: Re: to_timestamp error handling.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group