X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 48ED59DC946 for ; Wed, 1 Feb 2006 19:25:55 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61068-03 for ; Wed, 1 Feb 2006 19:25:56 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from relay01.mdc.ubisoft.com (relay01.mdc.ubisoft.com [216.98.56.134]) by postgresql.org (Postfix) with ESMTP id 4EF1B9DC871 for ; Wed, 1 Feb 2006 19:25:51 -0400 (AST) Received: from mdc-owa01.ubisoft.org (srvowa1-mdc.ubisoft.org [10.129.1.20]) by smarthost.mdc.ubisoft.com (Postfix) with ESMTP id C507C4BB97; Wed, 1 Feb 2006 18:25:54 -0500 (EST) Received: from UBIMAIL1.ubisoft.org ([10.129.1.15]) by mdc-owa01.ubisoft.org with Microsoft SMTPSVC(6.0.3790.1830); Wed, 1 Feb 2006 18:25:54 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: Re: Does PostgreSQL support job? Date: Wed, 1 Feb 2006 18:25:54 -0500 Message-ID: <1E293D3FF63A3740B10AD5AAD88535D201755923@UBIMAIL1.ubisoft.org> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [SQL] Does PostgreSQL support job? Thread-Index: AcYngzMmD1Dxj/gDT0uMgRod2Ume3gAAEwng From: "Daniel Caune" To: "Owen Jacobson" , X-OriginalArrivalTime: 01 Feb 2006 23:25:54.0631 (UTC) FILETIME=[D8FEB570:01C62786] X-Ubisoft-MailScanner-Information: Please contact administrators@ubisoft.qc.ca X-Ubisoft-MailScanner: Found to be clean X-Ubisoft-MailScanner-SpamCheck: X-MailScanner-From: daniel.caune@ubisoft.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.127 required=5 tests=[AWL=0.127] X-Spam-Score: 0.127 X-Spam-Level: X-Archive-Number: 200602/13 X-Sequence-Number: 24023 > -----Message d'origine----- > De=A0: Owen Jacobson [mailto:ojacobson@osl.com] > Envoy=E9=A0: mercredi, f=E9vrier 01, 2006 18:00 > =C0=A0: Daniel Caune; pgsql-sql@postgresql.org > Objet=A0: RE: [SQL] Does PostgreSQL support job? >=20 > Daniel Caune wrote: > > Hi, > > > > I try to find in the documentation whether PostgreSQL supports job, > > but I miserably failed. Does PostgreSQL support job? If not, what > > is the mechanism mostly adopted by PostgreSQL administrators for > > running jobs against PostgreSQL? I was thinking about using > > cron/plsql/sql-scripts on Linux. >=20 > The answer really depends on what you mean by "jobs". If you have a > database task that can be expressed as a series of commands with no > interaction involved, you can just put those commands in a file = (your-job- > name.sql) and run it using psql and cron: >=20 > # replace leading stars with cron time settings > * * * * * psql your-database -i your-job-name.sql >=20 Yes, that's it. A job is a task, i.e. set of statements, which is = scheduled to run against a RDBMS at periodical times. Some RDBMS, such = as SQL Server and Oracle, support that feature, even if such a feature = is managed differently from a RDBMS to another. OK. I get it. I will use cron and psql as I was planning to do so. > If you need something more complex, either a function which is = executed > from a script or a full-blown client program may be required. IME = that's > fairly rare. >=20 I'm not sure to understand. Why calling a function from a script is = different from executing a series of SQL commands? I mean, I can run a = script defined as follows: SELECT myjob(); where myjob is a stored procedure such as: CREATE OR REPLACE FUNCTION myjob() RETURNS void AS $$ END; $$ LANGUAGE PLPGSQL; Does that make sense? -- Daniel CAUNE