Skip site navigation (1) Skip section navigation (2)

How do i extract a certain bit from a bigint column

From: Mats Sjöberg <mats(dot)sjoberg(at)cybernetics(dot)se>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: How do i extract a certain bit from a bigint column
Date: 2004-05-12 11:05:09
Message-ID: A40C30932F52C4409B89ED049CCA06B13BA41D@srvex01.hk.cybernetics.se (view raw or flat)
Thread:
Lists: pgsql-sql
Hello everyone

In a table i have a column status of type bigint.

I need to create a view of the table including all rows with bit 4 set (value 8).

At the same time i need to exclude excludig all rows with bit 2 set.

 

What is the syntax to extract those bits?

I have tested get_bit(string, offset) but this requires a string, and not a bigint.

Is there a function to 

Best regards, Mats 

 


Attachment: =?iso-8859-1?Q?Mats_Sj=F6berg=2Evcf?=
Description: text/x-vcard (376 bytes)

Responses

pgsql-sql by date

Next:From: Mike RylanderDate: 2004-05-12 12:17:39
Subject: Re: How do i extract a certain bit from a bigint column
Previous:From: William Anthony LimDate: 2004-05-12 10:19:45
Subject: Re: working with schema

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group