[postgis-users] Changing transaction behaviour in shp2pgsql - summary
Ben Madin
lists at remoteinformation.com.au
Sun Mar 14 16:51:00 PDT 2010
Thanks all for the feedback - to summarise :
shp2pgsql - Currently, all output is 'chunked' transactions - changing this behaviour not currently supported.
- A patch could be provided to shp2pgsql to do this.
- The suggestion is a -T switch with options such as single, chunked, no transactions.
- I'm happy to look at submitting a patch... but it won't be until after I've submitted my thesis ...
The text editor approach is to direct output into a file and find / replace the BEGIN / COMMIT lines.
The on-the-fly alternative is to use a pattern matching program, with two solutions offered :
Using sed (thanks Brent)
shp2pgsql -s 28350 -W UTF8 \
/Users/owner/Spatial/country/AUS/WA/MRWA/mrwa_network.shp \
gis.mrwa_gda94 | sed 's/BEGIN//' | sed 's/COMMIT//' psql australia
Using grep (thanks Steve)
shp2pgsql ... | grep -v BEGIN | grep -v COMMIT | psql australia
cheers
Ben
On 15/03/2010, at 4:35 , strk wrote:
> On Sun, Mar 14, 2010 at 04:58:02PM +0700, Ben Madin wrote:
>
>> in the event I can't work out the encoding, is there any way to turn off the transaction behaviour, ie I'm happy to miss 4 records, but not 1000 as a result of the transactions being aborted. (short of putting it all into a text file and removing all the begin and commit commands...)
>
> Feel like working on a patch to make "transaction policy" selectable
> with a switch ?
>
> -T <policy> transaction policy (single*,none)
>
> Current policy is chunked, dunno for what rationale..
>
> --strk;
>
> () Free GIS & Flash consultant/developer
> /\ http://strk.keybit.net/services.html
> _______________________________________________
> 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