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 <ki4...@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@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to