CALL(7)
π CALL(7) β ok so you wanna invoke a procedure, bestie
(that's the CALL page from the PostgreSQL 15.19 docs, and yes it's giving "short but iconic" π)
β¨ SYNOPSIS β¨
CALL name ( [ argument ] [, ...] )
That's it. That's the whole vibe check. πΈ
π DESCRIPTION π
CALL executes a procedure. That's the entire assignment. π₯
And here's the cute part: if the procedure has any output parameters, you get a result row back β a whole little row full of the values of those parameters. Slay. π
π¦ PARAMETERS π¦
nameβ the name of the procedure (it can be schema-qualified if you wanna be specific about which one, iykyk).argumentβ an argument expression for the procedure call.
Ngl, arguments can include parameter names, using the syntax name => value. This works exactly the same as in ordinary function calls; go peep Section 4.3 for the details, bestie. π«Ά
β οΈ Okay this part matters: arguments must be supplied for all procedure parameters that lack defaults, including OUT parameters. But β and this is the fun loophole β arguments matching OUT parameters are not evaluated, so it's customary to just write NULL for them. Literally just NULL. β¨
Real talk though: writing something else for anOUTparameter might cause compatibility problems with future PostgreSQL versions. So likeβ¦ don't be that girl.NULLit is. π
π NOTES π
- The user must have
EXECUTEprivilege on the procedure in order to be allowed to invoke it. No privilege, no procedure. Periodt. π« - Wanna call a function (not a procedure)? Use
SELECTinstead. Different tool, different vibe, we don't mix them up. π - If
CALLis executed inside a transaction block, then the called procedure cannot execute transaction control statements. Transaction control statements are only allowed ifCALLis executed in its own transaction. So main characterCALLgets to control transactions β group-projectCALLdoes not. π - Heads up: PL/pgSQL handles output parameters in
CALLcommands differently; see Section 43.6.3 for that whole situation. π
π EXAMPLES π
CALL do_db_maintenance();
That's her. That's the girl. One line, runs a procedure, done. π
β COMPATIBILITY β
CALL conforms to the SQL standard β except for the handling of output parameters. The standard says users should write variables to receive the values of output parameters. We do not, and honestly? That's the whole tea. π«
π₯ SEE ALSO π₯
CREATE PROCEDURE(CREATE_PROCEDURE(7)) β like, you gotta make the procedure first before you can call her bestie π
tl;dr βCALLruns a procedure,EXECUTEprivilege required,NULLyourOUTargs, useSELECTfor functions, and no transaction control statements inside a transaction block. That's the whole page. You ate. π
okay bye bestie, this was PostgreSQL 15.19 documentation, from 2026, and you've been reading CALL(7) β go execute something iconic πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms