The PostGIS command, shp2pgsql, allows the user to import a shapefile in the PostGIS database. Basically, it generates a PostgreSQL dump file that can be used to load data by running it from within PostgreSQL.
The SQL file will be generally composed of the following sections:
- The CREATE TABLE section (if the -a option is not selected, in which case, the table should already exist in the database)
- The INSERT INTO section (one INSERT statement for each feature to be imported from the shapefile)
- The CREATE INDEX section (if the -I option is selected)