In response to "Joshua D. Drake" <jd@commandprompt.com>:
>
> > Just another example of the fact that PHP was designed by incompetent
> > amateurs :-(
> >
> > http://www.junauza.com/2010/12/top-50-programming-quotes-of-all-time.html
>
> Unless I am misunderstanding the argument... perl and python both
> support what is suggested here.
>
> jd@jd-desktop:~$ perl -e 'print int('1e+01')';
> 10
Try the equivalent of:
$i = 1; while ($i < 1000000000000000000000000) { $i *= 10; echo $i . "\n";}
In languages other than PHP. In PHP the output is:
10
100
1000
10000
100000
1000000
10000000
100000000
1000000000
10000000000
100000000000
1000000000000
10000000000000
100000000000000
1000000000000000
10000000000000000
100000000000000000
1000000000000000000
1.0E+19
1.0E+20
1.0E+21
1.0E+22
1.0E+23
1.0E+24
The result being that a construct such as:
$query = "INSERT INTO some_table (int_column) VALUES ($i)";
Could end up being:
$query = "INSERT INTO some_table (int_column) VALUES (1.0E+24)";
Now, I want to make it clear that I'm not arguing that this is correct.
PHP's bizarre ideas about what constitutes types is one of my biggest
gripes against that language. I'm only pointing it out because it's
a clear case where _not_ having the suggested conversion might cause
errors in a program. Again, I'd be liable to argue that in such a
case the error is with PHP and not PostgreSQL, but if many other
languages behave the same, it might be a legitimate argument in favor
of supporting such an automatic conversion.
A strong argument against this is the fact that I've had problems with
MSSQL converting strings such as 1034297182365013256e109613205819326501
(i.e., that's an unfortunate hexidecimal string, not an exponential
number) into numbers and then returning overflow errors, which I find
extremely annoying and outright wrong, and which requires hacks in the
application code to prevent.
Now that I consider those points, I think I'm actually arguing on Tom's
side, that we should not support such a conversion ... actually, I'm
not sure what side of this I'm on right now, I'm just providing
evidence ...
--
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/