Re: getting postgres to emulate mysql/sqlserver bit datatype
| От | Tom Lane |
|---|---|
| Тема | Re: getting postgres to emulate mysql/sqlserver bit datatype |
| Дата | |
| Msg-id | 6863.1171290483@sss.pgh.pa.us обсуждение |
| Ответ на | Re: getting postgres to emulate mysql/sqlserver bit datatype (Shane Ambler <pgsql@007Marketing.com>) |
| Ответы |
Re: getting postgres to emulate mysql/sqlserver bit datatype
|
| Список | pgsql-general |
Shane Ambler <pgsql@007Marketing.com> writes:
> If you look at the bool type you will find it calls a function called
> boolout(bool) which returns a cstring to return the data for the boolean
> - you could replace this with your own function that returns a 1 or 0
> instead of true or false. Similarly the functions to input/compare etc
> can be changed/replaced.
I think actually what he needs is what Peter suggested upthread, namely
to weaken the context-restriction on the int-to-bool cast. For a
comparison like
WHERE boolcol = 1
the system is still gonna see that as a bool vs int comparison, and it
won't take it unless int-to-bool is an implicit cast.
Another route might be to create a bool = int operator. That seems less
likely to break expected behaviors, but it'd be more work.
regards, tom lane
В списке pgsql-general по дате отправления: