SpacetimeDB
SpacetimeDB copied to clipboard
CLI panics on UPDATE ... SET query
The SQL runner panics when updating a row. The update does go through:
🪐spacetime-server>select * from config
id | messageOfTheDay | keyCodes | tickRate | playerAcceleration
----+-----------------+----------------------+----------+--------------------
0 | "Hello, world!" | ["W", "A", "S", "D"] | 20 | 25
(1 row)
Time: 2.79ms
🪐spacetime-server>update config set playerAcceleration = 15 where id = 0
thread 'main' panicked at /home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tabled-0.14.0/src/grid/records/records_mut.rs:25:18:
index out of bounds: the len is 0 but the index is 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
$ spacetime sql my-module --interactive
🪐spacetime-server>select * from config
id | messageOfTheDay | keyCodes | tickRate | playerAcceleration
----+-----------------+----------------------+----------+--------------------
0 | "Hello, world!" | ["W", "A", "S", "D"] | 20 | 15
(1 row)
Time: 3.04ms
Table definition and initialization:
[Table(Name = "config", Public = true)]
public partial struct Config
{
[PrimaryKey]
public uint id;
public string messageOfTheDay;
public List<string> keyCodes;
public uint tickRate;
public float playerAcceleration;
}
[Reducer(ReducerKind.Init)]
public static void Init(ReducerContext ctx)
{
ctx.Db.config.Insert(new Config
{
messageOfTheDay = "Hello, world!",
keyCodes = new List<string>() { "W", "A", "S", "D" },
tickRate = tickRate,
playerAcceleration = 5.0f
});
}
Thanks for reporting! This should be fixed by https://github.com/clockworklabs/SpacetimeDB/pull/2359