postgresql – Database system is in recovery mode: Segmentation fault

PostgreSQL version : 12.4

Server: RHEL 7.9

I got postgres server into recovery mode for a minute and then came back normal.

Looking into logs, found this error before it went to recovery mode:

db=,user= LOG:  server process (PID 4321) was terminated by signal 11: Segmentation fault
db=,user= DETAIL:  Failed process was running: select distinct some_col.some_state_id,case when some_col.some_state_id=99 then 'CENTRAL' else state.state_name_english end as stateNm,case when some_col.some_state_id=99 then 'AAA' else state.state_name_english end from xema.table_name_definition_mast defn_mast left join othe.get_state_list_fn() state on some_col.some_state_id=state.state_code where defn_mast.third_srvc_launch ='Y' and some_col.some_state_id < 100 order by 3

I doubt if this issue will come up again. Is this query specific or hardware problem? Got stuck.