On Mon, Feb 14, 2011 at 7:52 AM, Noah Misch <n...@leadboat.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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers