My first thought was to check server version but it is not the nicest solution. Is there something like PHP's function_exists() in mysql?

I'd like to detect JSON_EXTRACT() or the JSON data type: CREATE TABLE t1 (jdoc JSON);

Thank you.


I don't think there is any such feature in MariaDB or MySQL themselves at the moment (MariaDB 10.3, MySQL 5.7, 8.0).

So the only way I can imagine actually detecting support for specific data types and built-in functions on-the-fly would be to try using the data type or funtion, and then catching the exception, if any.

It's also possible that certain software libraries can give you a hint as to what features the underlying RDBMS can offer. If so, this is probably done by storing a list of features associated with each RDBMS version inside the software library.

| improve this answer | |
  • dzone.com/articles/json-with-mariadb-102 Also, MariaDB 10.3 is not stable it's RC status currently. – Pradeep Apr 10 '18 at 9:24
  • @Pradeep The question is bout detecting JSON data type support. 10.3 isn't stable yet, but it is RC, so no additional features are expected at this point beyond what is already in the documentation, and there just aren't any built-in methods for detecting JSON support. – dbdemon Apr 10 '18 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.