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

From: Noah Misch <noah(at)leadboat(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: ALTER TYPE 2: skip already-provable no-work rewrites
Date: 2011-01-09 22:01:41
Message-ID: 20110109220141.GC5777@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
at2-skip-nowork.patch text/plain 30.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2011-01-09 22:03:53 ALTER TYPE 3: add facility to identify further no-work cases
Previous Message Noah Misch 2011-01-09 22:00:23 ALTER TYPE 1: recheck index-based constraints