title: Django : HINT: No operator matches the given name and argument types. You might need to add explicit type casts
body: <p>I'm wondering why this error display and I've been using Postgresql and I have been observed this error occurs when I use IntegerField on my models like this one<code> b2_sacnumber_id = models.IntegerField(blank=True, null=True)</code> or even using Integer field in local database. Is there any solution to get the value even I used IntergerFiled in my models? Im new in postgres , Can anyone explain to me about this it really helps me a lot.</p>
  <p><em>Error</em></p>
  <pre><code>LINE 1: ...sac_forms&quot; WHERE &quot;b2_sac_forms&quot;.&quot;b2_sacnumber_id&quot; IN (31718,...
                                                               ^
  HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
  </code></pre>
  <p><em>query views.py</em></p>
  <pre><code>sample = ['31718','47060']
  Sac_forms = list(B2SacForms.objects.using('matchy_data').values_list('b2_id', flat=True).filter(b2_sacnumber_id__in=sample))
  </code></pre>
  <p><em>What I tried</em> changing the value <code>sample</code> like this one <code>sample = ['31718','47060']</code> or <code>sample = [&quot;31718&quot;,&quot;47060&quot;] </code>  and even I tried <code>sample = [31718,47060]</code> but still the error occurs</p>
  <p><em>models.py</em></p>
  <pre><code>class B2SacForms(models.Model):
    b2_id = models.IntegerField(blank=True, null=True)
    b2_sacnumber_id = models.IntegerField(blank=True, null=True)
    date = models.DateField(blank=True, null=True)
    generated_id = models.IntegerField(blank=True, null=True)
  
  class Meta:
      managed = False
      db_table = 'b2_sac_forms'
  </code></pre>