From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Shane Ambler <pgsql(at)007Marketing(dot)com> |
Cc: | Anton Melser <melser(dot)anton(at)gmail(dot)com>, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: getting postgres to emulate mysql/sqlserver bit datatype |
Date: | 2007-02-12 14:28:03 |
Message-ID: | 6863.1171290483@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Shane Ambler <pgsql(at)007Marketing(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-02-12 14:32:45 | Re: pg_dump: [tar archiver] write error appending to tar archive |
Previous Message | Merlin Moncure | 2007-02-12 14:09:00 | Re: Adjacency List or Nested Sets to model file system hierarchy? |