Re: bug? non working casts for domain

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: Fabien COELHO <coelho@cri.ensmp.fr>, PostgreSQL Developers <pgsql-hackers@postgresql.org>
Date: 2006-05-07T02:19:39Z
Lists: pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> The error is coming from parse_expr.c::typecast_expression, and its call
> to typenameTypeId().  I wish I understood how we do domains better to
> fix this properly.  Anyone?

The reason the cast isn't found is that find_coercion_pathway() strips
off the domains before it ever even looks in pg_cast.  We can't simply
remove that logic without breaking things (notably, the ability to cast
between a domain and its base type).  I think it would be a mistake to
consider this behavior in isolation anyway --- it's fairly tightly tied
to the way that domains are handled (or, mostly, ignored) in
operator/function lookup.  See recent gripes from Elein.

If someone can put together a coherent proposal for how domains should
be dealt with in operator/function resolution, I'm all ears.

			regards, tom lane