X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7334A5E46E9 for ; Tue, 31 Aug 2004 06:12:36 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 27746-04 for ; Tue, 31 Aug 2004 09:12:24 +0000 (GMT) Received: from mpls-qmqp-03.inet.qwest.net (mpls-qmqp-03.inet.qwest.net [63.231.195.114]) by svr1.postgresql.org (Postfix) with SMTP id 0D7445E46C2 for ; Tue, 31 Aug 2004 06:12:27 -0300 (ADT) Received: (qmail 83723 invoked by uid 0); 31 Aug 2004 08:39:19 -0000 Received: from mpls-pop-03.inet.qwest.net (63.231.195.3) by mpls-qmqp-03.inet.qwest.net with QMQP; 31 Aug 2004 08:39:19 -0000 Received: from 63-227-127-37.dnvr.qwest.net (HELO ?10.0.0.2?) (63.227.127.37) by mpls-pop-03.inet.qwest.net with SMTP; 31 Aug 2004 09:12:28 -0000 Date: Tue, 31 Aug 2004 03:14:07 -0600 Message-Id: <1093943647.5493.64.camel@localhost.localdomain> From: "Scott Marlowe" To: "Pradeepkumar, Pyatalo (IE10)" Cc: pgsql-admin@postgresql.org Subject: Re: help on automatically running sql files In-Reply-To: <77ED2BF75D59D1439F90412CC5B1097410F3C901@ie10-sahara.hiso.honeywell.com> References: <77ED2BF75D59D1439F90412CC5B1097410F3C901@ie10-sahara.hiso.honeywell.com> Content-Type: text/plain Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/307 X-Sequence-Number: 14702 On Tue, 2004-08-31 at 02:40, Pradeepkumar, Pyatalo (IE10) wrote: > On Tue, 2004-08-31 at 01:33, Pradeepkumar, Pyatalo (IE10) wrote: > > Hi all, > > For the project that I am working on , we are using Postgresql 7.4.3 on > > Linux 7.2. We have all the database tables,triggers and stored procedures > as > > seperate .sql files which we want to ship as part of our software. Now > when > > the user installs our software, we need to check if postmaster service is > > running or not and if it is running, then we have to run the sql files > > automatically. Can anyone help me out on how to run the .sql files > > automatically. > > Something like psql dbname path, then /path/to/psql dbname > > Hi Scott, > What we really require is, if we ship the .sql files as part of our software > package, the user should not do anything. The software when it installs > should automatically run the .sql files without the user intervention. We > dont want the user to check for the .sql files and run the above command > himself. We want to automate that in our software. Is that possible in > postgresql. If yes, how to do it. If no, is there any alternative solution. > I can think of one alternative that is to write a shell script. That's pretty much what I was thinking when I made my suggestion.