Re: Re-create dependent views on ALTER TABLE ALTER COLUMN ... TYPE?

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: ash <ash(at)commandprompt(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re-create dependent views on ALTER TABLE ALTER COLUMN ... TYPE?
Date: 2014-06-02 17:29:25
Message-ID: CA+TgmoYwGhhX7BL95V_xti7u5VX1DvcYkr-VeFSnRSm7o4hbLw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jun 2, 2014 at 10:21 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Mon, Jun 2, 2014 at 8:52 AM, ash <ash(at)commandprompt(dot)com> wrote:
>>> Should this fail, the user will have to work around it, but most of the
>>> time it could just work.
>
>> You're either missing or choosing to ignore the point that I'm making,
>> which is that we *don't have* the text form of the view anywhere.
>
> Even if we did, I don't think it'd affect this decision.
>
> The real problem in my mind is one of user expectations. If the database
> silently does something behind your back, people expect that that action
> will be *right* and they don't have to worry about it. I don't think
> that automatically reparsing views has much chance of clearing that bar.

I agree, but I think it's important to note that Alex's complaint is
not unique - the way things work now is a real source of frustration
for users. In a previous job, I wrote a schema-upgrade script that
dropped all of the views in reverse creation order, applied the schema
updates, and then recreated all the views. This worked, but it was a
lot of hassle that I would have preferred to avoid, and in a
higher-volume application, simultaneously grabbing exclusive locks on
a large number of critical views would have been a non-starter. In
the job before that, I did the same thing manually, which was no fun
at all. This was actually what posted me to write one of my first
patches, committed by Bruce as
ff1ea2173a92dea975d399a4ca25723f83762e55.

From a technical standpoint, I'm not very sure what to do to further
improve the situation - which I will broadly characterize as "view
dependency hell" - but if I did have such an idea I might be willing
to take a modest risk of user confusion if it seemed likely to also
reduce user frustration.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-06-02 17:29:33 Re: recovery testing for beta
Previous Message Hai Qian 2014-06-02 17:16:30 Re: [GSoC] Clustering in MADlib - status update