as the title said. Can we move or copy existing table functions to another database schema?
I can get all the functions from a database schema using command below (Taken from here):
SELECT routine_name FROM information_schema.routines WHERE routine_type='FUNCTION' AND specific_schema='public';
And I also can get the function code details using command below (Taken from here):
\df+ public.<function_name>
As I need to move the database to the new server, so I need to copy all table functions inside a specific schema. Say I have a functions called update()
inside a schema analytics
.
Can we copy this functions to another database ? and is there any command to see when this functions will be run?
Note that I am using PostgreSQL 11 and Ubuntu 18.04
[SOLVED]
Sorry for updating this question after 2 years.
The questions has been answered and I'm using the command given by @dezso with slight modification which is:
pg_dump -Fc --username=dbuser --port=5432 --encoding=utf-8 --clean --no-owner -w -d dbname -f dbname.dump
as for calling the functions, it is as @a_horse_with_no_name suggest, I'm calling it using cron.
Thank you guys. cheers