fix: check H3Cell error and use proper string value in publicReportUpdateLocation #161
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-160-h3cell-bad-data"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes issue #160.
Two bugs in
publicReportUpdateLocation:Discarded error:
location.H3Cell()returned(cell, error)but the error was silently discarded with_. When invalid coordinates produced a zero-value cell (H3_NULL / Cell 0), the error was lost and the bad data was stored.Wrong value type: The
H3cellcolumn is apostgres.ColumnString, but the SET clause usedpostgres.Int(int64(*h3cell)). For valid cells this happened to work because PostgreSQL casts integer literals to h3index, but for cell 0 it stored0— an invalid h3index string that crashes on read viaH3Index.Scan().Fix: Check the H3Cell error and return it wrapped. Use
postgres.String(h3cell.String())to pass the proper hex string representation.