ALTER TYPE 2: skip already-provable no-work rewrites - Mailing list pgsql-hackers

From Noah Misch
Subject ALTER TYPE 2: skip already-provable no-work rewrites
Date
Msg-id 20110109220141.GC5777@tornado.leadboat.com
Whole thread Raw
Responses Re: ALTER TYPE 2: skip already-provable no-work rewrites  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
This patch removes ALTER TYPE rewrites in cases we can already prove valid.  I
add a function GetCoerceExemptions() that walks an Expr according to rules
discussed in the design thread, simplified slightly pending additions in the
next patch.  See the comment at that function for a refresher.  I use it to
populate two new bools to AlteredTableInfo, "new_bits" and "mayerror".
"new_bits" is a superset of "new_changedoids", so I subsume that.  I change
ATRewriteTable to act on those and support the notion of evaluating the
transformation expressions when we're not rewriting the table.

As unintended fallout, it's no longer an error to add oids or a column with a
default value to a table whose rowtype is used in columns elsewhere.  This seems
best.  Defaults on the origin table do not even apply to new inserts into such a
column, and the rowtype does not gain an OID column via its table.

This helps on conversions like varchar(X)->text, xml->text, and conversions
between domains and their base types.

Attachment

pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: ALTER TYPE 1: recheck index-based constraints
Next
From: Noah Misch
Date:
Subject: ALTER TYPE 3: add facility to identify further no-work cases