Skip to content

Commit c570a60

Browse files
authored
Merge pull request #221 from LabKey/fb_merge_24.7_to_develop
Merge discvr-24.7 to develop
2 parents 18c629c + 5348f01 commit c570a60

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

LDK/api-src/org/labkey/api/ldk/table/ContainerScopedTable.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,17 @@ protected Map<String, Object> updateRow(User user, Container container, Map<Stri
204204
Object oldValue = oldRow.get(_pseudoPk);
205205
Object newValue = row.get(_pseudoPk);
206206

207-
if (oldRow != null && newValue != null && !oldValue.equals(newValue) && _keyManager.rowExists(container, newValue))
208-
throw new ValidationException("There is already a record where " + _pseudoPk + " equals " + newValue);
207+
if (newValue != null && !oldValue.equals(newValue) && _keyManager.rowExists(container, newValue))
208+
{
209+
if (!getSqlDialect().isCaseSensitive() & String.valueOf(newValue).equalsIgnoreCase(String.valueOf(oldValue)) & !String.valueOf(newValue).equals(String.valueOf(oldValue)))
210+
{
211+
// Changing case of the PK is allowable. If the DB is case-insensitive, then our DB test should tell us if this would create a violation
212+
}
213+
else
214+
{
215+
throw new ValidationException("There is already a record where " + _pseudoPk + " equals " + newValue);
216+
}
217+
}
209218

210219
return super.updateRow(user, container, row, oldRow, configParameters);
211220
}

0 commit comments

Comments
 (0)