Re: Fixed length data types issue

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mark Dilger <pgsql(at)markdilger(dot)com>
Cc: Martijn van Oosterhout <kleptog(at)svana(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fixed length data types issue
Date: 2006-09-10 21:15:31
Message-ID: 3052.1157922931@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Mark Dilger <pgsql(at)markdilger(dot)com> writes:
> ... The argument made upthread that a
> quadratic number of conversion operators is necessitated doesn't seem
> right to me, given that each type could upcast to the canonical built in
> type. (int1 => smallint, int3 => integer, ascii1 => text, ascii2 =>
> text, ascii3 => text, etc.)

This would work all right for the string-category cases, since TEXT is
the only thing you really care about having them cast to anyway.
It probably won't work all that well for int1/int3, because you really
want them to coerce implicitly to all the "wider" numeric types.
Otherwise, perfectly sane queries like "int8 + int1" fail.

Part of the issue here is that we deliberately keep the parser from
searching for multi-step coercions. So for example if you only provide
int1->int2 then the existence of up-casts from int2 doesn't help you
use an int1 with anything except int2.

I am not sure whether any problems would be created if you did provide
the full spectrum of up-casts. I remember having argued that there
would be problems with trying to invent uint2/uint4 types, but that was
a very long time ago, before we had pg_cast and some other changes in
the type resolution rules. With the current system it might work OK.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Guido Barosio 2006-09-10 21:29:29 Re: contrib uninstall scripts need some love
Previous Message Joshua D. Drake 2006-09-10 20:50:39 Re: contrib uninstall scripts need some love