pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bryce Nesbitt <bryce1@obviously.com>
To: pgsql-sql@postgresql.org
Subject: Bitfields always atomic? Other way to store attributes?
Date: Sun, 26 Mar 2006 13:47:34 -0800
Message-ID: <44270BF6.6080109@obviously.com> (raw)

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/





view thread (5+ messages)  latest in thread

Message-ID: <44270BF6.6080109@obviously.com>
Permalink:  ../44270BF6.6080109@obviously.com/
Also on:    postgresql.org/message-id/44270BF6.6080109@obviously.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bryce1@obviously.com
  Subject: Re: Bitfields always atomic? Other way to store attributes?
  In-Reply-To: <44270BF6.6080109@obviously.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox