Here is my code as part of a WHERE clause:
AND (
NOT ignoredwp
OR NOT EXISTS (
SELECT 1
FROM filtering f
WHERE f."IMEI" = cp.imei
AND f.date = cp."generatedAt"::date
)
)
ignoredwp is a boolean parameter. Am I right in saying that if ignoredwp is true, only then the rest of the “OR NOT EXISTS” part will be evaluated? Basically, I want to only execute the NOT EXISTS check when the parameter is true.