0

I'm doing software development and the database server for testing is running 10.5.18-MariaDB-0+deb11u1 - Debian 11. I know many questions ask how to stop having a default for a text field being an error.

But the problem I'm trying to solve is that users running Windows databases in strict mode have failures if a default is specified for a text (or blob etc) field. I don't see them during testing, because my database doesn't treat it as an error.

I'd like to treat it as an error, so that I test in an environment at least as "hostile" as may be found with users. Is there a way to configure MariaDB so that a default for a text field will cause an error? (I don't want to run a Windows server, thank you).

My database server is running strict mode, but it does not give an error when creating a table with a text field with a default value.

mbrampton
  • 125
  • 1
  • 6
  • There is no such capability at the DB level. A default value to a DB is just that, a value that is used if no other value is provided and does not error. The application would need to have added handling to cover checks on the default values if that is needed for the testing. – Paul T. Jan 21 '23 at 14:49
  • Why should have Windows users have problems creating a text column with a default value? Do they use another RDBMS or eoled version of MariaDB? – Georg Richter Jan 21 '23 at 16:38
  • Ask your users to run the query `SELECT VERSION();` and report what it says. They must use the same version of MariaDB that you are. Text columns with default have been supported since version 10.2.1 according to [docs](https://mariadb.com/kb/en/text/). Also if they are running MySQL instead of MariaDB, you'll run into a lot more incompatibilities. – Bill Karwin Jan 21 '23 at 18:36
  • I thought there might not be a way to do this. At one time, MySQL generally did not support default values for text fields and documented the limitation, as described at https://bugs.mysql.com/bug.php?id=30494. The issue lingers, particularly for Windows, as described at https://stackoverflow.com/questions/3466872/why-cant-a-text-column-have-a-default-value-in-mysql. I can't ask users, I'm developing software for general use and don't know where it will be used. I'm just trying to test as effectively as possible. – mbrampton Jan 21 '23 at 21:01
  • Then you need to test using all versions of MySQL and mariadb you will say you support. There really is no shortcut. – ysth Jan 22 '23 at 09:23
  • Tags don't mention MySQL. – Georg Richter Jan 22 '23 at 16:59

0 Answers0