ActiveObject framework does not handle new MySQL reserved keywords

Steps to reproduce the bug.
1. Take any Jira server/DC with following DB setup:
8.0.22-0ubuntu0.20.04.3
MySQL Connector/J mysql-connector-java-8.0.21 (Revision: 33f65445a1bcc544eb0120491926484da168f199)
utf8mb4_bin
All these are btw supported on your web
2. Install SoftComply Risk Manager app and you will see errors in log:
2021-01-18 17:50:08,807+0000 active-objects-init-JiraTenantImpl{id=‘system’}-0 ERROR CStichweh [n.java.ao.sql] Exception executing SQL update <CREATE TABLE AO_0EF072_RMCELL_AO (
COLUMN INTEGER,
ID INTEGER AUTO_INCREMENT NOT NULL,
RISK_CLASS_ID INTEGER,
RISK_MATRIX_ID INTEGER,
ROW INTEGER,
CONSTRAINT fk_ao_0ef072_rmcell_ao_risk_class_id FOREIGN KEY (RISK_CLASS_ID) REFERENCES AO_0EF072_RISK_CLASS_AO(ID),
CONSTRAINT fk_ao_0ef072_rmcell_ao_risk_matrix_id FOREIGN KEY (RISK_MATRIX_ID) REFERENCES AO_0EF072_RISK_MATRIX_AO(ID),
PRIMARY KEY(ID)
) ENGINE=InnoDB>
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ROW INTEGER,
CONSTRAINT fk_ao_0ef072_rmcell_ao_risk_class_id FOREIGN KEY (RI’ at line 6

We have a table with column names “ROW” and “COLUMN”. Both are reserved keywords in MySQL and should be handled properly (i.e. escaped). Now COLUMN is reserved word for a long time, but ROW is reserved only recently (https://dev.mysql.com/doc/refman/8.0/en/keywords.html)

Now if the Atlassian framework creates table, it first created SQL from our Java object, and then executes it. What happens now is that the SQL is generated with not the latest information.

You can see below that on line 2 the COLUMN is handled properly, but on line 6 ROW is not surrounded with quotes. And that causes error.

Expected Result
App works and reserved keywords are escaped properly by AO framework

Actual Result
Error in SQL

1 Like

Hello!
Were you able to find a solution to this? I am facing the same problem.

1 Like

We are still looking for a solution here . There is no update in [AO-3607] - Ecosystem Jira either

1 Like