Re: [PATCH] SQL assertions prototype - Mailing list pgsql-hackers

From Kevin Grittner
Subject Re: [PATCH] SQL assertions prototype
Date
Msg-id 1387383869.66054.YahooMailNeo@web162903.mail.bf1.yahoo.com
Whole thread Raw
In response to Re: [PATCH] SQL assertions prototype  (Josh Berkus <josh@agliodbs.com>)
List pgsql-hackers
Josh Berkus <josh@agliodbs.com> wrote:

> Serializable or not, *what* do we lock for assertions?  It's not
> rows.  Tables?  Which tables?  What if the assertion is an
> interpreted language function?  Does the SSI reference counter
> really take care of all of this?

The simple answer is that, without adding any additional blocking,
SSI guarantees that the behavior of running any set of concurrent
serializable transactions is consistent with some serial
(one-at-a-time) execution of those transactions.  If the assertion
is run as part of the transaction, it is automatically handled,
regardless of the issues you are asking about.

The longer answer is in the README and the papers it references:

http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/storage/lmgr/README-SSI;hb=master

For practical examples of how it works, this Wiki page includes
examples of maintaining a multi-table invariant using triggers:

http://wiki.postgresql.org/wiki/SSI

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Sawada Masahiko
Date:
Subject: Re: Logging WAL when updating hintbit
Next
From: Alvaro Herrera
Date:
Subject: Re: [PATCH] SQL assertions prototype