Re: ALTER TYPE 2: skip already-provable no-work rewrites

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: ALTER TYPE 2: skip already-provable no-work rewrites
Date: 2011-02-15 04:31:08
Message-ID: AANLkTi=43DmnN8bRJTJMrb544U-xrFVy4Y84paypBnuq@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Feb 14, 2011 at 7:52 AM, Noah Misch <noah(at)leadboat(dot)com> wrote:
>> I'm half-tempted to put that part off to
>> 9.2, in the hopes of getting a more substantial solution that can also
>> handle things like text -> xml which we don't have time to re-engineer
>> right now.
>
> I see.

After sleeping on it, I think this route makes most sense. The
ability to downgrade a rewrite to a scan is really a separate feature,
and I'd like to see us implement that in a more complete way when/if
we're going to do it; and I'd rather commit it at the beginning of a
development cycle when we have more time to find any lurking bugs. So
I've committed a change that just handles the unconstrained domain
case. I think for 9.2 we should revisit the following areas:

1. Downgrading rewrites to scans (vs. skipping them altogether). One
idea is that we might modify CREATE CAST so that you can do this:

CREATE CAST (source_type AS target_type) WITH [ CHECK ] FUNCTION
function_name (argument_type [, ...])
[ AS ASSIGNMENT | AS IMPLICIT ];

The inclusion of the keyword "check" there would inform the system
that the binary representation can't change, but (as distinguished
from WITHOUT FUNCTION) an error might be thrown. Of course, I'm not
quite sure how to get this information over to the alter table
machinery cleanly.

2. Detecting binary-coercible cases that involve typemods, rather than
just type OIDs.

3. Avoiding index rebuilds.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-02-15 04:38:22 Re: why two dashes in extension load files
Previous Message David E. Wheeler 2011-02-15 04:25:23 Re: why two dashes in extension load files