Thread: running from a script
I've read through most of Bruce Momjian's book on PostgresSQL and I have not seen anything that shows how to run SQL commands from a script. I'm trying to emulate some of the work I've done with Oracle in the past where I was able to write either a DEC DCL script or a UNIX shell script to run SQL commands out of cron or another scheduler. Any help of snipits on how to get started would be appreciated. -Mark Mark P. Molenda <<...OLE_Obj...>> Senior Information Specialist NYSC
Molenda, Mark P wrote: >I've read through most of Bruce Momjian's book on PostgresSQL and I have not >seen anything that shows how to run SQL commands from a script. I'm trying >to emulate some of the work I've done with Oracle in the past where I was >able to write either a DEC DCL script or a UNIX shell script to run SQL >commands >out of cron or another scheduler. Any help of snipits on how to get started >would be appreciated. -Mark > >Mark P. Molenda <<...OLE_Obj...>> >Senior Information Specialist >NYSC > > > > >---------------------------(end of broadcast)--------------------------- >TIP 4: Don't 'kill -9' the postmaster > > > > > psql -d database -U user < sqlfile Is that what you mean ?
On Thu, 2002-06-27 at 07:16, Molenda, Mark P wrote: > > I've read through most of Bruce Momjian's book on PostgresSQL and I have not > seen anything that shows how to run SQL commands from a script. I'm trying > to emulate some of the work I've done with Oracle in the past where I was > able to write either a DEC DCL script or a UNIX shell script to run SQL So, you're trying to get from Unix what you got in The World's Greatest Operating System? You'll never totally emulate it. <sigh> And Rdb _is_ still the greatest... > commands > out of cron or another scheduler. Any help of snipits on how to get started > would be appreciated. -Mark Is this what you want? psql -d test2 -c "vacuum verbose analyze t_lane_tx;" -- +-------------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson@cox.net | | Jefferson, LA USA http://ronandheather.dhs.org:81 | | | | "Object-oriented programming is an exceptionally bad idea | | which could only have originated in California." | | --Edsger Dijkstra | +-------------------------------------------------------------+
Molenda, Mark P wrote: >Thanks Ewald! > >I was wondering if you needed any special syntax for the sqlfile or you can >just do the standard >select * from tablename\g on a line. -Mark > > it's an ascii file select * from tablename; Select x,y,z from tablename2; Ewald >-----Original Message----- >From: Ewald Geschwinde [mailto:webmaster@geschwinde.net] >Sent: Thursday, June 27, 2002 10:41 AM >To: Molenda, Mark P >Cc: Pgsql-Novice (E-mail) >Subject: Re: [NOVICE] running from a script > > >Molenda, Mark P wrote: > > > >>I've read through most of Bruce Momjian's book on PostgresSQL and I have >> >> >not > > >>seen anything that shows how to run SQL commands from a script. I'm trying >>to emulate some of the work I've done with Oracle in the past where I was >>able to write either a DEC DCL script or a UNIX shell script to run SQL >>commands >>out of cron or another scheduler. Any help of snipits on how to get >> >> >started > > >>would be appreciated. -Mark >> >>Mark P. Molenda <<...OLE_Obj...>> >>Senior Information Specialist >>NYSC >> >> >> >> >>---------------------------(end of broadcast)--------------------------- >>TIP 4: Don't 'kill -9' the postmaster >> >> >> >> >> >> >> >psql -d database -U user < sqlfile > >Is that what you mean ? > > > > >