This question already has an answer here:
- Is there any technique to do in postgresql 9.3 so that it start returning 1 and 0 instead of “t” and “f” for boolean type 2 answers
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:
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
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'.
So my question is "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'"
. So if you have any such type of technique please share. thank you.