Re: Allowing ALTER TYPE to change storage strategy

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Allowing ALTER TYPE to change storage strategy
Date: 2020-02-29 21:37:14
Message-ID: 20200229213714.7osohwlvup24ugd2@development
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Feb 28, 2020 at 08:35:33PM -0500, Tom Lane wrote:
>Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com> writes:
>> I think we might check if there are any attributes with the given data
>> type, and allow the change if there are none. That would still allow the
>> change when the type is used only for things like function parameters
>> etc. But we'd also have to check for domains (recursively).
>
>Still has race conditions.
>

Yeah, I have no problem believing that.

>> One thing I haven't mentioned in the original message is CASCADE. It
>> seems useful to optionally change storage for all attributes with the
>> given data type. But I'm not sure it's actually a good idea, and the
>> amount of code seems non-trivial (it'd have to copy quite a bit of code
>> from ALTER TABLE).
>
>You'd need a moderately strong lock on each such table, which means
>there'd be serious deadlock hazards. I'm dubious that it's worth
>troubling with.
>

Yeah, I don't plan to do this in v1 (and I have no immediate plan to
work on it after that). But I wonder how is the deadlock risk any
different compared e.g. to DROP TYPE ... CASCADE?

regards

--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-02-29 21:44:23 Re: Broken resetting of subplan hash tables
Previous Message Tom Lane 2020-02-29 21:36:25 Re: Allow to_date() and to_timestamp() to accept localized names