title: Rust Diesel Library Deserialising Postgres DateTIme with Timestamptz,
body: <p>Error is :-</p>
  <pre><code>  &gt; src/lib.rs:45:14
         |
      45 |             .load::&lt;Store&gt;(&amp;conn)
         |              ^^^^ the trait 
  
  `diesel::deserialize::FromSql&lt;diesel::sql_types::Timestamptz, _&gt;` is not implemented for `bool`
  </code></pre>
  <p>My up.sql is :--</p>
  <pre><code>CREATE TABLE store (
      id SERIAL PRIMARY KEY,
      name VARCHAR(500) NOT NULL,
      description VARCHAR(2000) NOT NULL,
      created_at timestamp with TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
      updated_at timestamp with TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
      is_active boolean DEFAULT 'f' NOT NULL,
      created_by integer NOT NULL,
      address_id integer NOT NULL
  );
  
  SELECT diesel_manage_updated_at('store');
  </code></pre>
  <p>My model file : -</p>
  <pre><code>use diesel::{Insertable, Queryable};
  use serde::{Deserialize, Serialize};
  use chrono::{ DateTime, Utc };
  
  use crate::schema::{store, item, store_item};
  
  use std::convert::From;
  
  #[derive(Deserialize, Serialize, Queryable)]
  pub struct Store {
      pub id: i32,
      pub name: String,
      pub description: String,
      pub is_active: bool,
      pub created_by: i32,
      pub address_id: i32,
      pub created_at: DateTime&lt;Utc&gt;,
      pub updated_at: DateTime&lt;Utc&gt;,
  }
  </code></pre>
  <p>My test file :-</p>
  <pre><code>#[macro_use]
  extern crate diesel;
  extern crate dotenv;
  
  pub mod schema;
  pub mod models;
  
  
  
  #[cfg(test)]
  mod tests {
      #[test]
      fn it_works() {
  
          use diesel::prelude::*;
          use diesel::pg::PgConnection;
          use dotenv::dotenv;
          use std::env;
  
          dotenv().ok();
  
          let database_url = env::var(&quot;DATABASE_URL&quot;).expect(&quot;DATABASE_URL must be set&quot;);
          let conn = PgConnection::establish(&amp;database_url).expect(&amp;format!(&quot;Error connecting to {}&quot;, database_url));
  
          let sid: i32 = 1;
          use crate::models::{Store, NewStore};
          use crate::schema::store::dsl::*;
  
          let new_store = NewStore {
              name: &quot;Top in town stores&quot;.to_owned(),
              description: &quot;this is top in town stores&quot;.to_owned(),
              is_active: true,
              created_by: 22,
              address_id: 3322
          };
  
          let sam: usize = diesel::insert_into(store).values(&amp;new_store).execute(&amp;conn).unwrap();
  
          let user = store
              .filter(id.eq(sid))
              .limit(1)
              .load::&lt;Store&gt;(&amp;conn)
              .expect(&quot;Error loading posts&quot;);
  
          assert_eq!(1, 1);
      }
  }
  </code></pre>
  <p>My Cargo file :-</p>
  <pre><code>[package]
  name = &quot;database&quot;
  version = &quot;0.1.0&quot;
  authors = [&quot;spiderman&quot;]
  edition = &quot;2018&quot;
  
  
  # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
  
  [dependencies]
  diesel = { version=&quot;1.4.5&quot;, features = [&quot;postgres&quot;, &quot;extras&quot;, &quot;chrono&quot;] }
  
  chrono = { version = &quot;0.4&quot;, features = [&quot;serde&quot;, &quot;rustc-serialize&quot;] }
  
  serde = { version = &quot;1.0&quot;, features = [&quot;derive&quot;] }
  serde_json = &quot;1.0&quot;
  dotenv = &quot;*&quot;
  </code></pre>
  <p>My auto generated schema from diesel cli :-</p>
  <pre><code>table! {
      item (id) {
          id -&gt; Int4,
          name -&gt; Varchar,
          description -&gt; Varchar,
          created_at -&gt; Timestamptz,
          updated_at -&gt; Timestamptz,
          is_active -&gt; Bool,
          created_by -&gt; Int4,
      }
  }
  
  table! {
      store (id) {
          id -&gt; Int4,
          name -&gt; Varchar,
          description -&gt; Varchar,
          created_at -&gt; Timestamptz,
          updated_at -&gt; Timestamptz,
          is_active -&gt; Bool,
          created_by -&gt; Int4,
          address_id -&gt; Int4,
      }
  }
  
  table! {
      store_item (id) {
          id -&gt; Int4,
          store_id -&gt; Nullable&lt;Int4&gt;,
          item_id -&gt; Nullable&lt;Int4&gt;,
          created_at -&gt; Timestamptz,
          updated_at -&gt; Timestamptz,
          is_active -&gt; Bool,
          created_by -&gt; Int4,
      }
  }
  
  joinable!(store_item -&gt; item (item_id));
  joinable!(store_item -&gt; store (store_id));
  
  allow_tables_to_appear_in_same_query!(
      item,
      store,
      store_item,
  );
  </code></pre>
  <p>Problem only when I add datetimefield, If I remove it from sql and models, than it is not giving problem,</p>