Re: [v9.2] Fix leaky-view problem, part 1

From: Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp>
To: Noah Misch <noah(at)2ndquadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Kohei Kaigai <Kohei(dot)Kaigai(at)emea(dot)nec(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [v9.2] Fix leaky-view problem, part 1
Date: 2011-07-09 07:00:30
Message-ID: CADyhKSVkU1NqkS5RO6b_4BwrcMbtz8_GNq67FAWDfxBKMcd+nw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2011/7/8 Noah Misch <noah(at)2ndquadrant(dot)com>:
> On Fri, Jul 08, 2011 at 09:20:46AM +0100, Kohei KaiGai wrote:
>> 2011/7/7 Noah Misch <noah(at)2ndquadrant(dot)com>:
>> > On Thu, Jul 07, 2011 at 03:56:26PM +0100, Kohei KaiGai wrote:
>> >> 2011/7/7 Noah Misch <noah(at)2ndquadrant(dot)com>:
>> >> > On Wed, Jul 06, 2011 at 10:25:12PM +0200, Kohei KaiGai wrote:
>
>> >> > That gets the job done for today, but DefineVirtualRelation() should not need
>> >> > to know all view options by name to simply replace the existing list with a
>> >> > new one. ?I don't think you can cleanly use the ALTER TABLE SET/RESET code for
>> >> > this. ?Instead, compute an option list similar to how DefineRelation() does so
>> >> > at tablecmds.c:491, then update pg_class.
>> >> >
>> >> My opinion is ALTER TABLE SET/RESET code should be enhanced to accept
>> >> an operation to reset all the existing options, rather than tricky
>> >> updates of pg_class.
>> >
>> > The pg_class update has ~20 lines of idiomatic code; see tablecmds.c:7931-7951.
>> >
>> Even if idiomatic, another part of DefineVirtualRelation() uses
>> AlterTableInternal().
>> I think a common way is more straightforward.
>
> The fact that we use ALTER TABLE ADD COLUMN in DefineVirtualRelation() is not
> itself cause to use ALTER TABLE SET (...) nearby.  We should do so only if it
> brings some advantage, like simpler or more-robust code.  I'm not seeing either
> advantage.  Those can be points of style, so perhaps I have the poor taste here.
>
The attached patch is a revised version according to the approach that updates
pg_class system catalog before AlterTableInternal().
It invokes the new ResetViewOptions when rel->rd_options is not null, and it set
null on the pg_class.reloptions of the view and increments command counter.

Rest of stuffs are not changed from the v5.

Thanks,
--
KaiGai Kohei <kaigai(at)kaigai(dot)gr(dot)jp>

Attachment Content-Type Size
pgsql-v9.2-fix-leaky-view-part-0.v6.patch application/octet-stream 23.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kohei KaiGai 2011-07-09 07:01:19 Re: [v9.2] DROP Reworks Part.1 - Consolidate routines to handle DropStmt
Previous Message Darren Duncan 2011-07-09 06:39:48 Re: [HACKERS] Creating temp tables inside read only transactions