title: Is there any way to cast postgresql 9.3 data type so that it can affect only one side
body: <p>I am using ppas9.3(oracle compatible) and i want to do the casting so that it affect at one side only.
  what i want is, I want a data type which can accept both integer and boolean values during insertion and comparison but didn't get any success and the main problem that is occurring is:
  Initially they accept these values:</p>
  
  <pre><code>In Postgresql:-
  For Integer type datatype:-
  
  insert into ask(aint) values(1,'1')         working
  insert into ask(aint) values(true)      not working
  select * from ask where aint=1,'1',true;    working
  
  
  *For smallint type datatype:-
  
  insert into ask(asmall) values(1,'1',true); working
  select * from ask where asmall = 1,'1'      working
  select * from ask where asmall = true   not working
  
  For boolean type datatype:-
  
  insert into ask(abool) values(1)        not working
  insert into ask(abool) values(true)     working
  select * from ask where abool=1,true    working
  </code></pre>
  
  <p>After doing internal casting means updating pg table for 'Integer' to accept 'true'(boolean) at the time of comparison the behavior of 'Integer' column totally revert and started working same as 'smallint' and the same for 'smallint' and also same for 'boolean'.</p>
  
  <p>So my question is <code>"Is there any internal casting is available in postgresql 9.3 so that it can affect only one side means either at the time of 'insertion' or  at the time of 'comparison'"</code>. So if you have any such type of technique please share. thank you.</p>