Archive

Posts Tagged ‘postgres’

Reading compressed files with postgres using named pipes

September 4th, 2009

Postgres has the same type of ability MySQL has to read in files, yet much nicer syntax. LOAD DATA INFILE from MySQL is just COPY in postgres. I decided to try having it read from a named pipe today, and it worked out nicely.
Read more…


Uncategorized , , , , ,

OSCON 2008 Tutorials: A perspective

July 22nd, 2008

I’ve been at OSCON 2008, and I’ve been keeping pretty good notes on the tutorials I’ve attended. GitHub has a great feature if you take notes in rdoc, making nice HTML when it’s viewed online. Here’s some links to my notes:

Pro PostgreSQL

This talk was alright, but it wasn’t really tailored for people who hadn’t used Postgres extensively. Yet, I’m sure the notes will come in handy in the future.

Introduction to Django

This was an awesome talk. He went through designing an actual working application using Django. It turns out to be incredibly easy to quickly create a really cool application. I need to research this because it looks to me to be better than Rails.

Ubiquitous Multithreading

This talk was alright if you wanted to get an idea about the challenges of multi-threading and how Intel’s TBB solves some of them. It was interesting, and I learned a few things, but it would have been a better session than a tutorial (LONG!)


Uncategorized , , , , ,

PL/Ruby on CentOS 5

August 1st, 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


Uncategorized , , , , ,