No Code Attached Yet
avatar Weiskopfseeadler
Weiskopfseeadler
7 Apr 2025

Steps to reproduce the issue

Add a update sql File in a Component and use SQL: ADD COLUMN IF NOT EXISTS column_name
Install and go to the Maintenance: Database View

Expected result

Database is reportet to have no Problems

Actual result

I shows that there is a problem in the Database
ERROR Mesage:
One Problem
Table 'prefix_tablename' does not have column 'IF'. (From file x.x.x-XXXX-XX-XX.sql)
Table 'prefix_tablename' does not have index 'IF'. (From file x.x.x-XXXX-XX-XX.sql)
1 database changes were checked.
1 database changes did not alter table structure and were skipped.

System information (as much as possible)

Joomla 5.2.5
PHP 8.2

Additional comments

avatar Weiskopfseeadler Weiskopfseeadler - open - 7 Apr 2025
avatar joomla-cms-bot joomla-cms-bot - change - 7 Apr 2025
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 7 Apr 2025
avatar brianteeman
brianteeman - comment - 7 Apr 2025

To the best of my knowledge MySQL does not have a direct IF NOT EXISTS clause for ADD COLUMN.

avatar richard67
richard67 - comment - 7 Apr 2025

To the best of my knowledge MySQL does not have a direct IF NOT EXISTS clause for ADD COLUMN.

Confirmed. Only MariaDB has that. MySQL doesn't have it, see https://dev.mysql.com/doc/refman/8.4/en/alter-table.html .

@Weiskopfseeadler As the CMS core has to work with MariaDB and MySQL, it does not use that MariaDB specific syntax, and your component should do the same.

If you agree, please close the issue.

avatar richard67 richard67 - change - 8 Apr 2025
Status New Closed
Closed_Date 0000-00-00 00:00:00 2025-04-08 13:13:33
Closed_By richard67
avatar richard67 richard67 - close - 8 Apr 2025
avatar richard67
richard67 - comment - 8 Apr 2025

@Weiskopfseeadler See also this older, closed issue: #39333 .

As stated there, you can use the /** CAN FAIL **/ installer hint: #39333 (comment)

Closing as expected behaviour.

Add a Comment

Login with GitHub to post a comment