I've just encountered a weird behaviour of SOQL and I wonder if it's a bug or maybe some feature I do not understand: looks like the compiler lets you add an incorrect LIMIT
clause - LIMIT1
for example - and does not indicate any issues with that. It also doesn't limit the query actually.
Following queries: SELECT Id FROM User LIMIT1
, SELECT Id FROM User LIMIT43
both result in below:
Any ideas if there's a reason behind this behaviour?
EDIT: turns out the compiler ignores any word added to the end of the query, e.g. SELECT Id FROM User FSAETGSRFESA
LIMIT 1
? Give one space in between theLIMIT
keyword and thenumberOfRows
. If you have run the query in developer console then first remove the result and try the LIMT<Space>numberOfRows.SELECT Id FROM User LIMIT 1