Search Postgresql Archives

Re: plperl "set-valued function" problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Alvaro

I checked out the files from: pgsql/src/pl/plperl/sql/ and
pgsql/src/pl/plperl/expected and compared the results

I still found a difference in 2 functions :
====================
Function 1 - Expected:
====================
CREATE OR REPLACE FUNCTION perl_spi_prepared(INTEGER) RETURNS INTEGER AS $$
  my $x = spi_prepare('select $1 AS a', 'INTEGER');
  my $q = spi_exec_prepared( $x, $_[0] + 1);
  spi_freeplan($x);
return $q->{rows}->[0]->{a};
$$ LANGUAGE plperl;

SELECT * from perl_spi_prepared(42);

perl_spi_prepared
-------------------
               43
(1 row)

====================
Function 1 - Actual Output:
====================
ERROR:  error from Perl function: type "integer" does not exist at line 2.

====================
Function 2 - Expected:
====================
CREATE OR REPLACE FUNCTION perl_spi_prepared_double(double precision)
RETURNS double precision AS $$
 my $x = spi_prepare('SELECT 10.0 * $1 AS a', 'DOUBLE PRECISION');
 my $q = spi_query_prepared($x,$_[0]);
 my $result;
 while (defined (my $y = spi_fetchrow($q))) {
     $result = $y->{a};
 }
 spi_freeplan($x);
 return $result;
$$ LANGUAGE plperl;

SELECT perl_spi_prepared_double(4.35) as "double precision";

double precision
------------------
            43.5
(1 row)

====================
Function 2 - Actual Output:
====================
ERROR:  error from Perl function: invalid name syntax at line 2.


Is this due to a bug? I think this is related - a problem with typename aliases

http://archives.postgresql.org/pgsql-bugs/2007-01/msg00111.php

Even if this is a bug and it has been logged, how did the author of
these files generate the result sets as seen in the .expected files?
Has he been using a newer version of Postgres?

I am using the PG 8.2.3 WinXP installer downloaded on 07 Feb 2007

Thanks

Sami


On 4/10/07, Alvaro Herrera <alvherre@xxxxxxxxxxxxxxxxx> wrote:
samı escribió:
> Hi
>
> I am using PostgreSQL 8.2.3 on WindowsXP
>
> I am using the PL/Perl regression tests located here:
>
>      http://developer.postgresql.org/cvsweb.cgi/pgsql/src/pl/plperl/test/Attic/test_queries.sql

The fact that these files are in the "Attic" means they were deleted.
Try the files that actually exist:

http://developer.postgresql.org/cvsweb.cgi/pgsql/src/pl/plperl/sql/
http://developer.postgresql.org/cvsweb.cgi/pgsql/src/pl/plperl/expected/

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux