Mark Dilger <pgsql@markdilger.com> writes:
> Mark Dilger wrote:
>> Casts from int2 -> int4, int2 -> int8, and int4 -> int8 would all be
>> SAFE, I think, because they are not lossy. But perhaps I have not
>> thought enough about this and these should be IMPLICIT rather than SAFE.
> I have thought about this some more. I think these are indeed SAFE. The
> distinction between SAFE and IMPLICIT should not, I think, be whether the
> storage type is identical, but rather whether there is any possible loss of
> precision, range, accuracy, etc., or whether there is any change in the
> fundamental interpretation of the data when cast from the source to destination
> type.
You are going in exactly the wrong direction --- this line of thought is
aiming to make *more* casts possible by default, which is not what we
need, at least not among the collection of base types.
regards, tom lane