Im writing a psql procedure to read source table, then agregate and write in aggregate table. My table source contains 2 columns beg, and end refers to client connection to