pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter_e@gmx.net>
To: pgsql-sql@postgresql.org
Cc: Bryce Nesbitt <bryce1@obviously.com>
Subject: Re: Bitfields always atomic? Other way to store attributes?
Date: Mon, 27 Mar 2006 21:13:17 +0200
Message-ID: <200603272113.17516.peter_e@gmx.net> (raw)
In-Reply-To: <44270BF6.6080109@obviously.com>
References: <44270BF6.6080109@obviously.com>

Bryce Nesbitt wrote:
> 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?

Each of these commands will be its own transaction if you don't 
explicitly start one.

> My application is to give attributes to an address table.  But maybe
> there is a better way?

Create 5 boolean fields.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/



view thread (5+ messages)  latest in thread

Message-ID: <200603272113.17516.peter_e@gmx.net>
Permalink:  ../200603272113.17516.peter_e@gmx.net/
Also on:    postgresql.org/message-id/200603272113.17516.peter_e@gmx.net

 · 

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: peter_e@gmx.net, bryce1@obviously.com
  Subject: Re: Bitfields always atomic? Other way to store attributes?
  In-Reply-To: <200603272113.17516.peter_e@gmx.net>

* 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