X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A95079DCD26 for ; Mon, 27 Mar 2006 15:03:36 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50749-03-2 for ; Mon, 27 Mar 2006 15:03:35 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from outbound.internet-mail-service.net (outbound7.internet-mail-service.net [216.240.47.198]) by postgresql.org (Postfix) with ESMTP id F1BCE9DCDDA for ; Mon, 27 Mar 2006 15:03:33 -0400 (AST) Received: from idiom.com (idiom.com [216.240.32.1]) by outbound.internet-mail-service.net (Postfix) with ESMTP id D3294244784 for ; Mon, 27 Mar 2006 11:03:33 -0800 (PST) Received: from [192.168.1.109] (adsl-69-107-132-69.dsl.pltn13.pacbell.net [69.107.132.69]) by idiom.com (8.12.11/8.12.11) with ESMTP id k2RJ3XpA082962 for ; Mon, 27 Mar 2006 11:03:33 -0800 (PST) (envelope-from bryce1@obviously.com) Message-ID: <44270BF6.6080109@obviously.com> Date: Sun, 26 Mar 2006 13:47:34 -0800 From: Bryce Nesbitt User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050921 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Bitfields always atomic? Other way to store attributes? Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.583 required=5 tests=[AWL=-0.298, DATE_IN_PAST_12_24=0.881] X-Spam-Score: 0.583 X-Spam-Level: X-Archive-Number: 200603/433 X-Sequence-Number: 24779 Dear List; If I have two threads modifying the same "bit" field: thread1=> update table set bf=bf | '01000' thread2=> update table set bf=bf | '10000' Will this operation always be safe (e.g. result in bf='11000')? Or must I wrap things in explicit transactions? My application is to give attributes to an address table. But maybe there is a better way? I want to mark each addresses with attributes, e.g. the person may be a "friend", "on my holiday card list", "owe me money", be an "employee", a "volunteer on the xxx project", or none of the above. I could assign each role a bit. Or, create a string field: "Friend,Money, Emp,VolXXX". Or, create related tables: friend_pk, address_id cardlist_pk, address_id money_pk, address_id, amount_owed volunteer_pk, address_id Any thoughts? -Bryce Nesbitt -- ---- Visit http://www.obviously.com/