Re: lexing small ints as int2 - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: lexing small ints as int2
Date
Msg-id 1283562627-sup-4431@alvh.no-ip.org
Whole thread Raw
In response to Re: lexing small ints as int2  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: lexing small ints as int2
Re: lexing small ints as int2
List pgsql-hackers
Excerpts from Tom Lane's message of vie sep 03 19:36:06 -0400 2010:

> > Does anyone know where to find the discussion refered to here?
> > http://archives.postgresql.org/pgsql-hackers/2008-10/msg01485.php
> 
> I think this was the last time I tried it:
> http://archives.postgresql.org/pgsql-hackers/2002-11/msg00468.php

Interesting, thanks.  I also had some vague thought about conversion
distance today, thinking it could help solve the problem.

> At the time, the main motivation for worrying about it was that cases
> like "WHERE smallintcol = 42" couldn't be indexed, because 42 is int4
> not int2.  We've since fixed that by allowing cross-type operators
> to be indexable.

Yeah, that's no longer an issue fortunately.

> I also notice that one of the failure cases I cited might no longer be
> an issue now that we don't have implicit casts to text, but that change
> isn't going to do anything for the other cases.

Right.

> On the whole I'm still afraid that changing the initial typing of
> integer constants is going to break a lot of code while buying not much.
> Do you have a specific reason for reopening the issue?  Or is your
> concern something different?

The problem I'm facing is functions declared to take type smallint not
working unless the integer literal has an explicit cast.  Currently the
best answer is simply to avoid using smallint in functions, but this
isn't completely satisfying.

-- 
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Interruptible sleeps (was Re: CommitFest 2009-07: Yay, Kevin! Thanks, reviewers!)
Next
From: Robert Haas
Date:
Subject: Re: lexing small ints as int2