I have a shapefile which if I convert to sql statements using shp2pgsql return table name all in lowercase, for e.g. 'liberia'.

When I read the same shapefile using ogr and use layer.GetName() it returns capitalized name e.g. 'Liberia'.

Is the mismatch because I am not looking at the right variables?

1 Answer 1


Shp2pgsql converts all table and field names to lower case because Postgres prefers lower case table and field names, you have to put field names in quotes when you write queries with field names that have upper or mixed case names.

If you want to keep these identifiers uppercase use the "-k" switch in shp2pgsql.



  • 1
    ogr2ogr also support setting output layer name via -nln key. Also you can provide some layer creation options via -lco parameter (supported values see here: gdal.org/drv_pg.html) Commented Feb 6, 2017 at 7:42

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.