goalert icon indicating copy to clipboard operation
goalert copied to clipboard

GoAlert fails on Postgres 14 due to SQL scan error

Open mastercactapus opened this issue 1 year ago • 1 comments

Describe the Bug: Using GoAlert on Postgres 14 (or possibly newer versions) causes some queries to fail, with an error indicating a failure in SQL scan. Specifically, the error append alert log: lookup heartbeat monitor interval by ID: sql: Scan error on column index 0, name "?column?": converting driver.Value type string ("60.0000000000000000") to a int: invalid syntax is observed.

Steps to Reproduce:

  1. Setup a dev environment with Postgres 14 or newer database.
  2. Run make smoketest.

Expected Behavior: The make smoketest command should execute successfully with no errors.

Observed Behavior: The make smoketest command throws a SQL scan error on certain queries.

Application Version: This issue appears to affect all GoAlert versions.

Additional Context: The problem seems to be only occurring with Postgres 14 and newer versions. The application works fine with Postgres 13 which is the recommended version.

mastercactapus avatar Jul 19 '23 17:07 mastercactapus

A good way to start is to look for errors/failures with the smoke & integration tests and convert the problematic queries to use sqlc (what we're using for new work anyhow). The generated code/scanning methods seem to handle whatever discrepancy is causing this.

mastercactapus avatar Jul 19 '23 18:07 mastercactapus