On 9 Apr 2010, at 16:57, Alan Millington wrote:

> However, every language that I have ever used will implicitly convert an 
> integer 1 to a smallint (or short) 1 when required to do so. How can such a 
> cast be called "surprising behaviour", or produce "misleading results", to 
> quote the first article?

No, they probably don't cast integer values down to smallint. What they do is 
cast the smallint up to integer, as that's a safe cast. After all, numbers that 
fit in an int may not fit in a smallint (try "select 75000::smallint;" for 
example) and you'd lose data casting it down, but it's fine the other way 
around.

Since your function has smallint as one of its parameter types the database 
can't cast the smallint up to an int like it would normally do in such cases as 
the function doesn't accept integer values for that parameter. PG can't do much 
but throw an error.

Alban Hertroys

--
Screwing up is an excellent way to attach something to the ceiling.


!DSPAM:737,4bc0584910411899921361!



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to