Yes. Its working fine.
What i mean i created function to delete parts from table.Then i need to
place it on pgagent.

i placed function in pagent
like this..

do $$
declare
    job_id int;
begin

    /* add a job and get its id: */
    insert into
        pgagent.pga_job (jobjclid, jobname)
    values
        (1 /*1=Routine Maintenance*/, 'part delete')
    returning
        jobid
    into
        job_id;


    /* add a step to the job: */
    insert into
        pgagent.pga_jobstep (jstjobid, jstname, jstkind, jstcode,
jstdbname)
    values
        (   job_id,
            'my step name',
            's',                    /* sql step */
            'do
$BODY$
BEGIN
perform delete_empty_parts();
   end;
  $BODY$',  /* the sql to run */
            'sakila'                  /* the name of the database to run
the step against */
        );


    /* add a schedule to the job. This one runs every minute: */
    insert into
        pgagent.pga_schedule (jscjobid, jscname)
    values
        (job_id, 'my schedule name');

end $$;



it sprogramatic way..

excuted fine.where i need to find this job.Jobs section..?,if yes unable to
see the job after excuted..please let me know where i need to excute and
where it is place..





2.is their any chance place *function *in pgagent directly in diagramatic
way ..?
like right click on job create job..
i think step-->defintion..

how to place it  and can i select sql or batch..?

On Fri, Apr 3, 2015 at 3:50 PM, <pgsql-general-ow...@postgresql.org> wrote:

> Your message to pgsql-general has been delayed, and requires the approval
> of the moderators, for the following reason(s):
>
> The author (Ramesh T <rameshparnandit...@gmail.com>)
>   is not a member of any of the restrict_post groups.
>
> If you do not wish the message to be posted, or have other concerns,
> please send a message to the list owners at the following address:
>   pgsql-general-ow...@postgresql.org
>
>
> ---------- Forwarded message ----------
> From: Ramesh T <rameshparnandit...@gmail.com>
> To: Pavel Stehule <pavel.steh...@gmail.com>, "pgsql-general@postgresql.org"
> <pgsql-general@postgresql.org>
> Cc:
> Date: Fri, 3 Apr 2015 15:50:43 +0530
> Subject: Re:
> The link is good.
>
> But What I am expecting the following link..Created Using pgAgent.
>
> http://www.postgresonline.com/journal/archives/19-Setting-up-PgAgent-and-Doing-Scheduled-Backups.html
>
>
> in above link process they placed  location of the script file at STEP
>  DEFINTION TAB creation process..
>
> same way  is there  a chance to place creation of table or delete
> statements in pgAgent process..?
>
> my aim to create job is delete some null data from table daily
>
>
>
> On Fri, Apr 3, 2015 at 3:30 PM, Pavel Stehule <pavel.steh...@gmail.com>
> wrote:
>
>> Hi
>>
>>
>> http://stackoverflow.com/questions/4477301/creating-jobs-and-schedules-programatically-with-pgagent
>>
>> regards
>>
>> Pavel Stehule
>>
>> 2015-04-03 11:27 GMT+02:00 Ramesh T <rameshparnandit...@gmail.com>:
>>
>>> Hi ,
>>>       How to create job in pgAgent.Where I need to place script in
>>> pgAgent..any help
>>>
>>> Advanced thanks...
>>>
>>>
>>
>
>

Reply via email to