Re: When is an explicit cast necessary? - Mailing list pgsql-general

From Tom Lane
Subject Re: When is an explicit cast necessary?
Date
Msg-id 8479.1271186166@sss.pgh.pa.us
Whole thread Raw
In response to Re: When is an explicit cast necessary?  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
Martijn van Oosterhout <kleptog@svana.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

pgsql-general by date:

Previous
From: A B
Date:
Subject: Re: Need some help with a query (uniq -c)
Next
From: Tom Lane
Date:
Subject: Re: psql's \d display of unique index vs. constraint