Re: Question about RI checks

From: Nick Barnes <nickbarnes01(at)gmail(dot)com>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: Florian Pflug <fgp(at)phlo(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Subject: Re: Question about RI checks
Date: 2014-10-21 17:27:57
Message-ID: CAG+WGGnefBg75Va0zRVvogRe=dqQVq0ahEd6fTRnniqyNwmQXg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Oct 22, 2014 at 3:19 AM, Kevin Grittner <kgrittn(at)ymail(dot)com> wrote:

>
> It doesn't seem like this analysis considers all of the available ON
> DELETE and ON UPDATE behaviors available. Besides RESTRICT there is
> CASCADE, SET NULL, SET DEFAULT, and NO ACTION. Some of those
> require updating the referencing rows.
>

I think the logic in question is specific to RESTRICT and NO ACTION. The
other cases don't look like they need to explicitly lock anything; the
UPDATE / DELETE itself should take care of that.

On Wed, Oct 22, 2014 at 3:19 AM, Kevin Grittner <kgrittn(at)ymail(dot)com> wrote:

> Florian Pflug <fgp(at)phlo(dot)org> wrote:
>
> > So in conclusion, the lock avoids raising constraint violation errors in
>
> > a few cases in READ COMMITTED mode. In REPEATABLE READ mode, it converts
> some
> > constraint violation errors into serialization failures. Or at least
> that's
> > how it looks to me.
>
> It doesn't seem like this analysis considers all of the available ON
> DELETE and ON UPDATE behaviors available. Besides RESTRICT there is
> CASCADE, SET NULL, SET DEFAULT, and NO ACTION. Some of those
> require updating the referencing rows.
>
> >> And even if the lock serves a purpose, KEY SHARE is an odd choice, since
> >> the referencing field is, in general, not a "key" in this sense.
> >
> > Hm, yeah, that's certainly weird.
>
> I don't think I understand that either.
>
> --
> Kevin Grittner
> EDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2014-10-21 18:49:36 Re: run xmllint during build (was Re: need xmllint on borka)
Previous Message Tom Lane 2014-10-21 17:16:46 Getting rid of "accept incoming network connections" prompts on OS X