[postgis-users] More effective way instead of doping table?

Paul Ramsey pramsey at opengeo.org
Sat Nov 20 23:50:43 PST 2010


You can run commands from the shell using the -c parameter with psql. So

psql -c "delete from mytable" -d mydatabase
shp2pgsql ... etc ...

Or if you are less transactionally minded...

psql -c "truncate mytable" -d mydatabase
shp2pgsql ... etc ...

Paul

On Sat, Nov 20, 2010 at 11:47 PM, chris brisendine <ki4gyw at gmail.com> wrote:
> I'm looking for a more effective way to clear all records then add the
> new ones instead of dropping table .
> I am wanting to Truncate all records from the table then add the new shapefile.
> Currently im using this command
> shp2pgsql -d -s 4269 NWSWatch.shp watches geoserver| psql -d geoserver
> is there a way to do this? The reason is that my clients are sometimes
> updating when Im dropping the table and its throwing them
> into all types of errors. The field names will always be the same.
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



More information about the postgis-users mailing list