Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 45082475D3B for ; Tue, 29 Oct 2002 19:59:45 -0500 (EST) Received: from pop.e-it.com (unknown [216.187.113.82]) by postgresql.org (Postfix) with SMTP id 533F9476668 for ; Tue, 29 Oct 2002 19:59:41 -0500 (EST) Received: (qmail 7592 invoked from network); 30 Oct 2002 00:59:42 -0000 Received: from pool-141-155-213-160.ny5030.east.verizon.net (HELO ?192.168.1.102?) (141.155.213.160) by 0 with SMTP; 30 Oct 2002 00:59:42 -0000 Subject: Bit string manipulation in Postgresql From: Ericson Smith To: pgsql-admin@postgresql.org Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 (1.0.8-10) Date: 29 Oct 2002 20:01:26 -0500 Message-Id: <1035939687.26937.7.camel@linux> Mime-Version: 1.0 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/301 X-Sequence-Number: 6159 Hi all, I'm trying to code a problem where a set of options can be expressed in a data column like "10111011", a bit string. Each position is atomic and represents a certain setting within the set, thus: "00100000" would return TRUE if OR'd with "10111011", since the 3'rd position matches in both sets. While I could manually retrieve N records and iterate through them in whatever programming language (or possibly a plpgsql function), is there a way I could natively do this in a WHERE clause in my query? Looking through the idocs, I could not immediately find a way around this issue. Any pointers to documentation (or perhaps another way to implement this issue) would be very helpful. Regards Ericson Smith eric@did-it.com