You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a regression from 2.0.13-beta1.
I tried to upgrade to 2.1.3 and Npgsql crashed when I try to insert a NaN value in a double precision field.
The error is:
Npgsql.NpgsqlException : ERROR: 42703: column "nan" does not exist
The first tests works, the second raises the error.
[Test]
public void HandleDoubleValueParameter()
{
ExecuteNonQuery(@"CREATE TABLE dataDouble (
field_double double precision
)");
try
{
var command = new NpgsqlCommand("insert into dataDouble(field_double) values (:a)", Conn);
command.Parameters.Add(new NpgsqlParameter("a", NpgsqlDbType.Double));
command.Parameters[0].Value = 123.456;
var query = command.CommandText;
var rowsAdded = command.ExecuteNonQuery();
Assert.AreEqual(1, rowsAdded);
}
finally
{
ExecuteNonQuery(@"DROP TABLE dataDouble");
}
}
[Test]
public void HandleDoubleNanValueParameter()
{
ExecuteNonQuery(@"CREATE TABLE dataDouble (
field_double double precision
)");
try
{
var command = new NpgsqlCommand("insert into dataDouble(field_double) values (:a)", Conn);
command.Parameters.Add(new NpgsqlParameter("a", NpgsqlDbType.Double));
command.Parameters[0].Value = double.NaN;
var query = command.CommandText;
var rowsAdded = command.ExecuteNonQuery();
Assert.AreEqual(1, rowsAdded);
}
finally
{
ExecuteNonQuery(@"DROP TABLE dataDouble");
}
}
Activity
franciscojunior commentedon Apr 17, 2014
I'll check that. Thanks for your report!
franciscojunior commentedon Jun 10, 2014
Sorry for late reply.
Indeed this regression was caused by changes in the way we send the data to the server.
For while, a workaround is to use a prepared statement.
I'm working on a fix.
Fix npgsql#217 when handling NaN for float4 and float8 datatypes.
roji commentedon Jul 30, 2014
@franciscojunior, this is one of the last issues for 2.2 Is it a duplicate of #257? Are you working on it or is @glenebob?
franciscojunior commentedon Jul 30, 2014
I asked @glenebob to have a look at it. He said he will look on this weekend.
#257 is the pull request with my fix for this issue.
Merge pull request #257 from franciscojunior/217-fix-doubleNaN-regres…