Re: Re-create dependent views on ALTER TABLE ALTER COLUMN ... TYPE? - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Re-create dependent views on ALTER TABLE ALTER COLUMN ... TYPE?
Date
Msg-id CA+TgmoYwGhhX7BL95V_xti7u5VX1DvcYkr-VeFSnRSm7o4hbLw@mail.gmail.com
Whole thread Raw
In response to Re: Re-create dependent views on ALTER TABLE ALTER COLUMN ... TYPE?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Re-create dependent views on ALTER TABLE ALTER COLUMN ... TYPE?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Re-create dependent views on ALTER TABLE ALTER COLUMN ... TYPE?  (Stephen Frost <sfrost@snowman.net>)
Re: Re-create dependent views on ALTER TABLE ALTER COLUMN ... TYPE?  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-hackers
On Mon, Jun 2, 2014 at 10:21 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> On Mon, Jun 2, 2014 at 8:52 AM, ash <ash@commandprompt.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



pgsql-hackers by date:

Previous
From: Jeff Janes
Date:
Subject: Re: recovery testing for beta
Next
From: Andres Freund
Date:
Subject: Re: recovery testing for beta