| From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
|---|---|
| To: | Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp> |
| Cc: | Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: [HACKERS] [PATCH] Lockable views |
| Date: | 2018-02-06 03:00:44 |
| Message-ID: | CA+TgmoZqDXb+ZBnBR9e8Pc=WkVAZ0yVqKyB_Mg14fySyOau7Eg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Mon, Feb 5, 2018 at 8:18 PM, Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp> wrote:
> We have: CREATE VIEW v1 AS SELECT * FROM t1 WHERE i = (SELECT i FROM t2);
>
> 1. Session A tries to lock v1 (I suppose it tries to acquire lock in
> the order of t1, then t2). A acquires lock on t1 but yet on t2.
>
> 2. Another session B acquires lock on t2.
>
> 3. A continues to try to acquire lock on t2 (blocked).
>
> 4. B tries to acquire lock on t1. Deadlock occurs.
True. But the same exact analysis also applies to this definition,
which contains no subquery:
CREATE VIEW v1 AS SELECT t1.* FROM t1, t2 WHERE t1.i = t2.i;
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Craig Ringer | 2018-02-06 03:13:03 | Re: Better Upgrades |
| Previous Message | Amit Langote | 2018-02-06 02:38:09 | Re: update tuple routing and triggers |