Re: [HACKERS] [PATCH] Lockable views

From: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
To: Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>
Cc: andres(at)anarazel(dot)de, robertmhaas(at)gmail(dot)com, thomas(dot)munro(at)enterprisedb(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] [PATCH] Lockable views
Date: 2018-04-16 08:41:16
Message-ID: 20180416174116.80818393.nagata@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 05 Apr 2018 07:53:42 +0900 (JST)
Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp> wrote:

I update the patch to fix the lockable view issues.

> >> > > +typedef struct
> >> > > +{
> >> > > + Oid root_reloid;
> >> > > + LOCKMODE lockmode;
> >> > > + bool nowait;
> >> > > + Oid viewowner;
> >> > > + Oid viewoid;
> >> > > +} LockViewRecurse_context;
> >> >
> >> > Probably wouldn't hurt to pgindent the larger changes in the patch.
>
> Yeah. Also, each struct member needs a comment.

I applied pgindent and added comments to struct members.

>
> >> > Hm, how can that happen? And if it can happen, why can it only happen
> >> > with the root relation?
> >>
> >> For example, the following queries cause the infinite recursion of views.
> >> This is detected and the error is raised.
> >>
> >> create table t (i int);
> >> create view v1 as select 1;
> >> create view v2 as select * from v1;
> >> create or replace view v1 as select * from v2;
> >> begin;
> >> lock v1;
> >> abort;
> >>
> >> However, I found that the previous patch could not handle the following
> >> situation in which the root relation itself doesn't have infinite recursion.
> >>
> >> create view v3 as select * from v1;
> >> begin;
> >> lock v3;
> >> abort;
>
> Shouldn't they be in the regression test?

Added tests for the infinite recursion detection.

Regards,

>
> It's shame that create_view test does not include the cases, but it's
> another story.
>
> Best regards,
> --
> Tatsuo Ishii
> SRA OSS, Inc. Japan
> English: http://www.sraoss.co.jp/index_en.php
> Japanese:http://www.sraoss.co.jp

--
Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>

Attachment Content-Type Size
fix_lockable_view-v3.patch text/x-diff 8.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2018-04-16 08:47:26 Re: ON CONFLICT DO UPDATE for partitioned tables
Previous Message Pavel Stehule 2018-04-16 08:37:36 Re: auto_explain and parallel queries issue