Displaying articles with tag

PL/Ruby on CentOS 5

Posted by hank, Wed Aug 01 20:24:00 UTC 2007

I had some trouble compiling PL/Ruby for PostgreSQL today on Modzer0. I solved it with some clever extconf.rb switches:


ruby extconf.rb --with-pgsql-include=/usr/include/pgsql/ --with-pgsql-version=81

Now I avoid the problems I was having before:


[root@modzer0 plruby-0.5.1]# make
make[1]: Entering directory 
#...
In function ‘perm_fmgr_info’:plruby.c:116: error: ‘TopMemoryContext’ undeclared (first use in this function)
plruby.c:116: error: (Each undeclared identifier is reported only once
plruby.c:116: error: for each function it appears in.)
plruby.c: In function ‘plruby_call_handler’:
plruby.c:706: warning: unused variable ‘result’
plruby.c: In function ‘pl_compile’:
plruby.c:875: error: subscripted value is neither array nor pointer
plruby.c:876: error: subscripted value is neither array nor pointer
plruby.c:879: error: subscripted value is neither array nor pointer
plruby.c:889: error: subscripted value is neither array nor pointer
plruby.c:937: error: ‘TopMemoryContext’ undeclared (first use in this function)
make[1]: *** [plruby.o] Error 1

Now I just have to create the language in Postgres. I’m making it trusted since I don’t want anyone doing anything nasty. I might build the untrusted version later like Robby did here.


CREATE FUNCTION plruby_call_handler() RETURNS language_handler
  AS '/usr/lib/ruby/site_ruby/1.8/i386-linux/plruby.so'
  LANGUAGE C;

CREATE TRUSTED LANGUAGE 'plruby'
  HANDLER plruby_call_handler
  LANCOMPILER 'PL/Ruby';

Voila!


Procedural Languages
  Name  | Trusted? 
--------+----------
 plperl | yes
 plruby | yes

OH OH

Tags: