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.kla...@aklaver.com



Reply via email to