Comments - Generated (Virtual and Persistent/Stored) Columns

8 years, 8 months ago Jan Steinman

"Their value can be a not deterministic function, except if use in an index or a constraint."

In 10.1.6 (at least), you can use non-deterministic functions, but apparently the 252 character limitation still exists.

I'd show you, but I'm frustrated with the UI here. How did you get the <pre></pre> to work in your comment?

 
8 years, 8 months ago Jan Steinman

Let's try some <code>:

ALTER TABLE `z_test`
    ADD `Last_name_bit_length` INT(5)
        AS (BIT_LENGTH(`Name_Last`)) PERSISTENT
        AFTER `Name_Last`;

MariaDB [EcoReality]> SELECT Name_Last, Last_name_bit_length from z_test;
+------------+----------------------+
| Name_Last  | Last_name_bit_length |
+------------+----------------------+
| Bartfast   |                   64 |
| Flintstone |                   80 |
| Huston     |                   48 |
| Bah        |                   24 |
+------------+----------------------+
4 rows in set (0.00 sec)

Ah, that's better. :-)

 
8 years, 8 months ago Jan Steinman

(You guys REALLY need an "Edit" button...)

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.