[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    Re: [postgis-users] More effective way instead of doping table?
From:       Paul Ramsey <pramsey () opengeo ! org>
Date:       2010-11-21 7:50:43
Message-ID: AANLkTimnbQZ9Wgo0bWEJZNQUH1_yb8Km2h2+i-dprtrW () mail ! gmail ! com
[Download RAW message or body]

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@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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic