Re: pg_agent jobs

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Giovanni Biscontini <biscontini(dot)g(at)es2000(dot)it>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: pg_agent jobs
Date: 2023-10-02 16:10:49
Message-ID: 1b7c2046-049b-4117-90e1-a23437f74c6e@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message byme 2023-10-02 16:19:40 pg_stat_statements IN problem
Previous Message Wim Bertels 2023-10-02 15:21:33 Re: specifying multiple options in URI psql behaviour?