title: How to filter on a Option[Boolean] column in slick
body: <p>I have the following column in my db, thats a Boolean, but also accepts NULL, so true, false, and NULL are all valid:</p>
  
  <pre><code>def rtb = column[Option[Boolean]]("rtb")
  </code></pre>
  
  <p>and have the following optional input from the client that I'd like to filter on:</p>
  
  <pre><code>rtbFromClient: Option[Boolean] = ... 
  </code></pre>
  
  <p>I have the following (based on this answer on how to do queries in slick:  <a href="https://stackoverflow.com/a/40888918/5300930">https://stackoverflow.com/a/40888918/5300930</a>):</p>
  
  <pre><code>val query = userTable.
        filter(row =&gt; 
            if (rtbFromClient.isDefined) 
                row.rtb.get === rtbFromClient.get 
            else 
                LiteralColumn(true)
        )
  </code></pre>
  
  <p>but am getting this error when the code runs:</p>
  
  <pre><code>Caught exception while computing default value for Rep[Option[_]].getOrElse -- This cannot be done lazily when the value is needed on the database side
  </code></pre>
  
  <p>I thought it may be because row.rtb.get was throwing exception on call to get because the value in the db was null, so tried changing it to row.rtb.getOrElse(null) and row.rtb.getOrElse(None) but neither of these worked either)</p>
  
  <p>Also tried the following:</p>
  
  <pre><code>if (rtbFromClient.isDefined) {
      val query = query.filter(_.rtb.isDefined).filter(_.rtb.get === rtbFromClient.get)
  }
  </code></pre>
  
  <p>But this also throws the same error at runtime:</p>
  
  <pre><code>Caught exception while computing default value for Rep[Option[_]].getOrElse -- This cannot be done lazily when the value is needed on the database side
  </code></pre>
  
  <p>To summarise:</p>
  
  <ul>
  <li>I have an Option[Boolean] column in my db that can contain true, false or NULL (the actual mysql type is a tinyint(1), which is mapped to a slick Option[Boolean])</li>
  <li>I have an optional filter provided by the user, rtbFromClient that I'd like to filter on if present. If present, this will be either true or false</li>
  <li>I have other optional filters (not shown here) that have similar behavior so I'd like to be able to combine them easily</li>
  </ul>