1

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?

3

1 Answer 1

3

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\";"
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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