Jeff Janes <jeff.janes@gmail.com> writes:
> On Sun, Nov 18, 2012 at 4:35 PM, Vick Khera <vivek@khera.org> wrote:
>> On Sun, Nov 18, 2012 at 7:24 PM, Craig Ringer <craig@2ndquadrant.com> wrote:
>>> That depends on the PostgreSQL version. Some changes were made to improve
>>> that recently; from memory, it used to require rewriting, so people would
>>> sometimes work around it with (dodgy and unsafe) hacks directly to the
>>> system catalogs. I'm not sure if "recently" is 9.2 or 9.3.
> Just looking at the timing of the below, I'd say the optimization of
> varchar(n) to text took place in 9.1.
9.1 is bright enough to optimize that specific case; 9.2 covers some
additional cases like varchar(m) to varchar(n) for m <= n. I think also
that 9.2 avoids rebuilding indexes on the affected column in some of
these cases, but 9.1 did not.
regards, tom lane