Thread: comments in load scripts
I have two questions regarding using load scripts to create and populate my DB. I use the following command to create my DB with a script which has a lot of create statements in it: %> psql testDB < loadTestDB.sql Question 1: Is this the best way to create my DB? I know there's a pg_dump command, but is there some kind of a pgload I should be using instead? (I got the above command from "9.1.1 Restoring the Dump" from the Admin guide. Secondly, my create and populate scripts are very long. When running the populate script, I get a ton of output with Insert OID statements: ... INSERT 30094 1 INSERT 30095 1 INSERT 30096 1 INSERT 30097 1 INSERT 30098 1 ... Is there any way I can put comments into my load scripts so that I can get an indication of the progress the load is making. I'd like to see something like: Populating Users Table INSERT 30094 1 INSERT 30095 1 Populating Role Table INSERT 30096 1 ... I'd like this functionality for debugging purposes. I've looked through the archives and the docs and not found a possible solution. Thx in Advance, Aurangzeb -- Aurangzeb M. Agha | Email : aagha@bigfoot.com | Home : +3 010 8959.558 34 Nafsika St. | Direct: +3 010 8995.875 Voula 16673 | Mobile: TBD Greece | Voice : 415 412 4234 (US Only) | e-Fax : 978 246.0770 PGP ID: 0x68B3A763 | "Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety." - Benjamin Franklin
On Sun, 2002-08-25 at 21:39, Aurangzeb M. Agha wrote: > I have two questions regarding using load scripts to create and populate > my DB. > > I use the following command to create my DB with a script which has a lot > of create statements in it: > > %> psql testDB < loadTestDB.sql > > Question 1: Is this the best way to create my DB? I know there's a pg_dump > command, but is there some kind of a pgload I should be using instead? This is fine > Secondly, my create and populate scripts are very long. When running the > populate script, I get a ton of output with Insert OID statements: > > ... > INSERT 30094 1 > INSERT 30095 1 > INSERT 30096 1 > INSERT 30097 1 > INSERT 30098 1 > ... > > Is there any way I can put comments into my load scripts so that I can get > an indication of the progress the load is making. You can put SQL comments in your script: -- This is a comment (preceded by a double hyphen) You can see these comments and the commands being executed by running psql with the -e option: %> psql -e -d testDB < loadTestDB.sql -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "Seeing then that all these things shall be dissolved, what manner of persons ought ye to be? You ought to live holy and godly lives as you look forward to the day of God and speed its coming." II Peter 3:11,12