Bug #75301 SqlNullValueException thrown when calling MySqlConnection::GetSchema
Submitted: 24 Dec 2014 0:11 Modified: 22 Nov 2021 21:39
Reporter: Colin Paterson Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:6.9.5.0 OS:Windows
Assigned to: Assigned Account CPU Architecture:Any
Tags: GetSchema Index Columns

[24 Dec 2014 0:11] Colin Paterson
Description:
When you call MySqlConnection::GetSchema("IndexColumns") on a database that has a full text index defined a SqlNullValueException is thrown. This works as expected when there are no full text indexes but the exception is thrown when a full text search index is defined.

Exception is

System.Data.SqlTypes.SqlNullValueException was caught
  HResult=-2146232015
  Message=Data is Null. This method or property cannot be called on Null values.
  Source=MySql.Data
  StackTrace:
       at MySql.Data.MySqlClient.MySqlDataReader.GetFieldValue(Int32 index, Boolean checkNull)
       at MySql.Data.MySqlClient.MySqlDataReader.GetString(Int32 i)
       at MySql.Data.MySqlClient.MySqlDataReader.GetString(String column)
       at MySql.Data.MySqlClient.SchemaProvider.GetIndexColumns(String[] restrictions)
       at MySql.Data.MySqlClient.SchemaProvider.GetSchemaInternal(String collection, String[] restrictions)
       at MySql.Data.MySqlClient.ISSchemaProvider.GetSchemaInternal(String collection, String[] restrictions)
       at MySql.Data.MySqlClient.SchemaProvider.GetSchema(String collection, String[] restrictions)
       at MySql.Data.MySqlClient.MySqlConnection.GetSchema(String collectionName, String[] restrictionValues)
       

How to repeat:
Define a full text search index on any table and then run the following code

_connection.GetSchema("IndexColumns");

Suggested fix:
It shouldn't crash.
[24 Dec 2014 6:50] Chiranjeevi Battula
Hello Colin Paterson,

Thank you for the bug report.
Verified this behavior on Visual Studio 2013 (C#.Net) with  MySQL Connector/Net 6.9.5.

Thanks,
Chiranjeevi.
[31 Jul 2018 19:24] Donald Scott
Was there any fix to this?  It has been open for 3 years with a serious severity.
[22 Nov 2021 21:39] Christine Cole
Posted by developer:
 
Fixed as of the upcoming MySQL Connector/NET 8.0.28 release, and here's the proposed changelog entry from the documentation team:

A call to MySqlConnection::GetSchema("IndexColumns") unexpectedly
retrieved a NULL value and emitted an error when the database included a
full text index.

Thank you for the bug report.