From: | Noah Misch <noah(at)leadboat(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | ALTER TYPE 3: add facility to identify further no-work cases |
Date: | 2011-01-09 22:03:53 |
Message-ID: | 20110109220353.GD5777@tornado.leadboat.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Here I add the notion of an "exemptor function", a property of a cast that
determines when calls to the cast would be superfluous. Such calls can be
removed, reduced to RelabelType expressions, or annotated (via a new field in
FuncExpr) with the applicable exemptions. I modify various parse_coerce.c
functions to retrieve, call, and act on these exemptor functions; this includes
GetCoerceExemptions() from the last patch. I did opt to make
find_typmod_coercion_function return COERCION_PATH_RELABELTYPE when no work is
needed, rather than COERCION_PATH_NONE; this makes it consistent with
find_coercion_pathway's use of that enumeration.
To demonstrate the functionality, I add exemptor functions for varchar and xml.
Originally I was only going to start with varchar, but xml tests the other major
code path, and the exemptor function for xml is dead simple.
This helps on conversions like varchar(4)->varchar(8) and text->xml.
Attachment | Content-Type | Size |
---|---|---|
at3-exemptor.patch | text/plain | 81.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Noah Misch | 2011-01-09 22:05:00 | ALTER TYPE 4: temporal data types |
Previous Message | Noah Misch | 2011-01-09 22:01:41 | ALTER TYPE 2: skip already-provable no-work rewrites |