BLOB column 'about' cannot have a default value (default)

Asked

Viewed 480 times

2

When trying to keep a column as null, mediumText, and add an 'as defined' value, it returns:

BLOB column 'about' cannot have a default value (default)

Why can’t I? What things imply this? How can I resolve this to allow an optional column in Mysql of type mediumText (or one that overrides the need) and has a default value like "Doesn’t talk much", for example?

  • 1

    What happened? Why vote against? How can I fix, improve...

  • It was not I who denied your question, my guess would be that someone voted negatively because it is a syntax error. In the case column blob does not accept default value and does not have much more to discuss about it except resolve via Trigger in the bank or in its own application.

  • @user97897 The answer solved your question? Do you think you can accept it? See [tour] if you don’t know how to do it. This would help a lot to indicate that the solution was useful for you. You can also vote on any question or answer you find useful on the entire site (when you have 15 points).

1 answer

1

What would be the default value for a BLOB since it can contain anything?

Unable to set a default value cannot use this clause in this column type.

On the other hand if the column accepts nulls, then the default value is easy, the NULL is the standard and there can use, a solution is to use a NULL, but I would only do this if I needed this and not something else, columns that allow nulls should be avoided, I would not use only to let it have a default value. And neither is the value you want.

If what you want is to put a text, then put the appropriate type. Just understand that TEXT is the same as a BLOB and does not accept default value.

You may think you should be able to put a text, but they thought that conceptually it didn’t make sense. There are those who disagree.

Documentation.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.