From: | Alvaro Herrera <alvherre(at)surnet(dot)cl> |
---|---|
To: | Matt Miller <mattm(at)epx(dot)com> |
Cc: | PostgreSQL - GENERAL <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: ERROR: cannot cast type text to bit varying |
Date: | 2005-06-09 22:54:06 |
Message-ID: | 20050609225406.GA15047@surnet.cl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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"
From | Date | Subject | |
---|---|---|---|
Next Message | Matt Miller | 2005-06-09 23:00:41 | Re: ERROR: cannot cast type text to bit varying |
Previous Message | elein | 2005-06-09 22:49:59 | Re: Version Control? |