Skip to main content

Posts

Showing posts from July, 2018

Generate function/table-wise backup/definition in PostgeSQL through a single script

Sometime we face problem to take backup or make (Definition) scripts of Functions or Tables separately for entire schema. When we want to take backup separately for objects like function, table etc., here's need to generate object wise backup scripts separately.So for achieving this, go through below: In this example I am using Database(DB)=postgres , User (U)=postgres, Schema=public  and OS=Centos7 x64 You can change name of your Database , User and Schema as per your requirement. (A) Make separate Function scripts  Step 1. Create an .sh(shell script) file and paste below commands to generate functions script by their functions name :  Suppose I have created funcscript.sh Step 2  Open it in vi editor :                   vi  funcscript.sh # Paste below text or change it as per your requirement.  # Config: DB=postgres U=postgres export PGPA...