Skip to content

Commit f0c58a7

Browse files
committed
Only add SRS_ID column if it exists. Fixes #805
1 parent 1cae060 commit f0c58a7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/MySqlConnector/Core/SchemaProvider.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,14 @@ private void FillColumns(DataTable dataTable)
186186
new DataColumn("PRIVILEGES", typeof(string)), // lgtm[cs/local-not-disposed]
187187
new DataColumn("COLUMN_COMMENT", typeof(string)), // lgtm[cs/local-not-disposed]
188188
new DataColumn("GENERATION_EXPRESSION", typeof(string)), // lgtm[cs/local-not-disposed]
189-
new DataColumn("SRS_ID", typeof(string)), // lgtm[cs/local-not-disposed]
190189
});
191190

191+
using (var command = new MySqlCommand("SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = 'information_schema' AND table_name = 'COLUMNS' AND column_name = 'SRS_ID';", m_connection))
192+
{
193+
if (command.ExecuteScalar() is object)
194+
dataTable.Columns.Add(new DataColumn("SRS_ID", typeof(string))); // lgtm[cs/local-not-disposed]
195+
}
196+
192197
FillDataTable(dataTable, "COLUMNS");
193198
}
194199

0 commit comments

Comments
 (0)