Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm following these instructions to setup osm2psql . I need it to import osm data file inside a PostGIS DB.

The following steps worked fine:

createdb -E UTF8 -O user mydb
createlang plpgsql mydb

I successfully added PostGIS extensions too:

psql mydb < postgis.sql
psql mydb < spatial_ref_sys.sql

I start getting problems when trying to alter table's owner:

psql -d mydb -c "ALTER TABLE geometry_columns OWNER TO user"
psql -d mydb -c "ALTER TABLE spatial_ref_sys OWNER TO user"

both above commands produce the following syntax error:

ERROR: syntax error at or near "user" LINE 1: ALTER TABLE geometry_columns OWNER TO user

I've also tried to add a semicolon at the end of the query, but I still get the same error:

psql -d mydb -c "ALTER TABLE geometry_columns OWNER TO user;"
psql -d mydb -c "ALTER TABLE spatial_ref_sys OWNER TO user;"

I'm not so confident with SQL nor with Postgres. Could anyone tell me where's my mistake?

share|improve this question
    
your user is actually called 'user'? –  tomfumb Nov 20 '12 at 21:47
    
@tomfumb: yer it is. –  Heisenbug Nov 21 '12 at 9:03
    
looks like @JaakL beat me to it, damn time zones! postgresql.org/docs/9.1/static/sql-keywords-appendix.html –  tomfumb Nov 21 '12 at 15:08

1 Answer 1

up vote 3 down vote accepted

Maybe user is reserved keyword. You may try to put username value to semicolons. Something like:

psql -d mydb -c "ALTER TABLE geometry_columns OWNER TO \"user\";"
share|improve this answer
    
great! it works! thank you so much –  Heisenbug Nov 21 '12 at 9:43

Your Answer

 
discard

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.