From: | "sami jan" <sami(dot)jan(at)gmail(dot)com> |
---|---|
To: | samı <sami(dot)jan(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org, alvherre(at)commandprompt(dot)com |
Subject: | Re: plperl "set-valued function" problem |
Date: | 2007-04-10 07:58:49 |
Message-ID: | b9e5d0c40704100058s5d6dd101u34a6b5a8cc34f10c@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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(at)commandprompt(dot)com> 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
>
From | Date | Subject | |
---|---|---|---|
Next Message | A. Kretschmer | 2007-04-10 08:04:14 | Re: PlPg/SQL mulit-array as a parameter? |
Previous Message | Dave Page | 2007-04-10 07:36:10 | Re: programmatic way to fetch latest release for a given major.minor version |