[ {"PLpgSQL_function":{"datums":[{"PLpgSQL_var":{"refname":"found","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"r","lineno":3,"datatype":{"PLpgSQL_type":{"typname":"foo%rowtype"}}}},{"PLpgSQL_row":{"refname":"(unnamed row)","lineno":5,"fields":[{"name":"r","varno":1}]}}],"action":{"PLpgSQL_stmt_block":{"lineno":4,"body":[{"PLpgSQL_stmt_fors":{"lineno":5,"var":{"PLpgSQL_row":{"refname":"(unnamed row)","lineno":5,"fields":[{"name":"r","varno":1}]}},"body":[{"PLpgSQL_stmt_return_next":{"lineno":9}}],"query":{"PLpgSQL_expr":{"query":"SELECT * FROM foo WHERE fooid \u003e 0","parseMode":0}}}},{"PLpgSQL_stmt_return":{"lineno":11}}]}}}}, {"PLpgSQL_function":{"datums":[{"PLpgSQL_var":{"refname":"found","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}}],"action":{"PLpgSQL_stmt_block":{"lineno":2,"body":[{"PLpgSQL_stmt_return_query":{"lineno":3,"query":{"PLpgSQL_expr":{"query":"SELECT flightid\n FROM flight\n WHERE flightdate \u003e= $1\n AND flightdate \u003c ($1 + 1)","parseMode":0}}}},{"PLpgSQL_stmt_if":{"lineno":10,"cond":{"PLpgSQL_expr":{"query":"NOT FOUND","parseMode":2}},"then_body":[{"PLpgSQL_stmt_raise":{"lineno":11,"elog_level":21,"message":"No flight at %.","params":[{"PLpgSQL_expr":{"query":"$1","parseMode":2}}]}}]}},{"PLpgSQL_stmt_return":{"lineno":14}}]}}}}, {"PLpgSQL_function":{"datums":[{"PLpgSQL_var":{"refname":"v_name","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"v_version","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"found","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}}],"action":{"PLpgSQL_stmt_block":{"lineno":2,"body":[{"PLpgSQL_stmt_if":{"lineno":3,"cond":{"PLpgSQL_expr":{"query":"v_version IS NULL","parseMode":2}},"then_body":[{"PLpgSQL_stmt_return":{"lineno":4,"expr":{"PLpgSQL_expr":{"query":"v_name","parseMode":2}}}}]}},{"PLpgSQL_stmt_return":{"lineno":6,"expr":{"PLpgSQL_expr":{"query":"v_name || '/' || v_version","parseMode":2}}}}]}}}}, {"PLpgSQL_function":{"datums":[{"PLpgSQL_var":{"refname":"v_job_id","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"found","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"a_running_job_count","lineno":3,"datatype":{"PLpgSQL_type":{"typname":"integer"}}}},{"PLpgSQL_row":{"refname":"(unnamed row)","lineno":7,"fields":[{"name":"a_running_job_count","varno":2}]}},{"PLpgSQL_var":{"refname":"sqlstate","lineno":18,"datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}},"isconst":true}},{"PLpgSQL_var":{"refname":"sqlerrm","lineno":18,"datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}},"isconst":true}}],"action":{"PLpgSQL_stmt_block":{"lineno":4,"body":[{"PLpgSQL_stmt_execsql":{"lineno":5,"sqlstmt":{"PLpgSQL_expr":{"query":"LOCK TABLE cs_jobs IN EXCLUSIVE MODE","parseMode":0}}}},{"PLpgSQL_stmt_execsql":{"lineno":7,"sqlstmt":{"PLpgSQL_expr":{"query":"SELECT count(*) FROM cs_jobs WHERE end_stamp IS NULL","parseMode":0}},"into":true,"target":{"PLpgSQL_row":{"refname":"(unnamed row)","lineno":7,"fields":[{"name":"a_running_job_count","varno":2}]}}}},{"PLpgSQL_stmt_if":{"lineno":9,"cond":{"PLpgSQL_expr":{"query":"a_running_job_count \u003e 0","parseMode":2}},"then_body":[{"PLpgSQL_stmt_raise":{"lineno":10,"elog_level":21,"message":"Unable to create a new job: a job is currently running"}}]}},{"PLpgSQL_stmt_execsql":{"lineno":13,"sqlstmt":{"PLpgSQL_expr":{"query":"DELETE FROM cs_active_job","parseMode":0}}}},{"PLpgSQL_stmt_execsql":{"lineno":14,"sqlstmt":{"PLpgSQL_expr":{"query":"INSERT INTO cs_active_job(job_id) VALUES (v_job_id)","parseMode":0}}}},{"PLpgSQL_stmt_block":{"lineno":16,"body":[{"PLpgSQL_stmt_execsql":{"lineno":17,"sqlstmt":{"PLpgSQL_expr":{"query":"INSERT INTO cs_jobs (job_id, start_stamp) VALUES (v_job_id, now())","parseMode":0}}}}],"exceptions":{"PLpgSQL_exception_block":{"exc_list":[{"PLpgSQL_exception":{"conditions":[{"PLpgSQL_condition":{"condname":"unique_violation"}}]}}]}}}},{"PLpgSQL_stmt_return":{}}]}}}}, {"PLpgSQL_function":{"datums":[{"PLpgSQL_var":{"refname":"found","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"pos","lineno":3,"datatype":{"PLpgSQL_type":{"typname":"integer"}}}}],"action":{"PLpgSQL_stmt_block":{"lineno":4,"body":[{"PLpgSQL_stmt_assign":{"lineno":5,"varno":1,"expr":{"PLpgSQL_expr":{"query":"pos:= instr($1, $2, 1)","parseMode":3}}}},{"PLpgSQL_stmt_return":{"lineno":6,"expr":{"PLpgSQL_expr":{"query":"pos","parseMode":2}}}}]}}}}, {"PLpgSQL_function":{"datums":[{"PLpgSQL_var":{"refname":"string","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"string_to_search","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"beg_index","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"found","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"pos","lineno":3,"datatype":{"PLpgSQL_type":{"typname":"integer "}},"notnull":true,"default_val":{"PLpgSQL_expr":{"query":"0","parseMode":2}}}},{"PLpgSQL_var":{"refname":"temp_str","lineno":4,"datatype":{"PLpgSQL_type":{"typname":"varchar"}}}},{"PLpgSQL_var":{"refname":"beg","lineno":5,"datatype":{"PLpgSQL_type":{"typname":"integer"}}}},{"PLpgSQL_var":{"refname":"length","lineno":6,"datatype":{"PLpgSQL_type":{"typname":"integer"}}}},{"PLpgSQL_var":{"refname":"ss_length","lineno":7,"datatype":{"PLpgSQL_type":{"typname":"integer"}}}}],"action":{"PLpgSQL_stmt_block":{"lineno":8,"body":[{"PLpgSQL_stmt_if":{"lineno":9,"cond":{"PLpgSQL_expr":{"query":"beg_index \u003e 0","parseMode":2}},"then_body":[{"PLpgSQL_stmt_assign":{"lineno":10,"varno":5,"expr":{"PLpgSQL_expr":{"query":"temp_str := substring(string FROM beg_index)","parseMode":3}}}},{"PLpgSQL_stmt_assign":{"lineno":11,"varno":4,"expr":{"PLpgSQL_expr":{"query":"pos := position(string_to_search IN temp_str)","parseMode":3}}}},{"PLpgSQL_stmt_if":{"lineno":13,"cond":{"PLpgSQL_expr":{"query":"pos = 0","parseMode":2}},"then_body":[{"PLpgSQL_stmt_return":{"lineno":14,"expr":{"PLpgSQL_expr":{"query":"0","parseMode":2}}}}],"else_body":[{"PLpgSQL_stmt_return":{"lineno":16,"expr":{"PLpgSQL_expr":{"query":"pos + beg_index - 1","parseMode":2}}}}]}}],"elsif_list":[{"PLpgSQL_if_elsif":{"lineno":18,"cond":{"PLpgSQL_expr":{"query":"beg_index \u003c 0","parseMode":2}},"stmts":[{"PLpgSQL_stmt_assign":{"lineno":19,"varno":8,"expr":{"PLpgSQL_expr":{"query":"ss_length := char_length(string_to_search)","parseMode":3}}}},{"PLpgSQL_stmt_assign":{"lineno":20,"varno":7,"expr":{"PLpgSQL_expr":{"query":"length := char_length(string)","parseMode":3}}}},{"PLpgSQL_stmt_assign":{"lineno":21,"varno":6,"expr":{"PLpgSQL_expr":{"query":"beg := length + beg_index - ss_length + 2","parseMode":3}}}},{"PLpgSQL_stmt_while":{"lineno":23,"cond":{"PLpgSQL_expr":{"query":"beg \u003e 0","parseMode":2}},"body":[{"PLpgSQL_stmt_assign":{"lineno":24,"varno":5,"expr":{"PLpgSQL_expr":{"query":"temp_str := substring(string FROM beg FOR ss_length)","parseMode":3}}}},{"PLpgSQL_stmt_assign":{"lineno":25,"varno":4,"expr":{"PLpgSQL_expr":{"query":"pos := position(string_to_search IN temp_str)","parseMode":3}}}},{"PLpgSQL_stmt_if":{"lineno":27,"cond":{"PLpgSQL_expr":{"query":"pos \u003e 0","parseMode":2}},"then_body":[{"PLpgSQL_stmt_return":{"lineno":28,"expr":{"PLpgSQL_expr":{"query":"beg","parseMode":2}}}}]}},{"PLpgSQL_stmt_assign":{"lineno":31,"varno":6,"expr":{"PLpgSQL_expr":{"query":"beg := beg - 1","parseMode":3}}}}]}},{"PLpgSQL_stmt_return":{"lineno":34,"expr":{"PLpgSQL_expr":{"query":"0","parseMode":2}}}}]}}],"else_body":[{"PLpgSQL_stmt_return":{"lineno":36,"expr":{"PLpgSQL_expr":{"query":"0","parseMode":2}}}}]}},{"PLpgSQL_stmt_return":{}}]}}}}, {"PLpgSQL_function":{"datums":[{"PLpgSQL_var":{"refname":"string","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"string_to_search","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"beg_index","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"occur_index","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"found","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"pos","lineno":3,"datatype":{"PLpgSQL_type":{"typname":"integer "}},"notnull":true,"default_val":{"PLpgSQL_expr":{"query":"0","parseMode":2}}}},{"PLpgSQL_var":{"refname":"occur_number","lineno":4,"datatype":{"PLpgSQL_type":{"typname":"integer "}},"notnull":true,"default_val":{"PLpgSQL_expr":{"query":"0","parseMode":2}}}},{"PLpgSQL_var":{"refname":"temp_str","lineno":5,"datatype":{"PLpgSQL_type":{"typname":"varchar"}}}},{"PLpgSQL_var":{"refname":"beg","lineno":6,"datatype":{"PLpgSQL_type":{"typname":"integer"}}}},{"PLpgSQL_var":{"refname":"i","lineno":7,"datatype":{"PLpgSQL_type":{"typname":"integer"}}}},{"PLpgSQL_var":{"refname":"length","lineno":8,"datatype":{"PLpgSQL_type":{"typname":"integer"}}}},{"PLpgSQL_var":{"refname":"ss_length","lineno":9,"datatype":{"PLpgSQL_type":{"typname":"integer"}}}},{"PLpgSQL_var":{"refname":"i","lineno":15,"datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}}],"action":{"PLpgSQL_stmt_block":{"lineno":10,"body":[{"PLpgSQL_stmt_if":{"lineno":11,"cond":{"PLpgSQL_expr":{"query":"beg_index \u003e 0","parseMode":2}},"then_body":[{"PLpgSQL_stmt_assign":{"lineno":12,"varno":8,"expr":{"PLpgSQL_expr":{"query":"beg := beg_index","parseMode":3}}}},{"PLpgSQL_stmt_assign":{"lineno":13,"varno":7,"expr":{"PLpgSQL_expr":{"query":"temp_str := substring(string FROM beg_index)","parseMode":3}}}},{"PLpgSQL_stmt_fori":{"lineno":15,"var":{"PLpgSQL_var":{"refname":"i","lineno":15,"datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},"lower":{"PLpgSQL_expr":{"query":"1","parseMode":2}},"upper":{"PLpgSQL_expr":{"query":"occur_index","parseMode":2}},"body":[{"PLpgSQL_stmt_assign":{"lineno":16,"varno":5,"expr":{"PLpgSQL_expr":{"query":"pos := position(string_to_search IN temp_str)","parseMode":3}}}},{"PLpgSQL_stmt_if":{"lineno":18,"cond":{"PLpgSQL_expr":{"query":"i = 1","parseMode":2}},"then_body":[{"PLpgSQL_stmt_assign":{"lineno":19,"varno":8,"expr":{"PLpgSQL_expr":{"query":"beg := beg + pos - 1","parseMode":3}}}}],"else_body":[{"PLpgSQL_stmt_assign":{"lineno":21,"varno":8,"expr":{"PLpgSQL_expr":{"query":"beg := beg + pos","parseMode":3}}}}]}},{"PLpgSQL_stmt_assign":{"lineno":24,"varno":7,"expr":{"PLpgSQL_expr":{"query":"temp_str := substring(string FROM beg + 1)","parseMode":3}}}}]}},{"PLpgSQL_stmt_if":{"lineno":27,"cond":{"PLpgSQL_expr":{"query":"pos = 0","parseMode":2}},"then_body":[{"PLpgSQL_stmt_return":{"lineno":28,"expr":{"PLpgSQL_expr":{"query":"0","parseMode":2}}}}],"else_body":[{"PLpgSQL_stmt_return":{"lineno":30,"expr":{"PLpgSQL_expr":{"query":"beg","parseMode":2}}}}]}}],"elsif_list":[{"PLpgSQL_if_elsif":{"lineno":32,"cond":{"PLpgSQL_expr":{"query":"beg_index \u003c 0","parseMode":2}},"stmts":[{"PLpgSQL_stmt_assign":{"lineno":33,"varno":11,"expr":{"PLpgSQL_expr":{"query":"ss_length := char_length(string_to_search)","parseMode":3}}}},{"PLpgSQL_stmt_assign":{"lineno":34,"varno":10,"expr":{"PLpgSQL_expr":{"query":"length := char_length(string)","parseMode":3}}}},{"PLpgSQL_stmt_assign":{"lineno":35,"varno":8,"expr":{"PLpgSQL_expr":{"query":"beg := length + beg_index - ss_length + 2","parseMode":3}}}},{"PLpgSQL_stmt_while":{"lineno":37,"cond":{"PLpgSQL_expr":{"query":"beg \u003e 0","parseMode":2}},"body":[{"PLpgSQL_stmt_assign":{"lineno":38,"varno":7,"expr":{"PLpgSQL_expr":{"query":"temp_str := substring(string FROM beg FOR ss_length)","parseMode":3}}}},{"PLpgSQL_stmt_assign":{"lineno":39,"varno":5,"expr":{"PLpgSQL_expr":{"query":"pos := position(string_to_search IN temp_str)","parseMode":3}}}},{"PLpgSQL_stmt_if":{"lineno":41,"cond":{"PLpgSQL_expr":{"query":"pos \u003e 0","parseMode":2}},"then_body":[{"PLpgSQL_stmt_assign":{"lineno":42,"varno":6,"expr":{"PLpgSQL_expr":{"query":"occur_number := occur_number + 1","parseMode":3}}}},{"PLpgSQL_stmt_if":{"lineno":44,"cond":{"PLpgSQL_expr":{"query":"occur_number = occur_index","parseMode":2}},"then_body":[{"PLpgSQL_stmt_return":{"lineno":45,"expr":{"PLpgSQL_expr":{"query":"beg","parseMode":2}}}}]}}]}},{"PLpgSQL_stmt_assign":{"lineno":49,"varno":8,"expr":{"PLpgSQL_expr":{"query":"beg := beg - 1","parseMode":3}}}}]}},{"PLpgSQL_stmt_return":{"lineno":52,"expr":{"PLpgSQL_expr":{"query":"0","parseMode":2}}}}]}}],"else_body":[{"PLpgSQL_stmt_return":{"lineno":54,"expr":{"PLpgSQL_expr":{"query":"0","parseMode":2}}}}]}},{"PLpgSQL_stmt_return":{}}]}}}}, {"PLpgSQL_function":{"datums":[{"PLpgSQL_var":{"refname":"enddate","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"canceled","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"found","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}}],"action":{"PLpgSQL_stmt_block":{"lineno":1,"body":[{"PLpgSQL_stmt_if":{"lineno":2,"cond":{"PLpgSQL_expr":{"query":"canceled = true","parseMode":2}},"then_body":[{"PLpgSQL_stmt_return":{"lineno":3,"expr":{"PLpgSQL_expr":{"query":"null","parseMode":2}}}}],"else_body":[{"PLpgSQL_stmt_return":{"lineno":5,"expr":{"PLpgSQL_expr":{"query":"endDate","parseMode":2}}}}]}},{"PLpgSQL_stmt_return":{}}]}}}}, {"PLpgSQL_function":{"datums":[{"PLpgSQL_var":{"refname":"date_inscription","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"date_observation","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"found","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}}],"action":{"PLpgSQL_stmt_block":{"lineno":1,"body":[{"PLpgSQL_stmt_return":{"lineno":2,"expr":{"PLpgSQL_expr":{"query":"(calcule_duree(date_inscription,date_observation) + 1)","parseMode":2}}}}]}}}}, {"PLpgSQL_function":{"datums":[{"PLpgSQL_var":{"refname":"origine","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"atdate","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"found","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"theday","lineno":2,"datatype":{"PLpgSQL_type":{"typname":"INTEGER"}}}},{"PLpgSQL_var":{"refname":"themonth","lineno":3,"datatype":{"PLpgSQL_type":{"typname":"INTEGER"}}}},{"PLpgSQL_var":{"refname":"theyear","lineno":4,"datatype":{"PLpgSQL_type":{"typname":"INTEGER"}}}},{"PLpgSQL_var":{"refname":"theday_now","lineno":5,"datatype":{"PLpgSQL_type":{"typname":"INTEGER"}}}},{"PLpgSQL_var":{"refname":"themonth_now","lineno":6,"datatype":{"PLpgSQL_type":{"typname":"INTEGER"}}}},{"PLpgSQL_var":{"refname":"theyear_now","lineno":7,"datatype":{"PLpgSQL_type":{"typname":"INTEGER"}}}}],"action":{"PLpgSQL_stmt_block":{"lineno":8,"body":[{"PLpgSQL_stmt_assign":{"lineno":9,"varno":3,"expr":{"PLpgSQL_expr":{"query":"theDay := EXTRACT(DAY FROM origine)","parseMode":3}}}},{"PLpgSQL_stmt_assign":{"lineno":10,"varno":4,"expr":{"PLpgSQL_expr":{"query":"theMonth := EXTRACT(MONTH FROM origine)","parseMode":3}}}},{"PLpgSQL_stmt_assign":{"lineno":11,"varno":5,"expr":{"PLpgSQL_expr":{"query":"theYear := EXTRACT(YEAR FROM origine)","parseMode":3}}}},{"PLpgSQL_stmt_assign":{"lineno":13,"varno":6,"expr":{"PLpgSQL_expr":{"query":"theDay_now := EXTRACT(DAY FROM atDate)","parseMode":3}}}},{"PLpgSQL_stmt_assign":{"lineno":14,"varno":7,"expr":{"PLpgSQL_expr":{"query":"theMonth_now := EXTRACT(MONTH FROM atDate)","parseMode":3}}}},{"PLpgSQL_stmt_assign":{"lineno":15,"varno":8,"expr":{"PLpgSQL_expr":{"query":"theYear_now := EXTRACT(YEAR FROM atDate)","parseMode":3}}}},{"PLpgSQL_stmt_assign":{"lineno":17,"varno":5,"expr":{"PLpgSQL_expr":{"query":"theYear := theYear_now - theYear","parseMode":3}}}},{"PLpgSQL_stmt_if":{"lineno":18,"cond":{"PLpgSQL_expr":{"query":"theMonth_now \u003c= theMonth","parseMode":2}},"then_body":[{"PLpgSQL_stmt_if":{"lineno":19,"cond":{"PLpgSQL_expr":{"query":"theMonth = theMonth_now","parseMode":2}},"then_body":[{"PLpgSQL_stmt_if":{"lineno":20,"cond":{"PLpgSQL_expr":{"query":"theDay \u003e theDay_now","parseMode":2}},"then_body":[{"PLpgSQL_stmt_assign":{"lineno":21,"varno":5,"expr":{"PLpgSQL_expr":{"query":"theYear := theYear - 1","parseMode":3}}}}]}}],"else_body":[{"PLpgSQL_stmt_assign":{"lineno":24,"varno":5,"expr":{"PLpgSQL_expr":{"query":"theYear := theYear - 1","parseMode":3}}}}]}}]}},{"PLpgSQL_stmt_return":{"lineno":28,"expr":{"PLpgSQL_expr":{"query":"theYear","parseMode":2}}}}]}}}}, {"PLpgSQL_function":{"datums":[{"PLpgSQL_var":{"refname":"uidmember","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"found","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"memberid","lineno":2,"datatype":{"PLpgSQL_type":{"typname":"int4"}}}},{"PLpgSQL_row":{"refname":"(unnamed row)","lineno":5,"fields":[{"name":"memberid","varno":2}]}}],"action":{"PLpgSQL_stmt_block":{"lineno":4,"body":[{"PLpgSQL_stmt_execsql":{"lineno":5,"sqlstmt":{"PLpgSQL_expr":{"query":"SELECT key FROM\n\t\tmember\n\tWHERE\n\t\tuidmember = uid","parseMode":0}},"into":true,"target":{"PLpgSQL_row":{"refname":"(unnamed row)","lineno":5,"fields":[{"name":"memberid","varno":2}]}}}},{"PLpgSQL_stmt_return":{"lineno":11,"expr":{"PLpgSQL_expr":{"query":"memberID","parseMode":2}}}}]}}}}, {"PLpgSQL_function":{"datums":[{"PLpgSQL_var":{"refname":"memberid","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"jobid","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"jobend","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"found","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_rec":{"refname":"lastjob","dno":4,"lineno":2}},{"PLpgSQL_var":{"refname":"lastemployer","lineno":3,"datatype":{"PLpgSQL_type":{"typname":"record"}}}},{"PLpgSQL_var":{"refname":"updatejob","lineno":4,"datatype":{"PLpgSQL_type":{"typname":"BOOL"}}}},{"PLpgSQL_recfield":{"fieldname":"jobid","recparentno":4}},{"PLpgSQL_row":{"refname":"(unnamed row)","lineno":13,"fields":[{"name":"lastemployer","varno":5}]}}],"action":{"PLpgSQL_stmt_block":{"lineno":5,"body":[{"PLpgSQL_stmt_assign":{"lineno":6,"varno":6,"expr":{"PLpgSQL_expr":{"query":"updateJob := false","parseMode":3}}}},{"PLpgSQL_stmt_execsql":{"lineno":8,"sqlstmt":{"PLpgSQL_expr":{"query":"SELECT * FROM lire_lastJob(memberID) AS (jobID INT,startsupport DATE,jobEnd DATE)","parseMode":0}},"into":true,"target":{"PLpgSQL_rec":{"refname":"lastjob","dno":4,"lineno":2}}}},{"PLpgSQL_stmt_if":{"lineno":9,"cond":{"PLpgSQL_expr":{"query":"lastJob.jobID = jobID","parseMode":2}},"then_body":[{"PLpgSQL_stmt_execsql":{"lineno":10,"sqlstmt":{"PLpgSQL_expr":{"query":"SELECT\n\t\t\tr_perlab.key AS positionHeld,\n\t\t\tr_perlab.endDate AS positionEnd\n\t\t FROM\n\t\t\tr_perlab,\n\t\t\t(SELECT\n\t\t\t\tr_perlab.key_member AS col_memberID,\n\t\t\t\tmax(r_perlab.start) AS startrattachement\n\t\t\tFROM r_perlab\n\t\t\tGROUP BY col_memberID) positions\n\t\tWHERE ((positions.col_memberID = memberID) AND (r_perlab.key_member = positions.col_memberID) AND (r_perlab.start = startrattachement))","parseMode":0}},"into":true,"target":{"PLpgSQL_row":{"refname":"(unnamed row)","lineno":13,"fields":[{"name":"lastemployer","varno":5}]}}}},{"PLpgSQL_stmt_if":{"lineno":23,"cond":{"PLpgSQL_expr":{"query":"lastEmployer.positionHeld IS NOT NULL","parseMode":2}},"then_body":[{"PLpgSQL_stmt_assign":{"lineno":24,"varno":6,"expr":{"PLpgSQL_expr":{"query":"updateJob := true","parseMode":3}}}},{"PLpgSQL_stmt_execsql":{"lineno":25,"sqlstmt":{"PLpgSQL_expr":{"query":"UPDATE r_perlab SET endDate = jobEnd WHERE key = lastEmployer.positionHeld","parseMode":0}}}}]}}]}},{"PLpgSQL_stmt_return":{"lineno":29,"expr":{"PLpgSQL_expr":{"query":"updateJob","parseMode":2}}}}]}}}}, {"PLpgSQL_function":{"datums":[{"PLpgSQL_var":{"refname":"str","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"found","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"spechar","lineno":4,"datatype":{"PLpgSQL_type":{"typname":"VARCHAR[ ] "}},"default_val":{"PLpgSQL_expr":{"query":"ARRAY['à','â','é','è','ê','ë','ï','î','ô','û','ù','À','Â','É','È','Ê','Ë','Ï','Î','ô','û','ù','ç' ]","parseMode":2}}}},{"PLpgSQL_var":{"refname":"lettres","lineno":5,"datatype":{"PLpgSQL_type":{"typname":"VARCHAR[ ] "}},"default_val":{"PLpgSQL_expr":{"query":"ARRAY['a','a','e','e','e','e','i','i','o','u','u','a','a','e','e','e','e','i','i','o','u','u','c' ]","parseMode":2}}}},{"PLpgSQL_var":{"refname":"resultat","lineno":6,"datatype":{"PLpgSQL_type":{"typname":"VARCHAR"}}}},{"PLpgSQL_var":{"refname":"nbrspechar","lineno":7,"datatype":{"PLpgSQL_type":{"typname":"INTEGER "}},"default_val":{"PLpgSQL_expr":{"query":"23","parseMode":2}}}},{"PLpgSQL_var":{"refname":"i","lineno":12,"datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}}],"action":{"PLpgSQL_stmt_block":{"lineno":9,"body":[{"PLpgSQL_stmt_if":{"lineno":10,"cond":{"PLpgSQL_expr":{"query":"(str IS NOT NULL)","parseMode":2}},"then_body":[{"PLpgSQL_stmt_assign":{"lineno":11,"varno":4,"expr":{"PLpgSQL_expr":{"query":"resultat := str","parseMode":3}}}},{"PLpgSQL_stmt_fori":{"lineno":12,"var":{"PLpgSQL_var":{"refname":"i","lineno":12,"datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},"lower":{"PLpgSQL_expr":{"query":"1","parseMode":2}},"upper":{"PLpgSQL_expr":{"query":"nbrspechar","parseMode":2}},"body":[{"PLpgSQL_stmt_assign":{"lineno":13,"varno":4,"expr":{"PLpgSQL_expr":{"query":"resultat := regexp_replace(resultat,spechar[i],lettres[i],'g')","parseMode":3}}}}]}}]}},{"PLpgSQL_stmt_return":{"lineno":16,"expr":{"PLpgSQL_expr":{"query":"resultat","parseMode":2}}}}]}}}}, {"PLpgSQL_function":{"new_varno":1,"old_varno":2,"datums":[{"PLpgSQL_var":{"refname":"found","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_rec":{"refname":"new","dno":1}},{"PLpgSQL_rec":{"refname":"old","dno":2}},{"PLpgSQL_recfield":{"fieldname":"name","recparentno":1}}],"action":{"PLpgSQL_stmt_block":{"lineno":3,"body":[{"PLpgSQL_stmt_assign":{"lineno":4,"varno":3,"expr":{"PLpgSQL_expr":{"query":"NEW.name = upper(cleanString(NEW.name))","parseMode":4}}}},{"PLpgSQL_stmt_return":{"lineno":5,"expr":{"PLpgSQL_expr":{"query":"NEW","parseMode":2}}}}]}}}}, {"PLpgSQL_function":{"new_varno":1,"old_varno":2,"datums":[{"PLpgSQL_var":{"refname":"found","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_rec":{"refname":"new","dno":1}},{"PLpgSQL_rec":{"refname":"old","dno":2}},{"PLpgSQL_recfield":{"fieldname":"key","recparentno":1}}],"action":{"PLpgSQL_stmt_block":{"lineno":2,"body":[{"PLpgSQL_stmt_execsql":{"lineno":3,"sqlstmt":{"PLpgSQL_expr":{"query":"INSERT INTO list(key,date) VALUES(NEW.key,NEW.end)","parseMode":0}}}},{"PLpgSQL_stmt_return":{"lineno":4,"expr":{"PLpgSQL_expr":{"query":"NEW","parseMode":2}}}}]}}}}, {"PLpgSQL_function":{"datums":[{"PLpgSQL_var":{"refname":"p_time_start","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"p_time_end","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"p_time_interval","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"ts","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"arbitrary_return","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"found","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}}],"action":{"PLpgSQL_stmt_block":{"lineno":2,"body":[{"PLpgSQL_stmt_if":{"lineno":6,"cond":{"PLpgSQL_expr":{"query":"p_time_interval IS NULL","parseMode":2}},"then_body":[{"PLpgSQL_stmt_assign":{"lineno":7,"varno":2,"expr":{"PLpgSQL_expr":{"query":"p_time_interval := interval_from_start_end(p_time_start, p_time_end)","parseMode":3}}}}]}},{"PLpgSQL_stmt_return_query":{"lineno":9,"query":{"PLpgSQL_expr":{"query":"SELECT\n bucket_function(p_time_interval, timestamp) AS ts,\n arbitrary_return\n FROM test.some_table\n WHERE\n start \u003e= p_time_start\n AND \"end\" \u003c p_time_end\n GROUP BY 1","parseMode":0}}}},{"PLpgSQL_stmt_return":{}}]}}}}, {"PLpgSQL_function":{"datums":[{"PLpgSQL_var":{"refname":"_result","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"found","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"active_on_to_date","lineno":3,"datatype":{"PLpgSQL_type":{"typname":"uuid[]"}}}}],"action":{"PLpgSQL_stmt_block":{"lineno":4,"body":[{"PLpgSQL_stmt_assign":{"lineno":5,"expr":{"PLpgSQL_expr":{"query":"_result := ARRAY( SELECT some_id FROM some_table)","parseMode":3}}}},{"PLpgSQL_stmt_return":{}}]}}}}, {"PLpgSQL_function":{"datums":[{"PLpgSQL_var":{"refname":"v_name","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"v_version","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"found","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"_a","lineno":3,"datatype":{"PLpgSQL_type":{"typname":"int"}}}}],"action":{"PLpgSQL_stmt_block":{"lineno":5,"body":[{"PLpgSQL_stmt_if":{"lineno":6,"cond":{"PLpgSQL_expr":{"query":"v_version IS NULL","parseMode":2}},"then_body":[{"PLpgSQL_stmt_return":{"lineno":7,"expr":{"PLpgSQL_expr":{"query":"v_name","parseMode":2}}}}]}},{"PLpgSQL_stmt_return":{"lineno":10,"expr":{"PLpgSQL_expr":{"query":"v_name || '/' || v_version","parseMode":2}}}}]}}}}, {"PLpgSQL_function":{"datums":[{"PLpgSQL_var":{"refname":"str","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"found","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_rec":{"refname":"v3","dno":2,"lineno":3}},{"PLpgSQL_var":{"refname":"v4","lineno":4,"datatype":{"PLpgSQL_type":{"typname":"integer"}}}},{"PLpgSQL_recfield":{"fieldname":"c1","recparentno":2}}],"action":{"PLpgSQL_stmt_block":{"lineno":5,"body":[{"PLpgSQL_stmt_execsql":{"lineno":6,"sqlstmt":{"PLpgSQL_expr":{"query":"select 1 as c1, 2 as c2","parseMode":0}},"into":true,"target":{"PLpgSQL_rec":{"refname":"v3","dno":2,"lineno":3}}}},{"PLpgSQL_stmt_assign":{"lineno":7,"varno":4,"expr":{"PLpgSQL_expr":{"query":"v3.c1 := 4","parseMode":4}}}},{"PLpgSQL_stmt_return":{}}]}}}}, {"PLpgSQL_function":{"datums":[{"PLpgSQL_var":{"refname":"found","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}}],"action":{"PLpgSQL_stmt_block":{"lineno":2,"body":[{"PLpgSQL_stmt_assert":{"lineno":3,"cond":{"PLpgSQL_expr":{"query":"true","parseMode":2}}}},{"PLpgSQL_stmt_assert":{"lineno":4,"cond":{"PLpgSQL_expr":{"query":"now() \u003c '2000-01-01'","parseMode":2}}}},{"PLpgSQL_stmt_assert":{"lineno":5,"cond":{"PLpgSQL_expr":{"query":"false","parseMode":2}},"message":{"PLpgSQL_expr":{"query":"'msg'","parseMode":2}}}},{"PLpgSQL_stmt_assert":{"lineno":6,"cond":{"PLpgSQL_expr":{"query":"false","parseMode":2}},"message":{"PLpgSQL_expr":{"query":"version()","parseMode":2}}}},{"PLpgSQL_stmt_return":{"lineno":8,"expr":{"PLpgSQL_expr":{"query":"1","parseMode":2}}}}]}}}}, {"PLpgSQL_function":{"datums":[{"PLpgSQL_var":{"refname":"found","datatype":{"PLpgSQL_type":{"typname":"UNKNOWN"}}}},{"PLpgSQL_var":{"refname":"r","lineno":1,"datatype":{"PLpgSQL_type":{"typname":"record"}}}},{"PLpgSQL_row":{"refname":"(unnamed row)","lineno":3,"fields":[{"name":"r","varno":1}]}}],"action":{"PLpgSQL_stmt_block":{"lineno":2,"body":[{"PLpgSQL_stmt_fors":{"lineno":3,"var":{"PLpgSQL_row":{"refname":"(unnamed row)","lineno":3,"fields":[{"name":"r","varno":1}]}},"body":[{"PLpgSQL_stmt_dynexecute":{"lineno":6,"query":{"PLpgSQL_expr":{"query":"'GRANT ALL ON ' || quote_ident(r.table_schema) || '.' || quote_ident(r.table_name) || ' TO webuser'","parseMode":2}}}}],"query":{"PLpgSQL_expr":{"query":"SELECT table_schema, table_name FROM information_schema.tables\n WHERE table_type = 'VIEW' AND table_schema = 'public'","parseMode":0}}}},{"PLpgSQL_stmt_return":{}}]}}}} ]