Instalación de PL/R en PostgreSQL-8.4.1

From: "Ing(dot) Marcos Orti­z " <mlortiz(at)uci(dot)cu>
To: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Instalación de PL/R en PostgreSQL-8.4.1
Date: 2009-11-04 18:22:07
Message-ID: 4AF1C64F.7010803@uci.cu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Saludos a los listeros
Estaba tratando de adaptar la última versión disponible de
PL/R(plr-8.3.0.8.tar.gz) para que funcionara en PostgreSQL-8.4.1, pero
me da varios errores.
Estoy usando Debian 5.0 Lenny de 32 bits
¿Alguien ha podido adaptar plr para esta versión de PostgreSQL?

éstos son los errores
Por ejemplo:
1- Antes de importar el plr.sql para la base de datos template1 para que
todas las creadas a partir de ese momento lo tengan habilitado, creo la
función plr_call_handler() como dice la documentación del módulo
definida de la siguiente forma:

CREATE FUNCTION plr_call_handler()
RETURNS LANGUAGE_HANDLER
AS '$libdir/plr' LANGUAGE C;

Pero ya aquí comienzan los errores:
********** Error **********

ERROR: could not load library "/usr/local/pgsql/lib/plr.so": libR.so: no
se puede abrir el fichero del objeto compartido: No existe el fichero o
el directorio
Estado SQL:58P01

Y luego traté de importarlo de todas maneras pero me los siguientes errores:

drop trigger footrig on foo;
psql:/opt/postgresql-8.4.1/contrib/plr/sql/plr.sql:359: ERROR: trigger
"footrig" for table "foo" does not exist
-- Test cursors: creating, scrolling forward, closing
CREATE OR REPLACE FUNCTION cursor_fetch_test(integer,boolean) RETURNS
SETOF integer AS 'plan<-pg.spi.prepare("SELECT * FROM
generate_series(1,10)"); cursor<-pg.spi.cursor_open("curs",plan);
dat<-pg.spi.cursor_fetch(cursor,arg2,arg1); pg.spi.cursor_close(cursor);
return (dat);' language 'plr';
psql:/opt/postgresql-8.4.1/contrib/plr/sql/plr.sql:362: ERROR: language
"plr" does not exist
SELECT * FROM cursor_fetch_test(1,true);
psql:/opt/postgresql-8.4.1/contrib/plr/sql/plr.sql:363: ERROR: function
cursor_fetch_test(integer, boolean) does not exist
LINE 1: SELECT * FROM cursor_fetch_test(1,true);
^
HINT: No function matches the given name and argument types. You might
need to add explicit type casts.
SELECT * FROM cursor_fetch_test(2,true);
psql:/opt/postgresql-8.4.1/contrib/plr/sql/plr.sql:364: ERROR: function
cursor_fetch_test(integer, boolean) does not exist
LINE 1: SELECT * FROM cursor_fetch_test(2,true);
^
HINT: No function matches the given name and argument types. You might
need to add explicit type casts.
SELECT * FROM cursor_fetch_test(20,true);
psql:/opt/postgresql-8.4.1/contrib/plr/sql/plr.sql:365: ERROR: function
cursor_fetch_test(integer, boolean) does not exist
LINE 1: SELECT * FROM cursor_fetch_test(20,true);
^
HINT: No function matches the given name and argument types. You might
need to add explicit type casts.
--Test cursors: scrolling backwards
CREATE OR REPLACE FUNCTION cursor_direction_test() RETURNS SETOF integer
AS'plan<-pg.spi.prepare("SELECT * FROM generate_series(1,10)");
cursor<-pg.spi.cursor_open("curs",plan);
dat<-pg.spi.cursor_fetch(cursor,TRUE,as.integer(3));
dat2<-pg.spi.cursor_fetch(cursor,FALSE,as.integer(3));
pg.spi.cursor_close(cursor); return (dat2);' language 'plr';
psql:/opt/postgresql-8.4.1/contrib/plr/sql/plr.sql:368: ERROR: language
"plr" does not exist
SELECT * FROM cursor_direction_test();
psql:/opt/postgresql-8.4.1/contrib/plr/sql/plr.sql:369: ERROR: function
cursor_direction_test() does not exist
LINE 1: SELECT * FROM cursor_direction_test();
^
HINT: No function matches the given name and argument types. You might
need to add explicit type casts.
--Test cursors: Passing arguments to a plan
CREATE OR REPLACE FUNCTION cursor_fetch_test_arg(integer) RETURNS SETOF
integer AS 'plan<-pg.spi.prepare("SELECT * FROM
generate_series(1,$1)",c(INT4OID));
cursor<-pg.spi.cursor_open("curs",plan,list(arg1));
dat<-pg.spi.cursor_fetch(cursor,TRUE,arg1); pg.spi.cursor_close(cursor);
return (dat);' language 'plr';
psql:/opt/postgresql-8.4.1/contrib/plr/sql/plr.sql:372: ERROR: language
"plr" does not exist
SELECT * FROM cursor_fetch_test_arg(3);
psql:/opt/postgresql-8.4.1/contrib/plr/sql/plr.sql:373: ERROR: function
cursor_fetch_test_arg(integer) does not exist
LINE 1: SELECT * FROM cursor_fetch_test_arg(3);
^
HINT: No function matches the given name and argument types. You might
need to add explicit type casts.
--Test bytea arguments and return values: serialize/unserialize
create or replace function test_serialize(text)
returns bytea as '
mydf <- pg.spi.exec(arg1)
return (mydf)
' language 'plr';
psql:/opt/postgresql-8.4.1/contrib/plr/sql/plr.sql:380: ERROR: language
"plr" does not exist
create or replace function restore_df(bytea)
returns setof record as '
return (arg1)
' language 'plr';
psql:/opt/postgresql-8.4.1/contrib/plr/sql/plr.sql:385: ERROR: language
"plr" does not exist
select * from restore_df((select test_serialize('select oid, typname
from pg_type where typname in (''oid'',''name'',''int4'')'))) as t(oid
oid, typname name);
psql:/opt/postgresql-8.4.1/contrib/plr/sql/plr.sql:387: ERROR: function
test_serialize(unknown) does not exist
LINE 1: select * from restore_df((select test_serialize('select oid,...
^
HINT: No function matches the given name and argument types. You might
need to add explicit type casts.

Cualquier ayuda es bienvenida

--

"For me, the purpose is, at least partly, to have joy. Programmers often
feel joy when they can concentrate on the creative side of programming,
so Ruby is designed to make programmers happy."
Yukihiro Matsumoto (Matz), Creator of the Ruby Language

Ing. Marcos Luís Ortíz Valmaseda
PostgreSQL SysDBA && Rails Developer
BI and DWH Apprentice
Centro de Tecnologías de Almacenamiento y Análisis de Datos (CENTALAD)
Universidad de las Ciencias Informáticas (http://www.uci.cu)

Linux User # 418229

http://www.postgresql.org
http://www.postgresql-es.org
http://www.rubyonrails.org
http://www.ruby-lang.org/es/
http://www.planetrubyonrails.org/
http://www.planetpostgresql.org

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Raúl Andrés Duque Murillo 2009-11-04 18:43:35 Re: Error tipo real al restaurar base de datos
Previous Message Julio Ramirez 2009-11-04 15:20:37 Re: uso de Copy From