From ef77711c6086b405fd48c1b74607e997edfbe548 Mon Sep 17 00:00:00 2001 From: Oliver Tonnhofer Date: Tue, 11 Jun 2013 14:43:14 +0200 Subject: [PATCH] truncate table at begin --- database/postgis/postgis.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/database/postgis/postgis.go b/database/postgis/postgis.go index 99c57ce..a208d28 100644 --- a/database/postgis/postgis.go +++ b/database/postgis/postgis.go @@ -410,6 +410,10 @@ func (tt *TableTx) Begin() error { return err } tt.Tx = tx + _, err = tx.Exec(fmt.Sprintf(`TRUNCATE TABLE "%s"."%s" RESTART IDENTITY`, tt.Pg.Schema, tt.Table)) + if err != nil { + return err + } tt.Sql = tt.Spec.InsertSQL() stmt, err := tt.Tx.Prepare(tt.Sql) if err != nil {