Skip to content

PostgreSQL money values are not displayed when a query contains variables #983

Open

Description

@rhysparry

Introduction

After upgrading to SQLPage 0.36.0, money values from PostgreSQL now all show 0.0 as the value. This worked in version 0.35.0.

To Reproduce

With a PostgreSQL database configured, use the following SQL query:

select 'big_number' as component;

select 1.23::money as value,
       'Value' as title,
       'Money value' as description
;

Actual behavior

Value shows as 0.0

The following error is shown in the logs:

sqlpage::webserver::database::sql_to_json] Failed to decode f64 value: invalid float literal

Screenshots

Actual (0.36.0):

Actual: 0.0

Expected (from 0.35.1):

Expected: $1.23

Expected behavior

The value will be displayed correctly with the currency symbol (as per version 0.35.1)

Version information

  • OS: macOS
  • Database PostgreSQL
  • SQLPage Version: 0.36.0

Activity

  1. added
    bug
    on Aug 2, 2025
  2. lovasoa commented on Aug 3, 2025

    @lovasoa
    Collaborator

    Hi! Thanks for the quick report. This will be fixed in v0.36.1

  3. lovasoa commented on Aug 3, 2025

    @lovasoa
    Collaborator

    Hi @rhysparry !

    Looking at this in a little more details, the issue is similar to #721 (comment)

    Postgres returns

    • textual money representations for static queries (so we can display "$1.23"),
    • and binary values for parametrized queries (so it transmits only the number 123, without the decimal point and the currency)

    so the previous behavior will be reintroduced, making your dashboard work again as long as you keep all your queries fully static. But I'd still recommend manually casting to text on the database side to ensure consistent results, even if you later introduce parameters to your queries:

    select my_money_column::text as value,
           'Value' as title,
           'Money value' as description
    ;

    I'll keep this issue opened.

  4. lovasoa commented on Aug 3, 2025

    @lovasoa
    Collaborator

    Reopening with a new title to reflect how the bug occurs even in 0.36.1 when queries contain parameters

  5. reopened this on Aug 3, 2025
  6. changed the title [-]PostgreSQL money values show as 0.0[/-] [+]PostgreSQL money values are not displayed when a query contains variables[/+] on Aug 3, 2025
  7. added a commit that references this issue on Aug 3, 2025
  8. 81reap commented on Oct 29, 2026

    @81reap
    Collaborator

    I think this is still an issue

    Reproduction

    $ cat tests/end-to-end/fixtures/repro_983/index.sql 
    SELECT 'big_number' AS component;
    SELECT 1.23::money AS value, 'Static' AS title;
    SELECT 1.23::money AS value, 'With a variable' AS title, $unused AS description;
    
    $ cat tests/end-to-end/fixtures/repro_983/test.ts
    import { expect, test } from "../../fixture.ts";
    
    test("money values show with and without a variable in the query", async ({ page }) => {
      await expect(page.locator(".card")).toHaveCount(2);
      await expect(page.locator(".card").nth(0)).toContainText("$1.23");
      await expect(page.locator(".card").nth(1)).toContainText("$1.23");
    });
    repro_983 postgres
    v0.33.0 ✘ failed
    v0.47.0 ✘ failed
    tree ✘ failed

    On commit 616df27: nix run .#reproduce -- repro_983 postgres v0.33.0 v0.47.0 tree

  9. 81reap commented on Oct 29, 2026

    @81reap
    Collaborator

    This is actually an intentional design by upstream maintainers transact-rs/sqlx#1206

    but given #1056 it may be better to migrate back onto sqlx first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    blocked :: upstreambug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions