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 435AD5E46C2 for ; Tue, 31 Aug 2004 09:00:55 -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 76566-09 for ; Tue, 31 Aug 2004 12:00:44 +0000 (GMT) Received: from mail.kzsdabas.sulinet.hu (szerver2.kzsdabas.sulinet.hu [195.199.159.210]) by svr1.postgresql.org (Postfix) with SMTP id 7B1CF5E46F2 for ; Tue, 31 Aug 2004 09:00:30 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mail.kzsdabas.sulinet.hu (Postfix) with ESMTP id CD48C64740C0; Tue, 31 Aug 2004 12:09:36 +0200 (CEST) Received: from mail.kzsdabas.sulinet.hu ([127.0.0.1]) by localhost (mail.kzsdabas.sulinet.hu [127.0.0.1]) (amavisd-new, port 10025) with LMTP id 00383-01; Tue, 31 Aug 2004 12:09:36 +0200 (CEST) Received: from kzsdabas.sulinet.hu (kag.kzsdabas.hu [10.0.13.1]) by mail.kzsdabas.sulinet.hu (Postfix) with ESMTP id 2A50F64784E1; Tue, 31 Aug 2004 12:09:36 +0200 (CEST) Message-ID: <41344E5F.1080805@kzsdabas.sulinet.hu> Date: Tue, 31 Aug 2004 12:09:35 +0200 From: =?ISO-8859-2?Q?G=E9mes_G=E9za?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; hu; rv:1.6) Gecko/20040115 X-Accept-Language: hu, en-us MIME-Version: 1.0 To: "Pradeepkumar, Pyatalo (IE10)" Cc: Scott Marlowe , pgsql-admin@postgresql.org Subject: Re: help on automatically running sql files References: <77ED2BF75D59D1439F90412CC5B1097410F3C901@ie10-sahara.hiso.honeywell.com> In-Reply-To: <77ED2BF75D59D1439F90412CC5B1097410F3C901@ie10-sahara.hiso.honeywell.com> Content-Type: multipart/alternative; boundary="------------060603020604080303070402" X-Virus-Scanned: by amavisd-new at kzsdabas.sulinet.hu X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.5 tagged_above=0.0 required=5.0 tests=HTML_MESSAGE, HTML_TITLE_EMPTY X-Spam-Level: X-Archive-Number: 200408/308 X-Sequence-Number: 14703 This is a multi-part message in MIME format. --------------060603020604080303070402 Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: quoted-printable Pradeepkumar, Pyatalo (IE10) =EDrta: >On Tue, 2004-08-31 at 01:33, Pradeepkumar, Pyatalo (IE10) wrote: >=20=20 > >>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 >>=20=20=20=20 >> >as >=20=20 > >>seperate .sql files which we want to ship as part of our software. Now >>=20=20=20=20 >> >when >=20=20 > >>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. >>=20=20=20=20 >> > >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 softwa= re >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. > >---------------------------(end of broadcast)--------------------------- >TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > >=20=20 > Your software installs somehow. Posibilities: -Via a shell/perl install script: append at the end of the script - Via a graphical install programm: append at the end of the programs=20 main part as the last thing to do (easiest way (but less performant):=20 via an exec statement) - Via rpm/deb/whatever else: In this case the packager usualy have a=20 postinstall part, where you can put this script, which checks for the=20 runing postgresql instance, and then run the required .sql files Regards, Geza Gemes --------------060603020604080303070402 Content-Type: text/html; charset=ISO-8859-2 Content-Transfer-Encoding: quoted-printable Pradeepkumar, Pyatalo (IE10) =EDrta:
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 post=
master 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 <sqlfile.sql will do.  If psql isn't in the
path, then /path/to/psql dbname <sqlfile.sql


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.

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

  
Your software installs somehow. Posibilities:
-Via a shell/perl install script: append at the end of the script
- Via a graphical install programm: append at the end of the programs main part as the last thing to do (easiest way (but less performant): via an exec statement)
- Via rpm/deb/whatever else: In this case the packager usualy have a postinstall part, where you can put this script, which checks for the runing postgresql instance, and then run the required .sql=A0 files

Regards,

Geza Gemes
--------------060603020604080303070402--