[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A 5.3 change is biting us hard...
- From: Marc Balmer <marc@...>
- Date: Wed, 10 Feb 2016 19:12:57 +0100
I found the issue:
We us a luaproxy module to map values from one Lua state to another. And this module did not differentiate between LUA_TNUMBER/integer and LUA_TNUMBER/float.
So an integer would become a float when transferred to the proxy state, and then be rendered using the all new shiny ".0" format.
Easy to fix, and actually fixed now.
> Am 10.02.2016 um 18:14 schrieb Marc Balmer <marc@msys.ch>:
>
> I think the problem is actually how we deal with numbers when returning values from psql result sets. Pretty much sure the problem is in luapgsql....
>
> Am 10.02.2016 um 18:05 schrieb Roberto Ierusalimschy <roberto@inf.puc-rio.br>:
>
>>> This little detail becomes "great" fun when you use numbers as integers in SQL statement:
>>>
>>> local id = tonumber(query.id) -- Get the id from a string in a webform
>>> local res = db:execParams('select * from foo where id = $1::integer', id)
>>>
>>> In PostgreSQL this results in an error like "Invalid input syntax for type integer: 41.0".
>>
>> What is funny is that 'tonumber' follows the syntax given to it. If it
>> is returning a float, it is because 'query.id' has a float format (either
>> a point or an exponent). Anyway, the correct approach is to follow
>> Daniel's suggestion.
>>
>> -- Roberto
>>
>