Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#5091 closed enhancement (fixed)

Allow PostGIS table overwrite updates via truncate

Reported by: mpfister Owned by: warmerdam
Priority: low Milestone: 1.11.0
Component: OGR_SF Version: unspecified
Severity: normal Keywords:
Cc:

Description

ogr2ogr updates a PostGIS table by first running a DROP CASCADE on the table, then recreating it. If there are views on the table, they are dropped by the CASCADE. Is it possible to update a table by instead running TRUNCATE on the table to empty it, then filling it with new records? I've tried combinations of the current options and don't think you can accomplish this result presently.

Change History (4)

comment:1 by Even Rouault, 11 years ago

You can try: 'ogrinfo pg:dbname=XXXX -sql "truncate table foo"' before running ogr2ogr -append

comment:2 by mpfister, 11 years ago

Yes, I truncate with psql already, though that's a handy trick to use ogrinfo.

comment:3 by Even Rouault, 11 years ago

Component: defaultOGR_SF
Milestone: 2.0
Resolution: fixed
Status: newclosed

trunk r26055 "PG: add a OGR_TRUNCATE configuration option that can be used as an alternative to the -overwrite flag of ogr2ogr, but that avoids DROP TABLE ... CASCADE which destroys views based on the tables (#5091)"

comment:4 by Even Rouault, 10 years ago

Milestone: 2.01.11.0
Note: See TracTickets for help on using tickets.