Thread: WIP patch for text coercions

WIP patch for text coercions

From
Tom Lane
Date:
The attached patch extends Peter's proposed patch to upgrade most implicit
casts-to-text to be assignment casts:
http://archives.postgresql.org/pgsql-hackers/2007-04/msg00017.php
with the other stuff discussed subsequently in that thread, namely
creating a generalized facility to support casts to and from text (and
varchar and bpchar) via the basic I/O functions of other types.

This adds one expression node type ("CoerceViaIO") but allows elimination
of a veritable boatload of duplicative per-datatype text conversion
functions, plus it works for types that never had such functions.

I have not touched the documentation yet.  Also I just noticed that
contrib/cube and contrib/isn create text casts that could be dispensed
with.  I think the patch is complete otherwise.

Another point that needs to be dealt with is the infelicity discussed
here:
http://archives.postgresql.org/pgsql-hackers/2007-02/msg01729.php
We had pretty much agreed that we could handle that by restricting the
conditions under which we'd consider coercing an UNKNOWN literal to
ANYARRAY, but it wasn't quite clear *what* restriction to use.

Comments?

            regards, tom lane


Attachment