-2

I have this function

I have this function:

how i use it without a trigger ?

  • Please include code and output as content for your question, not as pictures or external links. – Dragonthoughts Dec 13 '18 at 16:18
  • Please read http://meta.stackoverflow.com/questions/285551/why-may-i-not-upload-images-of-code-on-so-when-asking-a-question/285557 and the accepted answer –  Dec 13 '18 at 19:26

2 Answers2

0

There are a few possible alternatives doing so without a trigger, it depends on when you want to call this function.

using cron:

*/15 * * * * psql -d mydatabase -c "interv()"

using LISTEN: https://www.postgresql.org/docs/current/sql-listen.html

Royzipuff
  • 497
  • 4
  • 9
  • Also, please refer to this topic. It talks about MVs, but I see this as a similar concept https://stackoverflow.com/questions/29437650/how-can-i-ensure-that-a-materialized-view-is-always-up-to-date – Royzipuff Dec 13 '18 at 16:34
-2

Functions are used throughout your database, they can be called from within stored procedures as well. Functions should return something. So if you have a date in one format and want to convert it into a different format, you can create a function that does just that, and 'call' that function within a stored procedure, for example.