Re: pg_agent jobs - Mailing list pgsql-general

From Adrian Klaver
Subject Re: pg_agent jobs
Date
Msg-id 1b7c2046-049b-4117-90e1-a23437f74c6e@aklaver.com
Whole thread Raw
In response to Re: pg_agent jobs  (Giovanni Biscontini <biscontini.g@es2000.it>)
List pgsql-general
On 10/2/23 00:50, Giovanni Biscontini wrote:
> Hi, Yes I know I've to use the "on error" property, but the cue is to 
> raise an error if query has a false result: for my knowledges the only 
> way to do it is to "create or replace" a PL/pgSQL procedure that than 
> uses a "RAISE ERROR" inside, but isn't there a more "SQL only way to do it?
> thanks in advance, G
> 

1) select 1/count(*) from table where ...

2) Use anonymous function DO:

https://www.postgresql.org/docs/current/sql-do.html


FYI, there are other programs that do roughly the same thing. You might 
want to check them out to see if they work better for your tasks:

pg_cron
https://github.com/citusdata/pg_cron

pg_timetable
https://pg-timetable.readthedocs.io/en/master/


-- 
Adrian Klaver
adrian.klaver@aklaver.com




pgsql-general by date:

Previous
From: Wim Bertels
Date:
Subject: Re: specifying multiple options in URI psql behaviour?
Next
From: byme@byme.email
Date:
Subject: pg_stat_statements IN problem