I have two functions in PL/pgSQL:
The function 1 calls function 2, and function 2 needs to process a temporary table created on function 1, in another words, this temporary table needs to be global in the function 1 context (that have function 2 inside it).
FUNCTION1 | CREATE TEMPORARY TABLE | DO SOME SPECIFIC STUFF... | FUNCTION2 | DO SOME GENERIC STUFF | INSERT SOME DATA INTO THE TEMPORARY TABLE | (Uhh!! Ohh! it hurts, table not visible) | RAISED ON ERROR
There is a way to pass the temporary table created on function 1 to this subfunction?
I need it because i am working with a very big function that process a lot of data in a temporary table, before inserting all the big data, but when i try to turn into a more modular form, the subfunctions just can't see the temporary table).
It is working by now (in a big one function), but i am doing CTRL+C CTRL+V to create new similar functions, as a lot of codes can be repeated inside it. If i can use subfunctions this problem will go out, as i can use this code multiple times.