Skip to content

Commit

Permalink
only set srid if non-zero, better err msg in pg to pg
Browse files Browse the repository at this point in the history
  • Loading branch information
Amogh-Bharadwaj committed Mar 20, 2024
1 parent 30411d0 commit f4a52f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion flow/geo/geo.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ func GeoValidate(hexWkb string) (string, error) {
}

wkt := geometryObject.ToWKT()
wkt = fmt.Sprintf("SRID=%d;%s", geometryObject.SRID(), wkt)

if SRID := geometryObject.SRID(); SRID != 0 {
wkt = fmt.Sprintf("SRID=%d;%s", geometryObject.SRID(), wkt)
}
return wkt, nil
}

Expand Down
2 changes: 1 addition & 1 deletion flow/model/qrecord_batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func (src *QRecordBatchCopyFromSource) Values() ([]interface{}, error) {

wkb, err := geo.GeoToWKB(v)
if err != nil {
src.err = errors.New("failed to convert Geospatial value to wkb")
src.err = fmt.Errorf("failed to convert Geospatial value to wkb: %v", err)
return nil, src.err
}

Expand Down

0 comments on commit f4a52f6

Please sign in to comment.