I'm dazzled with strange syntax issue with MySQL calculated column

56 views Asked by At

I have a calculated column for concatenating fields into an adress. It worked but I altered the table and added some columns and now I get an error. I do not know where I went wrong.

I use: Serverversion: 8.0.36-0ubuntu0.20.04.1 - (Ubuntu)

When I add the following SQL script via PHPMYadmin it accepts the syntax. Everything seems ok. When I add a row via my application I get an error. When I remove the calculation, it's again ok and can add a row.

ALTER TABLE app_fd_halo_objects
MODIFY c_adres varchar(255) GENERATED ALWAYS AS 
(IF(c_box_volgnr > '', (CONCAT(c_straat, ' ', c_huisnummer, ', boxnr ', 
 c_box_volgnr, ', ',c_plaats)), (CONCAT(c_straat, ' ', c_huisnummer,  ', ', c_plaats))))
stored;

When I add the script again, all seems ok, no error message. But when I go to change that column and without changing something press the save button. PHPMyadmin comes with:

enter image description here

I hope someone can help.

I'm sorry it's in Dutch, but I think its understandable

0

There are 0 answers