SpacetimeDB icon indicating copy to clipboard operation
SpacetimeDB copied to clipboard

The literal expression `Value` cannot be parsed as type `(some: String | none: ())`

Open ReLLoMine opened this issue 8 months ago • 0 comments

I have a table:

    [Table(Name = "User", Public = true)]
    public partial class User
    {
        [PrimaryKey]
        public Identity Identity;
        public string? Name;
        public string? AvatarB64;
        public bool Online;
    }

And when I call

$ spacetime sql test "select * from User WHERE Name = 'Value'"

I get

WARNING: This command is UNSTABLE and subject to breaking changes.

Error: The literal expression `Value` cannot be parsed as type `(some: String | none: ())`

Caused by:
    HTTP status client error (400 Bad Request) for url (http://127.0.0.1:3000/v1/database/aabbccdd)

From logs

WARN /usr/src/app/crates/client-api/src/lib.rs:100: The literal expression `Value` cannot be parsed as type `(some: String | none: ())`

And apparently it works fine if the string parameter of class is not nullable Like

    [Table(Name = "Vault", Public = true)]
    public partial class Vault
    {
        [PrimaryKey]
        [Unique]
        public string Name;
    }
$ spacetime sql test "select * from Vault where Name='test_vault'"
WARNING: This command is UNSTABLE and subject to breaking changes.

 Name         
--------------
 "test_vault" 

It looks like a bug to me but idk How to resolve this problem?

ReLLoMine avatar May 03 '25 22:05 ReLLoMine