Re: Call a Normal function inside a Trigger Function

From: Erik Wienhold <ewie(at)ewie(dot)name>
To: FOUTE K(dot) Jaurès <jauresfoute(at)gmail(dot)com>, PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Call a Normal function inside a Trigger Function
Date: 2023-04-16 15:05:49
Message-ID: 390317034.269615.1681657549620@office.mailbox.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On 16/04/2023 16:18 CEST FOUTE K. Jaurès <jauresfoute(at)gmail(dot)com> wrote:
>
> Is it possible to call a function inside a trigger function ?
> Any idea or link are welcome. Thanks in advance

Depends on what you want to do with the return value. Use PERFORM to ignore
the result. [0] Use SELECT INTO to handle a single-row result. [1]

PERFORM myfunc();
SELECT myfunc() INTO myresult;

[0] https://www.postgresql.org/docs/current/plpgsql-statements.html#PLPGSQL-STATEMENTS-GENERAL-SQL
[1] https://www.postgresql.org/docs/current/plpgsql-statements.html#PLPGSQL-STATEMENTS-SQL-ONEROW

--
Erik

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Erik Wienhold 2023-04-16 15:51:58 Re: Suppress logging of "pg_hba.conf rejects connection for host"
Previous Message ertan.kucukoglu 2023-04-16 15:02:27 Suppress logging of "pg_hba.conf rejects connection for host"