Published on June 12, 2024
Go homePostgresql functions vs procedures
The main difference between functions are procedures, besides the syntax to create them, are listed below.
Feature | Function | Procedure |
Transactions | Are not supported ❌ | Are supported ✅ |
Argument modes | IN, OUT, INOUT | IN, INOUT |
Invocation | Select foo(); select * from foo(); | CALL statement |
Returns | Must return something (void, setof, table, row, record or data type) | Cannot return using return keyword. Return can be used to exit procedure. Returnining is possible with INOUT arguments. |