Bug: NRQL does not compare version strings correctly

We use New Relic mobile and its often useful to be able to run queries on data based on our current app version, which follows semantic versioning.

I recently discovered that version comparisons in NRQL seemed to work as expected, comparing the strings numerically, e.g.: given a MobileSession with an NRQL query of WHERE appVersion < '2.4.0' would correctly return sessions with app versions like 2.3.0, 2.2.5 etc. but not 2.4.1 or 2.5.0 for example.

Unfortunately this stops working once the minor version reaches double digits - we’re about to ship a 2.10.0 version and running the above query will include 2.10.0 in its results even though this version is higher than 2.4.0.

Ideally the comparison operators would compare version strings according to semver rules - if this isn’t possible it would be really useful to have a semver version of these operators that did work this way.

Hi @lredpath - I think that REGEX filtering will provide you a method to achieve your requirement. No direct link but it is on the page below.

https://docs.newrelic.com/docs/query-your-data/nrql-new-relic-query-language/get-started/nrql-syntax-clauses-functions/

Thanks for the suggestion. Maybe my regular expression skills are a bit rusty but I’m not sure how I’d match for a specific major, minor or tiny version up to a certain limit (e.g. x.y.z where y >= 0 and <= 10). Either way, it would still be nice if the existing version comparison behaviour just respected semver rather than just half-working.