unixODBC to MariaDb: get mariadb-connector-odbc to quote a reserved column name

28 Views Asked by At

I have a legacy application that talks to MariaDb via unixODBC and uses the column name "partition" which is a reserved keyword. I can see in the failed query that it does

insert into table1 (....,partition,...) values(....,1234,....);

which is going to fail. Is there an interface between unixODBC and it's drivers or something in mariadb-connector-odbc that will inform it to quote column names as identifiers

I hope for

insert into table1 (....,`partition`,...) values(....,1234,....);

I am using unixODBC-2.3.9 with mariadb-connector-odbc-3.1.12 with MariaDB 10.5.

1

There are 1 best solutions below

0
Georg Richter On

The simple answer is no. Neither the unixODBC driver nor Connector/ODBC or Connector/C inform you about reserved words.

Such a feature would require client-side parsing of the statement and significantly slow down performance. SQL statements are parsed by MariaDB server which returns a syntax error in case of an unquoted reserved name.

Either don't use reserved names as column names, or always quote columnnames with backticks.