Can you look at this databse log and give some hints how to solve this problem with the database seemingly entering recovery mode where certain DML statements are run, while accepting other DMLs? Here is the log: 
2023-03-20 13:19:00.301 CET [26090] LOG:  all server processes terminated; reinitializing 
2023-03-20 13:19:01.140 CET [14011] LOG:  database system was interrupted; last known up at 2023-03-20 13:06:19 CET 
2023-03-20 13:19:12.723 CET [14011] LOG:  database system was not properly shut down; automatic recovery in progress 
2023-03-20 13:19:12.793 CET [14011] LOG:  redo starts at 5BC/FC2C8B00 
2023-03-20 13:19:12.793 CET [14011] LOG:  invalid record length at 5BC/FC2C8BE8: wanted 24, got 0 
2023-03-20 13:19:12.793 CET [14011] LOG:  redo done at 5BC/FC2C8BB0 
2023-03-20 13:19:14.359 CET [26090] LOG:  database system is ready to accept connections 
2023-03-20 13:21:11.446 CET [26090] LOG:  server process (PID 14352) was terminated by signal 9: Killed 
2023-03-20 13:21:11.446 CET [26090] DETAIL:  Failed process was running: with datum as (select to_char(skol_god_datum_pocetak,'yyyymm')::int dat_poc , least(to_char(skol_god_datum_kraj , 'yyyymm')::int , to_char
(current_date,'yyyymm')::int) dat_kraj from dwh_foundation.fnd_skolska_godina where skol_god_default_odabir = 1 ) select calendar_month_code,fnc_sync_fct_student_grade(calendar_month_code) from dwh_target.dim_da
te , datum where dimension_key = calendar_month_id and calendar_month_code between dat_poc and dat_kraj order by 1 
2023-03-20 13:21:11.453 CET [26090] LOG:  terminating any other active server processes 
2023-03-20 13:21:11.453 CET [14059] WARNING:  terminating connection because of crash of another server process 
2023-03-20 13:21:11.453 CET [14059] DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupte
d shared memory. 
2023-03-20 13:21:11.453 CET [14059] HINT:  In a moment you should be able to reconnect to the database and repeat your command. 
2023-03-20 13:21:11.616 CET [26090] LOG:  all server processes terminated; reinitializing 
2023-03-20 13:21:11.865 CET [14636] LOG:  database system was interrupted; last known up at 2023-03-20 13:19:14 CET 
2023-03-20 13:21:11.908 CET [14638] mig@testdb FATAL:  the database system is in recovery mode 
2023-03-20 13:21:12.054 CET [14639] mig@testdb FATAL:  the database system is in recovery mode 
2023-03-20 13:21:12.180 CET [14640] mig@testdb FATAL:  the database system is in reco In your response, capitalize a few words to stress main points. Please limit the number of words with all capital letters to less than 5.
user