Re: operators and bit field

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: gearond(at)cvc(dot)net
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: operators and bit field
Date: 2003-02-14 22:29:48
Message-ID: 11645.1045261788@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dennis Gearon <gearond(at)cvc(dot)net> writes:
> I haven't seen what operators can be applied to bit masks.
> In particular, I am looking to use binary AND:
> I want to AND two bitmasks together and see:
> A/ if the result has ANY bits set
> B/ what bits are set in the results.

Why don't you use bit strings, like the SQL spec authors intended?

regression=# select b'10001' & b'01111';
?column?
----------
00001
(1 row)

See types BIT(n) and BIT VARYING(n).

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Patrick Nelson 2003-02-14 22:30:28 Re: pgtcl way of specifying a user [SOLVED]
Previous Message Arguile 2003-02-14 22:28:31 Re: "iscachable" functions