Re: Deadlock bug

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Joel Jacobson <joel@gluefinance.com>
Cc: Kevin Grittner <Kevin.Grittner@wicourts.gov>, Magnus Hagander <magnus@hagander.net>, glue@pgexperts.com, pgsql-hackers@postgresql.org
Date: 2010-08-20T19:11:37Z
Lists: pgsql-hackers
Joel Jacobson <joel@gluefinance.com> writes:
> I fully agree it must obtain a sharelock on the FK, but I cannot understand
> why it is granted it the first time, but not the second time?

It *isn't* granted it the first time, because it doesn't try to acquire
it the first time.  That FK check gets optimized away, while the second
one doesn't.  Please reread what I said before.

			regards, tom lane