I'm trying to import several modules that come bundled with 8.4.1 postgres, and all the commands to do so (such as contrib.import etc) do not work or cannot be found. Please help me.
To install PostgreSQL contrib
modules on Ubuntu or Kubuntu (or similar Linux distributions):
- Install the contrib package:
sudo apt-get install postgresql-contrib
- Restart the database:
sudo /etc/init.d/postgresql-8.4 restart
- Change to the database owner account (e.g.,
postgres
). - Change to the contrib modules' directory:
/usr/share/postgresql/8.4/contrib/
Use
ls
to see a list of the following modules:adminpack autoinc btree_gin btree_gist chkpass citext cube dblink dict_int dict_xsyn earthdistance fuzzystrmatch hstore insert_username int_aggregate isn lo ltree moddatetime pageinspect pg_buffercache pgcrypto pg_freespacemap pgrowlocks pg_stat_statements pgstattuple pg_trgm pgxml refint seg sslinfo tablefunc test_parser timetravel tsearch2 uuid-ossp
Load the SQL files using:
psql -U user_name -d database_name -f module_name.sql
For example, if your administrative user was named postgres
and your database was named storage
and the module you wanted was cube
, you would type:
psql -U postgres -d storage -f cube.sql
Hope it helps!
postgres=# select contrib.import('earthdistance'); ERROR: schema "contrib" does not exist
postgres=# select import('earthdistance.sql'); ERROR: function import(unknown) does not exist LINE 1: select import('earthdistance.sql'); ^
The above are the only import commands I have found for postgresql. Thanks for the help depesz but I am running postgresql through a windows terminal so it goes straight into postgresql and the commands do not work.