Hey everyone,
I am currently working with some of my teacher's old Postgres SQL code and modifying it to match what I need. However, there is one piece of code that I can't seem to find an explanation of anywhere online. In the code he had a case statement with a ~~* used as what looked like a comparison. I am unfamiliar with this syntax and would greatly appreciate any help. Thanks in advance.
CASE
WHEN sessions.status ~~* 'data%finder%'::text THEN ((sessions.minutes_in_data_ || ' ('::text) || sessions.minutes_in_idle) || ')'::text
WHEN sessions.status ~~* 'text%edit%'::text THEN ((sessions.minutes_in_text_editor || ' ('::text) || sessions.minutes_in_idle) || ')'::text
WHEN sessions.status ~~* 'admin%module%'::text AND sessions.minutes_in_module<> 0 THEN ((sessions.minutes_in_module|| ' ('::text) || sessions.minutes_in_idle) || ')'::text
WHEN sessions.status ~~* 'client%module%'::text AND sessions.minutes_in_module<> 0 THEN ((sessions.minutes_in_module|| ' ('::text) || sessions.minutes_in_idle) || ')'::text
ELSE NULL::text
END AS "Duration (Idle)",