Skip to content

Title: Collector fails on long_running_transactions when oldest_timestamp_seconds is NULL #1223

@alex-ganin

Description

@alex-ganin

Description
The collector fails with the following error when there are no long-running transactions in the database:

collector failed: sql: Scan error on column index 1, name "oldest_timestamp_seconds": converting NULL to float64 is unsupported

Steps to Reproduce

Set up the collector on a PostgreSQL database.

Ensure the long_running_transactions metric is queried when there are no long-running transactions (the oldest_timestamp_seconds column is NULL).

Run the collector.

Expected Behavior
The collector should handle NULL values gracefully, e.g., by treating them as 0 or skipping the metric.

Actual Behavior
Collector crashes due to sql: Scan error when trying to assign NULL to float64.

Environment:
PostgreSQL version: 17.6
postgres-exporter:v0.18.1 (docker image)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions