SQL exception during install

You’ll encounter an SQL error once you downgrade to an older version. This also happens if the database does not contain any version information. Installing the latest version will cause the SQL error because the installer tries to create database structures which are already there. You can fix this by changing the schema version in the database manually.

Use this query to find out the current version:

select *
from #__schemas
where extension_id in (
    select extension_id
    from #__extensions
    where element = 'com_eventgallery'

It should match the latest version you had installed.

Figure 9.3. Check the current version for com_eventgallery in the database.

database 02

Figure 9.4. Find the current version for com_eventgallery in the database manually.

database 04

Use this query to update the schema version:

update #__schemas
set version_id='5.2.3_2024-03-03'
where extension_id in (
  select extension_id
  from #__extensions
  where element = 'com_eventgallery'

Once you did this you can install the latest version again.


Don’t forget to replace \#__ with your current database prefix. You can find the prefix in your configuration.php file.

Figure 9.5. Find the database prefix.

database 01

Joomla performs database updates by comparing the file names of some SQL files against each other. The name of the latest version is stored in the database. You can find those SQL files in [path]_administrator/components/com_eventgallery/sql/updates/mysql _. Instead of using the value for the column version_id in the SQL statement above you can try to use the file names in this folder as version numbers. You’ll see file names like "3.3.0, 3.4.0, 3.4.0_2015-04-14". Try to repeat the following steps until the installation finished successfully. Start with the oldest version number. That’s usually the version you had installed before.

  1. Update the \#_schema table to a specific version like 3.4.0_2015-04-14. Always start with the oldest version! use the SQL statement above to do that.
  2. Install the whole package using the Joomla! Extension Manager.
  3. If you see an SQL error continue with step 1.

In case the query above does not work because it does not return any result, you need to insert a new row into the database.

Figure 9.6. Query result in case the database version is missing.

database 03

You can use this code:

insert into #_schemas (extension_id, version_id)
select extension_id, '1.0.0'
from #_extensions
where element = 'com_eventgallery'

Figure 9.7. Execute the insert statement.

database 05

Starting with Event Gallery 3.7.8 you can fix missing version information using the System Check page. If the version information is missing in the database, you just need to click the fix link on that page to add it. You can now install the update.

All prices include VAT. The gross price will vary depending on the selected shipping country.