edgedb / edgedb-cli

The EdgeDB CLI
https://www.edgedb.com/docs/cli/index
Apache License 2.0
167 stars 23 forks source link

A query causes REPL issues. #273

Closed vpetrovykh closed 3 years ago

vpetrovykh commented 3 years ago

Steps to Reproduce:

  1. Setup a test type (important, because using built-in Object runs into a different bug)
    CREATE TYPE Foo;
    INSERT Foo;
  2. As a base-line run this from the command line:
    $ edgedb -c 'SELECT min([Foo])'
    ["7de7b35c-8842-11eb-bec5-0ba713a41bf4"]
  3. Compare to the same query from the REPL:
    edgedb> SELECT min([Foo]);
    StreamErr {
        source: DecodeErr {
            source: ObjectSizeMismatch {
                backtrace: Backtrace(
                       0:     0x555ef48d53bd - backtrace::backtrace::libunwind::trace::ha93f4de6d8003fb2
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.56/src/backtrace/libunwind.rs:90:5
                                               backtrace::backtrace::trace_unsynchronized::he60c629f3b1107a1
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.56/src/backtrace/mod.rs:66:5
                       1:     0x555ef48d533e - backtrace::backtrace::trace::h9cd0a55c37e1cdec
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.56/src/backtrace/mod.rs:53:14
                       2:     0x555ef49197cd - backtrace::capture::Backtrace::create::h6060f5deca8633c0
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.56/src/capture.rs:176:9
                       3:     0x555ef491970d - backtrace::capture::Backtrace::new::h31cf389ab06240d9
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.56/src/capture.rs:140:22
                       4:     0x555ef489334e - <snafu::backtrace_shim::Backtrace as snafu::GenerateBacktrace>::generate::h7cd8a36172a42adf
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/snafu-0.6.10/src/backtrace_shim.rs:15:19
                                               edgedb_protocol::errors::ObjectSizeMismatch::build::hd27b9496df864dfe
                                                   at /home/victor/.cargo/git/checkouts/edgedb-rust-8bc8936b1acdc166/f0b2013/edgedb-protocol/src/errors.rs:10:10
                       5:     0x555ef48933ce - edgedb_protocol::errors::ObjectSizeMismatch::fail::h6a140886a1d50554
                                                   at /home/victor/.cargo/git/checkouts/edgedb-rust-8bc8936b1acdc166/f0b2013/edgedb-protocol/src/errors.rs:10:10
                       6:     0x555ef48830e2 - edgedb_protocol::serialization::decode::raw_composite::DecodeTupleLike::new_object::hde6d6cbbb6c5bbe4
                                                   at /home/victor/.cargo/git/checkouts/edgedb-rust-8bc8936b1acdc166/f0b2013/edgedb-protocol/src/serialization/decode/raw_composite.rs:18:9
                       7:     0x555ef48680f1 - <edgedb_protocol::codec::Object as edgedb_protocol::codec::Codec>::decode::hc8398b538789d86b
                                                   at /home/victor/.cargo/git/checkouts/edgedb-rust-8bc8936b1acdc166/f0b2013/edgedb-protocol/src/codec.rs:475:28
                       8:     0x555ef4867f5a - edgedb_protocol::codec::decode_array_like::{{closure}}::h4e341e4b6133e1dd
                                                   at /home/victor/.cargo/git/checkouts/edgedb-rust-8bc8936b1acdc166/f0b2013/edgedb-protocol/src/codec.rs:469:24
                       9:     0x555ef4833926 - core::iter::adapters::map_try_fold::{{closure}}::h1bfe99db68d04e84
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/iter/adapters/mod.rs:832:28
                      10:     0x555ef487b795 - core::iter::traits::iterator::Iterator::try_fold::h4fbbfcdc5fa97aa3
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/iter/traits/iterator.rs:1871:21
                      11:     0x555ef4837575 - <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold::h265cc1f505f5200a
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/iter/adapters/mod.rs:858:9
                      12:     0x555ef482d06e - <core::iter::adapters::ResultShunt<I,E> as core::iter::traits::iterator::Iterator>::try_fold::h17a136a4e40e9ae9
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/iter/adapters/mod.rs:2639:9
                      13:     0x555ef48321f0 - core::iter::traits::iterator::Iterator::find::h177597c5ee9b4b55
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/iter/traits/iterator.rs:2212:9
                      14:     0x555ef482cea6 - <core::iter::adapters::ResultShunt<I,E> as core::iter::traits::iterator::Iterator>::next::h9e21ae1bd95f7159
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/iter/adapters/mod.rs:2621:9
                      15:     0x555ef4875862 - <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter::h83347ee109e20788
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/alloc/src/vec.rs:2118:32
                      16:     0x555ef4876839 - <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter::hedc45cd806813e44
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/alloc/src/vec.rs:2020:9
                      17:     0x555ef4832bfb - core::iter::traits::iterator::Iterator::collect::h5dd5f1dc4e5006a3
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/iter/traits/iterator.rs:1653:9
                      18:     0x555ef483be71 - <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter::{{closure}}::h41cebed68a38cdd1
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/result.rs:1490:53
                      19:     0x555ef4834600 - core::iter::adapters::process_results::hb91349d7637d5113
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/iter/adapters/mod.rs:2610:17
                      20:     0x555ef483bc56 - <core::result::Result<V,E> as core::iter::traits::collect::FromIterator<core::result::Result<A,E>>>::from_iter::h7243f60ee3f8ada5
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/result.rs:1490:9
                      21:     0x555ef4832d49 - core::iter::traits::iterator::Iterator::collect::hced9a62a23d026d3
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/iter/traits/iterator.rs:1653:9
                      22:     0x555ef4867e87 - edgedb_protocol::codec::decode_array_like::h808495edd59f5537
                                                   at /home/victor/.cargo/git/checkouts/edgedb-rust-8bc8936b1acdc166/f0b2013/edgedb-protocol/src/codec.rs:468:5
                      23:     0x555ef486ea54 - <edgedb_protocol::codec::Array as edgedb_protocol::codec::Codec>::decode::h5095826ba3c8a630
                                                   at /home/victor/.cargo/git/checkouts/edgedb-rust-8bc8936b1acdc166/f0b2013/edgedb-protocol/src/codec.rs:863:21
                      24:     0x555ef47a8b71 - <alloc::sync::Arc<dyn edgedb_protocol::codec::Codec> as edgedb_client::reader::Decode>::decode::h600b061655b82970
                                                   at /home/victor/.cargo/git/checkouts/edgedb-rust-8bc8936b1acdc166/f0b2013/edgedb-client/src/reader.rs:99:9
                      25:     0x555ef3b3c164 - <edgedb_client::reader::QueryResponse<D> as futures_core::stream::Stream>::poll_next::h8ca0220357f5e64f
                                                   at /home/victor/.cargo/git/checkouts/edgedb-rust-8bc8936b1acdc166/f0b2013/edgedb-client/src/reader.rs:257:26
                      26:     0x555ef3f11667 - <async_std::stream::stream::next::NextFuture<T> as core::future::future::Future>::poll::hcef970ed53631e79
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/stream/stream/next.rs:17:9
                      27:     0x555ef3c4fd39 - edgedb::print::format_rows_buf::{{closure}}::h496b2cd09ef1dfd6
                                                   at /home/victor/.cargo/git/checkouts/edgedb-cli-6a9c62fe43dd9873/49b786f/src/print/mod.rs:121:25
                      28:     0x555ef417a212 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hfcf0427da3895c75
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/future/mod.rs:79:19
                      29:     0x555ef3c53704 - edgedb::print::_native_format::{{closure}}::h20682953ffc41d33
                                                   at /home/victor/.cargo/git/checkouts/edgedb-cli-6a9c62fe43dd9873/49b786f/src/print/mod.rs:227:11
                      30:     0x555ef4179fd2 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hf9e649e1aa6fccfa
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/future/mod.rs:79:19
                      31:     0x555ef3c52f9d - edgedb::print::native_to_stdout::{{closure}}::h6cff020e57c05cb7
                                                   at /home/victor/.cargo/git/checkouts/edgedb-cli-6a9c62fe43dd9873/49b786f/src/print/mod.rs:194:5
                      32:     0x555ef4168322 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h37455d984ad93d40
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/future/mod.rs:79:19
                      33:     0x555ef3c8970a - edgedb::interactive::execute_query::{{closure}}::hffdfcac29ac34654
                                                   at /home/victor/.cargo/git/checkouts/edgedb-cli-6a9c62fe43dd9873/49b786f/src/interactive.rs:414:19
                      34:     0x555ef417392b - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hb19d961eadfa54f8
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/future/mod.rs:79:19
                      35:     0x555ef3dbce37 - <async_std::future::maybe_done::MaybeDone<Fut> as core::future::future::Future>::poll::h5c1c18475362d972
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/future/maybe_done.rs:71:48
                      36:     0x555ef3fa0412 - <core::pin::Pin<P> as core::future::future::Future>::poll::h14aec20aabeac416
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/future/future.rs:121:9
                      37:     0x555ef3f1bfbe - <async_std::future::future::race::Race<L,R> as core::future::future::Future>::poll::h7693f465ab0a6cf2
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/future/future/race.rs:46:12
                      38:     0x555ef3c90c2a - edgedb::interactive::_interactive_main::{{closure}}::haa5bfdb0e9647544
                                                   at /home/victor/.cargo/git/checkouts/edgedb-cli-6a9c62fe43dd9873/49b786f/src/interactive.rs:544:21
                      39:     0x555ef41789db - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hee6aca72d62ce9be
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/future/mod.rs:79:19
                      40:     0x555ef3c821f4 - edgedb::interactive::_main::{{closure}}::h29ffb285ee892b0c
                                                   at /home/victor/.cargo/git/checkouts/edgedb-cli-6a9c62fe43dd9873/49b786f/src/interactive.rs:128:11
                      41:     0x555ef41690db - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h433c7e3ad35b72d0
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/future/mod.rs:79:19
                      42:     0x555ef3ef4529 - <async_std::task::builder::SupportTaskLocals<F> as core::future::future::Future>::poll::{{closure}}::h3f7616ec3f6a7eef
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/builder.rs:199:17
                      43:     0x555ef3d61de6 - async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current::{{closure}}::h02bbdfc03ea86f0c
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/task_locals_wrapper.rs:60:13
                      44:     0x555ef3b0a140 - std::thread::local::LocalKey<T>::try_with::hab6712e3a5db426d
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/thread/local.rs:265:16
                      45:     0x555ef3af245d - std::thread::local::LocalKey<T>::with::h46238c7a8f425383
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/thread/local.rs:241:9
                      46:     0x555ef3d610a8 - async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current::h814f54e489f294b5
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/task_locals_wrapper.rs:55:9
                      47:     0x555ef3ef3598 - <async_std::task::builder::SupportTaskLocals<F> as core::future::future::Future>::poll::h80860cc822faeda1
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.9.0/src/task/builder.rs:197:13
                      48:     0x555ef407af4e - async_executor::Executor::spawn::{{closure}}::h7411e2c2752a7205
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/async-executor-1.4.0/src/lib.rs:138:13
                      49:     0x555ef4173efb - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hb6ce9b37cacdd64e
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/future/mod.rs:79:19
                      50:     0x555ef3fa1052 - <core::pin::Pin<P> as core::future::future::Future>::poll::h81ddfd7f5b1549eb
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/future/future.rs:121:9
                      51:     0x555ef41065e3 - async_task::raw::RawTask<F,T,S>::run::hdf2d5ecea5ee2789
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/async-task-4.0.3/src/raw.rs:489:20
                      52:     0x555ef4d24846 - async_task::runnable::Runnable::run::h59360cf422c28db1
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/async-task-4.0.3/src/runnable.rs:309:18
                      53:     0x555ef4cdc712 - async_executor::Executor::run::{{closure}}::{{closure}}::h13fea102c2a2f8cb
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/async-executor-1.4.0/src/lib.rs:229:21
                      54:     0x555ef4ce27db - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h6b95db286e7cabac
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/future/mod.rs:79:19
                      55:     0x555ef4cd913d - <futures_lite::future::Or<F1,F2> as core::future::future::Future>::poll::had752dfdf9d40f3a
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-lite-1.11.3/src/future.rs:529:33
                      56:     0x555ef4cdc2f4 - async_executor::Executor::run::{{closure}}::h74924806323d36a1
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/async-executor-1.4.0/src/lib.rs:236:9
                      57:     0x555ef4ce274b - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h66d089b77d7bde60
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/future/mod.rs:79:19
                      58:     0x555ef4cd91ed - <futures_lite::future::Or<F1,F2> as core::future::future::Future>::poll::hb4fec7672d65a551
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-lite-1.11.3/src/future.rs:529:33
                      59:     0x555ef4ceefac - async_io::driver::block_on::hf1976d47cab4ce6b
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/async-io-1.3.1/src/driver.rs:142:33
                      60:     0x555ef4cd0234 - async_global_executor::reactor::block_on::{{closure}}::hb58c5967468c9c9c
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/reactor.rs:3:18
                      61:     0x555ef4cd0020 - async_global_executor::reactor::block_on::h1d4d03ca7af40b63
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/reactor.rs:12:5
                      62:     0x555ef4cdfb70 - async_global_executor::threading::thread_main_loop::{{closure}}::{{closure}}::hbe7a8c6c6642345c
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/threading.rs:95:17
                      63:     0x555ef4ccd52d - std::thread::local::LocalKey<T>::try_with::h0c296204258a67a9
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/thread/local.rs:265:16
                      64:     0x555ef4ccd434 - std::thread::local::LocalKey<T>::with::hf8be6534035f7bd8
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/thread/local.rs:241:9
                      65:     0x555ef4cdfbe3 - async_global_executor::threading::thread_main_loop::{{closure}}::h2080b723b69f38d5
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/threading.rs:89:13
                      66:     0x555ef4cd204b - std::panicking::try::do_call::he8e6f7070185c91f
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/panicking.rs:373:40
                      67:     0x555ef4cd4e4d - __rust_try
                      68:     0x555ef4cd1f57 - std::panicking::try::hd2c52baca7efa298
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/panicking.rs:337:19
                      69:     0x555ef4cdd48f - std::panic::catch_unwind::h9063b8c17a88c18b
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/panic.rs:379:14
                      70:     0x555ef4cdf5ed - async_global_executor::threading::thread_main_loop::h10d1fd911b6bc129
                                                   at /home/victor/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/threading.rs:88:12
                      71:     0x555ef4cd586a - core::ops::function::FnOnce::call_once::h8666a69de828ef4c
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/ops/function.rs:227:5
                      72:     0x555ef4cd1cfa - std::sys_common::backtrace::__rust_begin_short_backtrace::hd67a7c1df43f8afa
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/sys_common/backtrace.rs:137:18
                      73:     0x555ef4ce4037 - std::thread::Builder::spawn_unchecked::{{closure}}::{{closure}}::he56261dfbad0cc00
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/thread/mod.rs:458:17
                      74:     0x555ef4cdd1fa - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h4177a608ef5d79d5
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/panic.rs:308:9
                      75:     0x555ef4cd1fdf - std::panicking::try::do_call::h04b9879c21724271
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/panicking.rs:373:40
                      76:     0x555ef4cd4e4d - __rust_try
                      77:     0x555ef4cd1e14 - std::panicking::try::h2abbb3eb09e8b524
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/panicking.rs:337:19
                      78:     0x555ef4cdd45a - std::panic::catch_unwind::h07353527088e2e2f
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/panic.rs:379:14
                      79:     0x555ef4ce3e7c - std::thread::Builder::spawn_unchecked::{{closure}}::hd42d0b360af3c730
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/thread/mod.rs:457:30
                      80:     0x555ef4cd5739 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hdbd590bb163bfdaa
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/ops/function.rs:227:5
                      81:     0x555ef4dcb53a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h670c50864ac2cb92
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/alloc/src/boxed.rs:1042:9
                                               <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h2511952749086d81
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/alloc/src/boxed.rs:1042:9
                                               std::sys::unix::thread::Thread::new::thread_start::h5ad4ddffe24373a8
                                                   at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/sys/unix/thread.rs:87:17
                      82:     0x7f42c8a21f5e - start_thread
                      83:     0x7f42c893d2bf - __clone
                      84:                0x0 - <unknown>
                    ,
                ),
            },
        },
    }
    Reconnecting...

I don't know how to trigger this bug without min or max, but soon we will likely forbid passing objects (or object arrays) to either one of these. However, there might be other ways to trigger this that I just haven't come across yet.

tailhook commented 3 years ago

Well, this is another undocumented edge case of postgres encoding (similar to edgedb/edgedb#2266)

Here is what we get. Descriptors:

Output Descr [
    BaseScalar(
        BaseScalarTypeDescriptor {
            id: 00000000-0000-0000-0000-000000000101,
        },
    ),
    BaseScalar(
        BaseScalarTypeDescriptor {
            id: 00000000-0000-0000-0000-000000000100,
        },
    ),
    ObjectShape(
        ObjectShapeDescriptor {
            id: efe95c60-52b0-b0c8-aedc-5b62246a66f1,
            elements: [
                ShapeElement {
                    flag_implicit: true,
                    flag_link_property: false,
                    flag_link: false,
                    name: "__tname__",
                    type_pos: TypePos(
                        0,
                    ),
                },
                ShapeElement {
                    flag_implicit: true,
                    flag_link_property: false,
                    flag_link: false,
                    name: "id",
                    type_pos: TypePos(
                        1,
                    ),
                },
            ],
        },
    ),
    Array(
        ArrayTypeDescriptor {
            id: 2c62c8e7-92af-4d96-6bf5-1ee710d1e0ac,
            type_pos: TypePos(
                2,
            ),
            dimensions: [
                None,
            ],
        },
    ),
]

Data:

        // TODO(tailhook) test with non-zero reserved bytes
        b"\0\0\0\x01" // number of dimensions
        b"\0\0\0\0\0\0\x0b\x86" // 2 reserved words
        b"\0\0\0\x01" // size
        b"\0\0\0\x01" // lower index

        b"\0\0\0\x10" // array element size

        b"\x81g\xb4\xb8" // number of elements in the object !?!?!?
        b"\x8e.\x11\xeb\x9c\xb4\x8b~\x81$\x18\r"

This is also reproduced in python:

RuntimeError: cannot decode Object: expected 1 elements, got 2171057336

And JavaScript:

Error: cannot decode Object: expected 1 elements, got 2171057336
tailhook commented 3 years ago

Well this seems to be fixed on the new versions of edgedb. Perhaps by edgedb/edgedb#2384.