Skip to content

uuid values strangeness #1008

@nofue

Description

@nofue

Introduction

To Reproduce

select 'debug' as component;
select * from share_context 
where share_id = $context::uuid

results in

[2025-09-07T10:45:08.788Z ERROR sqlpage::webserver::database::sql_to_json] Failed to decode alloc::string::String value: invalid utf-8 sequence of 1 bytes from index 0
[2025-09-07T10:45:08.789Z INFO actix_web::middleware::logger] 127.0.0.1 "GET /geosel.sql?context=b2101a60-d5a3-4aaa-ab75-5610b5dd1f33&start_edge=0.5 HTTP/1.1" 200 5498 "http://localhost:8080/geosel.sql?context=1ad6bcaa-4e28-4270-a1d5-2f4557d619b3&start_edge=0.5"

showing only
"share_id":"", …
in debug

Changing the query to

select 'debug' as component;
select share_id::text, prospect_id, campaign_id, assignment_id, created_at from share_context 
where share_id = $context::uuid

debug shows
"share_id":"b2101a60-d5a3-4aaa-ab75-5610b5dd1f33", …
as expected.

Expected behavior

casting ::uuid should be done automatically, as it is done with f.e. timezonez and other "special" types.

Version information

  • OS: macos 11.7.10
  • Database Postgres 15
  • SQLPage Version [0.36.1]:

Additional context

The real problem here is that comparisons also don't work.
select * from …
results in false for
where share_id = $context::uuid
causing all sort of odd effects. The url ?context=b2101a60-d5a3-4aaa-ab75-5610b5dd1f33 has always been there, but all where share_id = $context::uuid resulted in false until I explicitly listed the rows.

Took me a while to find the workaround (explicit row-list instead of convenient *) as this came very unexpected …

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions