I noticed that SOQL with ORDER BY and NULLS LAST ASC returns results in wrong order (especially when I order by field from relationship). I wonder if it is some kind of bug or I've done some mistake in my query syntax?
Following Example:
List<PermissionSet> permSets = [
SELECT
Name,
Label,
Id,
Description,
License.Name,
LastModifiedDate,
LastModifiedBy.Name
FROM
PermissionSet
ORDER BY License.Name ASC NULLS LAST LIMIT 100
];
for (PermissionSet permSet : permSets) {
System.debug(permSet.License.Name + ' ' + permSet.License);
}
Return following results: