Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Only set has nulls flag if we actually have nulls #331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

sfackler
Copy link
Owner

This is necessary to support arrays of non-null values on Postgres 8.1
and older.

Closes #330

This is necessary to support arrays of non-null values on Postgres 8.1
and older.

Closes #330
@sfackler
Copy link
Owner Author

@glennpierce Can you see if this makes things work with Redshift?

@glennpierce
Copy link

Hi

It gives a different error using that branch.

thread 'tests::get_consolidated_data_for_sensor_ids2' panicked at 'called Result::unwrap() on an Err value: PostgresError { error: "Assert" }', /checkout/src/libcore/result.rs:916:5

backtrace was

stack backtrace:
   0:     0x7f776391e5db - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::hb18bafd8df1a59a5
                               at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1:     0x7f7763925c7e - std::sys_common::backtrace::print::he2db06f5f327c580
                               at /checkout/src/libstd/sys_common/backtrace.rs:68
                               at /checkout/src/libstd/sys_common/backtrace.rs:57
   2:     0x7f7763918e50 - std::panicking::default_hook::{{closure}}::hef814c3eb720780d
                               at /checkout/src/libstd/panicking.rs:381
   3:     0x7f776391898c - std::panicking::default_hook::hf0d3601b84335f7c
                               at /checkout/src/libstd/panicking.rs:397
   4:     0x7f776391929b - std::panicking::rust_panic_with_hook::hf9f34d7f0d667943
                               at /checkout/src/libstd/panicking.rs:577
   5:     0x7f77639190ee - std::panicking::begin_panic::h215af23ff6354aaf
                               at /checkout/src/libstd/panicking.rs:538
   6:     0x7f776391905a - std::panicking::begin_panic_fmt::h752224a2c436be23
                               at /checkout/src/libstd/panicking.rs:522
   7:     0x7f7763918ff2 - rust_begin_unwind
                               at /checkout/src/libstd/panicking.rs:498
   8:     0x7f7763970510 - core::panicking::panic_fmt::h68e7715928be641f
                               at /checkout/src/libcore/panicking.rs:71
   9:     0x7f776388fec8 - core::result::unwrap_failed::hba162e514b1a50b2
  10:     0x7f77638a7578 - libbmos::tests::get_consolidated_data_for_sensor_ids2::h6e6ea9099ae3affd
  11:     0x7f77638a9661 - <F as alloc::boxed::FnBox<A>>::call_box::h9e5aacf2cfbec32f
                               at /checkout/src/libtest/lib.rs:1449
                               at /checkout/src/libcore/ops/function.rs:223
                               at /checkout/src/liballoc/boxed.rs:815
  12:     0x7f7763933e8e - __rust_maybe_catch_panic
                               at /checkout/src/libpanic_unwind/lib.rs:101
  13:     0x7f77638b4e62 - std::sys_common::backtrace::__rust_begin_short_backtrace::h6ea449afa5ecc4f7
                               at /checkout/src/libstd/panicking.rs:459
                               at /checkout/src/libstd/panic.rs:365
                               at /checkout/src/libtest/lib.rs:1400
                               at /checkout/src/libstd/sys_common/backtrace.rs:133
  14:     0x7f77638c0dd2 - std::panicking::try::do_call::hfa0b0672df703a07
                               at /checkout/src/libstd/thread/mod.rs:406
                               at /checkout/src/libstd/panic.rs:300
                               at /checkout/src/libstd/panicking.rs:480
  15:     0x7f7763933e8e - __rust_maybe_catch_panic
                               at /checkout/src/libpanic_unwind/lib.rs:101
  16:     0x7f77638bee5d - <F as alloc::boxed::FnBox<A>>::call_box::hb2bfcb2a0f4a5513
                               at /checkout/src/libstd/panicking.rs:459
                               at /checkout/src/libstd/panic.rs:365
                               at /checkout/src/libstd/thread/mod.rs:405
                               at /checkout/src/liballoc/boxed.rs:815
  17:     0x7f7763922957 - std::sys_common::thread::start_thread::h97260957c81cf142
                               at /checkout/src/liballoc/boxed.rs:825
                               at /checkout/src/libstd/sys_common/thread.rs:24
  18:     0x7f7763919898 - std::sys::unix::thread::Thread::new::thread_start::h3838be2df5be642c
                               at /checkout/src/libstd/sys/unix/thread.rs:90
  19:     0x7f7763030e24 - start_thread
  20:     0x7f7762b4834c - __clone
  21:                0x0 - <unknown>

@sfackler
Copy link
Owner Author

Is PostgresError { error: "Assert" } a custom error type? Where is "Assert" coming from?

@glennpierce
Copy link

glennpierce commented Mar 15, 2018

I get it from the error returned from conn.query

let results : postgres::Result<Rows> = conn.query(&sql, &[&start_timestamp, &end_timestamp, &sensor_ids]);
      
 if results.is_err() {
        println!("{:?}", results);
        let message = results.err().unwrap().cause().unwrap().description().to_string();
         return Err(BmosError::PostgresError{error: message});
 }

Here I printed the debug of results and it gives

Err(Error(Db(DbError { severity: "ERROR", parsed_severity: None, code: SqlState("XX000"), message: "Assert", detail: Some("\n -----------------------------------------------\n error: Assert\n code: 1000\n context: IsA((Node*)arrayExpr->args->tail->data.ptr_value, Const) - \n query: 14434\n location: xen_execute.cpp:6178\n process: padbmaster [pid=8196]\n -----------------------------------------------\n"), hint: None, position: None, where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("/home/ec2-user/padb/src/sys/xen_execute.cpp"), line: Some(7073), routine: Some("pg_throw") })))

The sql was


SELECT ts::timestamptz, s1.sensor_id, s1.value
                                  FROM sensor_values s1
                                   WHERE s1.ts::timestamptz >= $1::timestamptz AND
                                         s1.ts::timestamptz < $2::timestamptz
                                         AND s1.sensor_id = ANY($3)

@sfackler
Copy link
Owner Author

That's an internal error inside of Redshift. There's nothing I can do about that unfortunately. You could file a bug on Redshift if you have a support contract with them maybe?

@glennpierce
Copy link

I will look into it. Thanks for the help

@sfackler sfackler closed this Apr 6, 2018
@sfackler sfackler deleted the 8_1-array branch December 30, 2020 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants