[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 18:14:40 +0100
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
>