Re: Concurrency-safe Replacing a Set of Rows (Without SERIALIZABLE)

From: Gavin Wahl <gwahl(at)fusionbox(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Concurrency-safe Replacing a Set of Rows (Without SERIALIZABLE)
Date: 2017-04-12 22:56:46
Message-ID: CAAAf5g9HLMvk4zfrLZjWkkeCD15MvL4cEMr-SjLqtvrTTb__ZA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Given this limited example I'd probably choose to model notifications as an
> array on the user table. Then just "UPDATE user SET notifications =
> array['a','b']::text WHERE user_id = 1;

I'm hesitant to ditch the first normal form just to get around this. Anyway,
there's actually extra data in the table that makes it hard to use an array:

CREATE TABLE notifications (
user_id INT,
type CHAR(1),
threshold INT,
some_options BOOLEAN,
PRIMARY KEY (user_id, type)
);

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2017-04-12 23:04:47 Re: Concurrency-safe Replacing a Set of Rows (Without SERIALIZABLE)
Previous Message David G. Johnston 2017-04-12 22:50:18 Re: Concurrency-safe Replacing a Set of Rows (Without SERIALIZABLE)