it is possible to execute an insert or update operation using only functions in postgres?. I am using version 10.14 that not support store procedures.
Asked
Active
Viewed 84 times
-1
-
Yes you can. In lower version (9.5, 9.6, 10.0) of postgresql function behaves like stored procedure. – Rahul Biswas Jan 18 '22 at 06:32
-
@RahulBiswas, functions where not/are not stored procedures that is why stored procedures where added. Two big differences 1) Stored procedures can contain transactions, functions do not. 2) Functions can have a `return` value store procedures do not. – Adrian Klaver Jan 18 '22 at 16:41
1 Answers
2
You should use INSERT ... ON CONFLICT
. It doesn't matter much if you run that from a function or not.

Laurenz Albe
- 209,280
- 17
- 206
- 263