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

Recent commit adding operator support to date causing issues for Nullable<Date> #1109

Closed
estelendur opened this Issue Aug 16, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@estelendur

estelendur commented Aug 16, 2017

Setup

Versions

  • Rust: rustc 1.21.0-nightly (f25c2283b 2017-08-15)
  • Diesel: SHA 01f72e1
  • Database: Postgresql
  • Operating System Fedora Workstation 25

Feature Flags

  • diesel: ["postgres", "chrono", "uuid", "huge-tables", "extras"]
  • diesel_codegen: ["postgres"]

Problem Description

I am trying to set up a table with Nullable columns. Small example:

table! {
    master {
        id -> Integer,
        file_number -> Text,
        date_received -> Nullable<Date>,
    }
}

What is the actual output?

When I try to compile, I receive the following error, along with a similar one for diesel::types::ops::Add:

error[E0277]: the trait bound `diesel::types::Nullable<diesel::types::Date>: diesel::types::ops::Sub` is not satisfied
  --> src/cls/schema.rs:19:5
   |
19 | /     table! {
20 | |         importer.debtor {
21 | |             id -> Integer,
22 | |             internal_ref -> Text,
...  |
39 | |         }
40 | |     }
   | |_____^ the trait `diesel::types::ops::Sub` is not implemented for `diesel::types::Nullable<diesel::types::Date>`
   |
   = help: the following implementations were found:
             <diesel::types::Nullable<diesel::types::SmallInt> as diesel::types::ops::Sub>
             <diesel::types::Nullable<diesel::types::BigInt> as diesel::types::ops::Sub>
             <diesel::types::Nullable<diesel::types::Numeric> as diesel::types::ops::Sub>
             <diesel::types::Nullable<diesel::types::Integer> as diesel::types::ops::Sub>
           and 2 others
   = note: this error originates in a macro outside of the current crate

Steps to reproduce

Create a schema with a Nullable column and try to compile.

Checklist

  • I have already looked over the issue tracker for similar issues.
@killercup

This comment has been minimized.

Member

killercup commented Aug 16, 2017

Thanks for reporting! The PR that added this was #1094. Maybe you have an idea how to fix this?

(Looks like we are also missing a test case for nullable date time types.)

@killercup killercup added the bug label Aug 16, 2017

@estelendur

This comment has been minimized.

estelendur commented Aug 16, 2017

I'm sorry, I'm very new to Rust and don't have the first idea how to fix it.

@killercup

This comment has been minimized.

Member

killercup commented Aug 16, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment