Type: Regression Bug
Affects Version/s: 7.2.X, 7.3.X, Master
Component/s: Database Upgrade Framework
This regression is caused by
LPS-118989, see its change here:
The UpgradeResourcePermission._updatePrimKeyIdsByName method populates the primKeyId.
- When primKeysArray is empty, the values are correctly populated by the first and second sql updates.
- But in case primKeysArray is not empty, it is executing the third and fourth sql updates, but the fourth sql update won't update any record as it condition is incorrect for NULL values: https://github.com/liferay/liferay-portal/blob/cc5ccd2a3e82780cc87de95c93973ee585d632ab/portal-impl/src/com/liferay/portal/upgrade/v7_0_0/UpgradeResourcePermission.java#L175
To fix this issue we have to replace primKeyId != 0 with primKeyId IS NULL
This problem is only produced in case you have a primKey value that:
- It is equal to zero
- It is not numeric but it is not a %_ LAYOUT_ % value either.
Steps to reproduce
- Install a new Liferay Portal 6.2 in a clean database
- Execute this insert to force the primKeysArray is populated during the upgrade:
- Upgrade from 6.2 to 7.2, 7.3 or master
- Execute this SQL:
- : the query doesn't return anything
- : the query returns all the com.liferay.portal.kernel.model.Role entries as the primKeyId wasn't correctly populated
(note: during the upgrade, the com.liferay.portal.model.Role entries are renamed to com.liferay.portal.kernel.model.Role)