Search Postgresql Archives

Re: ERROR: cannot cast type text to bit varying

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

 



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

[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