Skip to content

Daemon crash when querying numeric Vecs other than <u8> over PG Wire #4012

@egormanga

Description

@egormanga

Setup (v1.11.2):

#[table(name=test)]
struct Test {
	a: Vec<u16>,  // i8 does it as well
}

#[reducer(init)]
fn init(ctx: &ReducerContext) {
	ctx.db.test().insert(Test {
		a: vec![1, 2],
	});
}

Reproduction (via psql):

SELECT * FROM test;

Result:

thread 'tokio-runtime-worker' panicked at pgwire-0.34.2/src/api/results.rs:257:36:
index out of bounds: the len is 6 but the index is 6
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic_bounds_check
   3: pgwire::api::results::DataRowEncoder::encode_field
   4: <spacetimedb_pg::encoder::PsqlFormatter as spacetimedb_sats::satn::TypedWriter>::write
   5: spacetimedb_sats::ser::impls::<impl spacetimedb_sats::ser::Serialize for spacetimedb_sats::ValueWithType<spacetimedb_sats::array_value::ArrayValue>>::serialize
   6: spacetimedb_sats::ser::impls::<impl spacetimedb_sats::ser::Serialize for spacetimedb_sats::ValueWithType<spacetimedb_sats::algebraic_value::AlgebraicValue>>::serialize
   7: spacetimedb_pg::pg_server::to_rows
   8: <spacetimedb_pg::pg_server::PgSpacetimeDB<T> as pgwire::api::query::SimpleQueryHandler>::do_query::{{closure}}
   9: pgwire::api::query::SimpleQueryHandler::_on_query::{{closure}}
  10: pgwire::api::query::SimpleQueryHandler::on_query::{{closure}}
  11: spacetimedb_pg::pg_server::start_pg::{{closure}}::{{closure}}

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