Skip to content

Database errors: sqlx query errors #176

@josecelano

Description

@josecelano

If you enable statements logging for sqlx you will see some errors when you run the app.
I've executed the queries manually, and they do not fail. In fact, you can see the query metrics: rows affected: 0, rows returned: 0, elapsed: 54.789µs.

Maybe it's a problem with the sqlx logging. I think we can try to reproduce the problem with a clean new project and open an issue on the sqlx repo if we can confirm that it is a false error.

Loading configuration from config file `./config.toml`
2023-06-08T11:19:36.794421843+01:00 [torrust_index_backend::bootstrap::logging][INFO] logging initialized.
2023-06-08T11:19:36.795209655+01:00 [sqlx::query][ERROR] PRAGMA foreign_keys = ON; …; rows affected: 0, rows returned: 0, elapsed: 26.999µs

PRAGMA foreign_keys = ON;

2023-06-08T11:19:36.796727567+01:00 [sqlx::query][ERROR] CREATE TABLE IF NOT …; rows affected: 0, rows returned: 0, elapsed: 190.138µs

CREATE TABLE IF NOT EXISTS _sqlx_migrations (
  version BIGINT PRIMARY KEY,
  description TEXT NOT NULL,
  installed_on TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  success BOOLEAN NOT NULL,
  checksum BLOB NOT NULL,
  execution_time BIGINT NOT NULL
);

2023-06-08T11:19:36.797165342+01:00 [sqlx::query][ERROR] SELECT version FROM _sqlx_migrations …; rows affected: 0, rows returned: 0, elapsed: 54.789µs

SELECT
  version
FROM
  _sqlx_migrations
WHERE
  success = false
ORDER BY
  version
LIMIT
  1

2023-06-08T11:19:36.797534508+01:00 [sqlx::query][ERROR] SELECT version, checksum FROM …; rows affected: 0, rows returned: 16, elapsed: 70.409µs

SELECT
  version,
  checksum
FROM
  _sqlx_migrations
ORDER BY
  version

2023-06-08T11:19:36.809949518+01:00 [actix_server::builder][INFO] starting 16 workers
2023-06-08T11:19:36.809966198+01:00 [torrust_index_backend::web::api::actix][INFO] Listening on http://0.0.0.0:33003
Listening on http://0.0.0.0:33003

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions