Re: Protect a table against concurrent data changes while allowing to vacuum it

Поиск
Список
Период
Сортировка
Искать
От
Bill Moran
Тема
Re: Protect a table against concurrent data changes while allowing to vacuum it
Дата
Msg-id
20160622165657.47c4f7ee140cf57522cbac2f@potentialtech.com
Ответ на
Список
Дерево обсуждения
Protect a table against concurrent data changes while allowing to vacuum it Vlad Arkhipov <arhipov@dc.baikal.ru>
Re: Protect a table against concurrent data changes while allowing to vacuum it Albe Laurenz <laurenz.albe@wien.gv.at>
Re: Protect a table against concurrent data changes while allowing to vacuum it Sameer Kumar <sameer.kumar@ashnik.com>
Re: Protect a table against concurrent data changes while allowing to vacuum it Vlad Arkhipov <arhipov@dc.baikal.ru>
Re: Protect a table against concurrent data changes while allowing to vacuum it Jehan-Guillaume de Rorthais <ioguix@free.fr>
Re: Protect a table against concurrent data changes while allowing to vacuum it John R Pierce <pierce@hogranch.com>
Re: Protect a table against concurrent data changes while allowing to vacuum it Sameer Kumar <sameer.kumar@ashnik.com>
Re: Protect a table against concurrent data changes while allowing to vacuum it Bill Moran <wmoran@potentialtech.com>
Re: Protect a table against concurrent data changes while allowing to vacuum it Albe Laurenz <laurenz.albe@wien.gv.at>
Re: Protect a table against concurrent data changes while allowing to vacuum it Jehan-Guillaume de Rorthais <ioguix@free.fr>
Re: Protect a table against concurrent data changes while allowing to vacuum it Vlad Arkhipov <arhipov@dc.baikal.ru>
On Wed, 22 Jun 2016 10:20:38 +0000
Sameer Kumar  wrote:

> On Wed, Jun 22, 2016 at 6:08 PM Vlad Arkhipov  wrote:
> 
> > I am running PostgreSQL 9.5.
> >
> > CREATE TABLE t (id BIGINT NOT NULL PRIMARY KEY, name TEXT);
> >
> > The constraint that the data must satisfy is `there is no more than 3
> > records with the same name`.
> >
> > I am not in control of queries that modify the table, so advisory locks
> > can hardly be of help to me.
> >
> 
> Define a function which does a count of the rows and if count is 3 it
> return false if count is less it returns true.

An exclusion constraint might be a better solution.

-- 
Bill Moran

В списке pgsql-general по дате отправления
От: David G. Johnston
Дата:
От: Patrick B
Дата:
FAQ