pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Erik Wienhold <ewie@ewie.name>
To: FOUTE K. Jaurès <jauresfoute@gmail.com>
To: PostgreSQL General <pgsql-general@lists.postgresql.org>
Subject: Re: Call a Normal function inside a Trigger Function
Date: Sun, 16 Apr 2023 17:05:49 +0200 (CEST)
Message-ID: <390317034.269615.1681657549620@office.mailbox.org> (raw)
In-Reply-To: <CAHQ1jfdZWH_UyMEj-x2yMm4GfLe6R=Wr=jgEh0GgKXyp249PWg@mail.gmail.com>
References: <CAHQ1jfdZWH_UyMEj-x2yMm4GfLe6R=Wr=jgEh0GgKXyp249PWg@mail.gmail.com>

> On 16/04/2023 16:18 CEST FOUTE K. Jaurès <jauresfoute@gmail.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





view thread (7+ messages)  latest in thread

Message-ID: <390317034.269615.1681657549620@office.mailbox.org>
Permalink:  ../390317034.269615.1681657549620@office.mailbox.org/
Also on:    postgresql.org/message-id/390317034.269615.1681657549620@office.mailbox.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ewie@ewie.name, jauresfoute@gmail.com
  Subject: Re: Call a Normal function inside a Trigger Function
  In-Reply-To: <390317034.269615.1681657549620@office.mailbox.org>
  References: <CAHQ1jfdZWH_UyMEj-x2yMm4GfLe6R=Wr=jgEh0GgKXyp249PWg@mail.gmail.com> <390317034.269615.1681657549620@office.mailbox.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox