Bradley Kirton's Blog

Published on June 12, 2024

Go home

Postgresql functions vs procedures

The main difference between functions are procedures, besides the syntax to create them, are listed below.

FeatureFunctionProcedure
TransactionsAre not supported ❌Are supported ✅
Argument modesIN, OUT, INOUTIN, INOUT
InvocationSelect foo(); select * from foo();CALL statement
ReturnsMust 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.