I'm running Postgres, and have to deal with some quite long rule sets to do data quality checks.

At the moment, these are in my query the usual way like this:

case when (var1 = 0) then '1'
   when (var2 = 0) then '2'
   when (var3 != 2) then 'X' 
else '0' end

The issue is that some rule sets are already quite long, and probably will be extended in not so far away future.

My idea was now to investigate if it is possible to now have something of a meta query, and put the query conditions and results into an own table.

So that it is possible to do something like this in my query instead (now pseudo code)

run checks based on conditions in table and deliver the defined results

So that if I need some new checks or return values, I can just edit the new table instead and don't have to edit my query instead.

Is something like that possible? If so, I'd be happy to get some pointers into the right direction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.