operators and bit field - Mailing list pgsql-general

From Dennis Gearon
Subject operators and bit field
Date
Msg-id FE51PJXRFB31TNHDB0PJIFTPWV31942Z.3e4d3f8f@cal-lab
Whole thread Raw
Responses Re: operators and bit field  (Bruno Wolff III <bruno@wolff.to>)
Re: operators and bit field  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
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.

SELECT other_fields
FROM some_table
WHERE
      ( bitmask_8_columnA & bitmask_8_column B) = bitmask_8_patternONE
   OR ( bitmask_8_columnA & bitmask_8_column B) = bitmask_8_patternTWO
;

I may try to use a single char for one of the bit masks I need,
is it possible to store all 256 values into a varchar(1) using
escaped input?

Is it possible to AND two varchars within a select and compare the result?

SELECT other_fields
FROM some_table
WHERE ( varchar_1_columnA & varchar_1_columnB ) = 'single_escaped_char_string';



pgsql-general by date:

Previous
From: Rajesh Kumar Mallah
Date:
Subject: Re: [OpenFTS-general] Alpha version of contrib/tsearch is available for testing
Next
From: wsheldah@lexmark.com
Date:
Subject: Re: MS-Access