Search Postgresql Archives

Re: getting postgres to emulate mysql/sqlserver bit datatype

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Shane Ambler <pgsql@xxxxxxxxxxxxxxxx> 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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux