09 January 2008

Learning PL/pgSQL - SQL Procedural Language

I am working on my first project with Postgres and there are a couple of stuff I wanted to document:

To install PL/pgSQL which is not installed by default (!), execute the SQL command on your db:

CREATE LANGUAGE plpgsql;
Otherwise you will get the error message: "ERROR: language "plpgsql" does not exist" ...


Another surprising missing feature is the inability to connect to other databases. It's not included by default in Postgres but seats in the postgres/contrib project within the funcion dblink.

To install it on ubuntu:

sudo apt-get -y install postgresql-8.2 postgresql-contrib



That's not finished! You have to run the script manually to install it.

psql -U postgres your_database_name < /usr/share/postgresql/8.2/contrib/dblink.sql

No comments: