I require a shapefile's .dbf to contain two types of text columns VARCHAR(n) and CHAR(n) to meet specs (attribute format) of gov receiving body. Have to send them the .shp, .dbf and .prj. Within arcmap or qgis add field only allows text and length for new fields. In postgres i can create the required format for example filed blah data type is character (10) and field blah2 data type is character varying(80), however if i export this as .dbf and then reimport it (to check data types are maintained) using the postgis plugin it changes the character(10) to character varying (10). Does anyone know a way to create a .dbf and export it maintaining set data types, i.e character (10) and character varying (80) for example.



The documentation is really spotty, but dbf only has one character type. Since there's no way to tell the difference between a fixed and variable length character field, Postgres treats it as character varying.

Since it's impossible to create a fixed length character field in dbf, a length of 10 should be fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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