Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use Postgres 9.1 on Xubuntu 11.10. I've created a db 'aus' and user 'aus', granted ALL on the db to the user. Now I try to import the data, and it outputs this error:

$ osm2pgsql --create --database aus --username aus --prefix planet australia.osm -S /usr/share/osm2pgsql/
osm2pgsql SVN version 0.70.5

Using projection SRS 900913 (Spherical Mercator)
Setting up table: planet_point
NOTICE:  table "planet_point" does not exist, skipping
NOTICE:  table "planet_point_tmp" does not exist, skipping
SELECT AddGeometryColumn('planet_point', 'way', 900913, 'POINT', 2 );
failed: ERROR:  permission denied for relation geometry_columns
CONTEXT:  SQL statement "DELETE FROM geometry_columns WHERE
    f_table_catalog = '' AND f_table_schema = 'public' AND f_table_name = 'planet_point' AND f_geometry_column = 'way'"
PL/pgSQL function "addgeometrycolumn" line 133 at EXECUTE statement
SQL statement "SELECT AddGeometryColumn('','',$1,$2,$3,$4,$5)"
PL/pgSQL function "addgeometrycolumn" line 5 at SQL statement

What's wrong with my database?

edit: the solution:

$ sudo su -l postgres
$ psql -d aus
# grant all on database aus to aus;
# alter database aus owner to aus;
$ osm2pgsql ...
here we go...
share|improve this question
up vote 6 down vote accepted

Maybe the user aus is not the owner of the database:

first become super user:

$ sudo su

change to postgres user:

$ su postgres

access postgres, and change the owner, also grant permissions

$ psql


then maybe you still need to change the owner of the tables one by one, I only put you the example of geometry_columns, but also change the owner of spatial_ref, etc.

connect to aus and change owner:

\c aus
ALTER TABLE geometry_columns OWNER TO aus;
share|improve this answer
Indeed, I have messed up with user privileges. I first granted them, then created spatial_ref, geometry and geography tables. Thanks! – culebrón Dec 10 '11 at 11:57

You may need to edit /var/lib/pgsql/data/pg_hba.conf to add something like:

host all all md5

so other machines on your network (128.118.54.*) could log on to the database (and remember to restart postmaster).

I have some notes on setting up PostGis and adding OSM data to it at that might contain other helpful hints.

share|improve this answer
I don't need to access it from other machines on my network. The file is in /etc/postgresql/9.1/main/ btw. – culebrón Dec 9 '11 at 10:41
location depends on your distro - you may need to edit anyway as it uses loopback to access the DB. – iant Dec 9 '11 at 12:02 is enabled there – culebrón Dec 9 '11 at 17:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.