0

I am exporting tables from Postgresql 9.2 to shapefiles using postgis 2.0. I have the same system on other machines and it works correctly. I have tried running the command from a prompt and get an error about the table not existing, with a truncated version of the name.

"path_to_exe/pgsql2shp" -f "..\shapefiles\W06_Exporters_150814_141145_with_geom" -h localhost -u postgres -P
    postgres -p 5432 db_name "select * from analysis.\"W06_Exporters_150814_141145_with_geom\""
1
  • I was able to make it work by changing the table name to an SQL statement. Still not sure why it truncates my table name. Commented Aug 14, 2015 at 22:17

1 Answer 1

1

This doesn't explain or fix anything, but you could try using a temp table:

create table temp_for_export as select * from table1 where id < '20'

Then

pgsql2shp -f [path] -h [myhost] -p [port] -u [user] -P [password] [database] temp_for_export

and see what that does.

Is there any chance your host, user or database is incorrect on the pgsql2shp command line, so pgsql2shp is accessing a different "table1" than you're looking at in the shell?

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.