Re: When is an explicit cast necessary?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Alan Millington <admillington(at)yahoo(dot)co(dot)uk>, Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>, Greg Smith <greg(at)2ndquadrant(dot)com>, Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: When is an explicit cast necessary?
Date: 2010-04-13 19:16:06
Message-ID: 8479.1271186166@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
> The question is: does the column really need to be smallint.

Yeah. Usually, declaring a function's argument as int rather than
smallint is the easiest fix. We have looked into this in the past,
and concluded that the negative aspects of allowing integer constants
to implicitly cast to smallint parameters would outweigh the
positives. As an example, such simple expressions as "2 + 2" would
start to fail because it'd be unclear whether int or smallint addition
is meant. (And the point isn't academic, since for example it would
affect the overflow threshold.)

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-04-13 19:36:00 Re: psql's \d display of unique index vs. constraint
Previous Message A B 2010-04-13 19:12:59 Re: Need some help with a query (uniq -c)