On Thu, Jun 09, 2005 at 10:18:27PM +0000, Matt Miller wrote:
> On Thu, 2005-06-09 at 20:05 +0000, Matt Miller wrote:
> > I'm trying to interpret strings of Y's and N's as bit vectors and
> > perform bitwise ops on them.
> 
> Well, I ended up writing a bunch of code to accomplish what I initially
> thought would be just some casting and bitops on built-in types.  I
> really thought that the bit string types would help me, but I just
> couldn't get them to work.

I imagine you could have done something involving textout() and
varbit_in(), like

alvherre=# select varbit_in(textout(translate('YYNY', 'YN', '10')), 123::oid, 
32);
 varbit_in 
-----------
 1101
(1 fila)

The OID parameter is unused, give it anything except NULL.  The integer
is the maximum length of the resulting varbit field.

-- 
Alvaro Herrera (<alvherre[a]surnet.cl>)
"La soledad es compañía"

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to