Open MasterKuat opened 3 months ago
hi - thanks for reporting this issue and all the details (and the suggested solution too!) managed to reproduce it as you described; we'll take a look and fix it.
i also observed that using reader.Read()
, something like:
...
cmd.CommandText = "SELECT variantcol from test_db.dotnet.gh1006;";
IDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
Console.WriteLine(reader.GetString(0));
}
...
did not crash the application and could return the resultset; so perhaps could be used as a workaround until the issue is fixed, of course only if that makes sense in your case.
Anyways; thank you again and I'll keep this issue posted with the progress as there's any.
Same issue seems to be happening with ARRAY data types in the result.
One workaround is to specify the columns on the DataTable (generated from the results) before loading the data into it
IDataReader reader = cmd.ExecuteReader();
var table = new DataTable();
for (int i = 0; i < reader.FieldCount; i++)
{
table.Columns.Add(reader.GetName(i), reader.GetFieldType(i));
}
table.Load(reader);
This loaded the ARRAY columns as (serialized) strings.
What version of .NET driver are you using? 4.1.0
What operating system and processor architecture are you using? Windows 10, x64
What version of .NET framework are you using? .net framework 4.8
What did you do? Mainly :
cmd is a SnowflakeDbCommand with a simple query : SELECT MyVariantcolumn FROM T
dt.Load(reader) raise an exception : Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints
No exception
This came from ColumnSize
For variant rowType.length is 0, should be -1 for unknown. Replace L124 by :
row[SchemaTableColumn.ColumnSize] = rowType.length == 0 ? -1: (int)rowType.length;