CALL(7)
π NAME π
CALL β invoke a procedure. Okay bestie, this is the CALL(7) page from the PostgreSQL 17.11 docs, and we're about to make procedure-calling make sense π
πΈ SYNOPSIS πΈ
CALL name ( [ argument ] [, ...] )
π¦ DESCRIPTION π¦
CALL executes a procedure. That's the whole vibe.
If the procedure has any output parameters, then a result row will be returned, containing the values of those parameters. Cute, right? β¨
π PARAMETERS π
nameβ the name (optionally schema-qualified) of the procedure. Slay, schema-qualify when you need to.argumentβ an argument expression for the procedure call.- Arguments can include parameter names, using the syntax
name => value. This works the same as in ordinary function calls; see Section 4.3 for details. Iykyk. - Arguments must be supplied for all procedure parameters that lack defaults, including
OUTparameters. However, arguments matchingOUTparameters are not evaluated, so it's customary to just writeNULLfor them. (Writing something else for anOUTparameter might cause compatibility problems with future PostgreSQL versions. Not me warning you twice, but... consider this your warning π«Ά)
- Arguments can include parameter names, using the syntax
π₯ NOTES π₯
- The user must have
EXECUTEprivilege on the procedure in order to be allowed to invoke it. No privilege, no party. - To call a function (not a procedure), use
SELECTinstead. That's the move, bestie. - If
CALLis executed in 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 yes, this is a real boundary β respect it π - PL/pgSQL handles output parameters in
CALLcommands differently; see Section 41.6.3. Go peek if PL/pgSQL is your main character.
π EXAMPLES π
CALL do_db_maintenance();
π COMPATIBILITY π
CALL conforms to the SQL standard, except for the handling of output parameters. The standard says that users should write variables to receive the values of output parameters. So close, but not exactly the same vibe.
π SEE ALSO π
CREATE PROCEDURE (CREATE_PROCEDURE(7))
kisses and good luck calling procedures, bestie β this was PostgreSQL 17.11, dated 2026, aka the CALL(7) footer energy ππ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-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