CALL(7)
π
CALL(7) β bestie, it's the CALL page
okay so real talk, the docs call this one CALL(7), and it's part of the PostgreSQL 16.15 documentation set. it's short, it's sweet, it's giving "one job and I do it well." let's get into it π«Ά
β¨ NAME β¨
CALL β invoke a procedure. that's it. that's the whole vibe. π₯
β¨ SYNOPSIS β¨
CALL name ( [ argument ] [, ...] )
β¨ DESCRIPTION β¨
CALL executes a procedure. literally its entire personality. π
and here's the cute part: if the procedure has any output parameters, then a result row will be returned, containing the values of those parameters. so you get something back. a lil treat. π
πΈ PARAMETERS πΈ
nameβ the name of the procedure, optionally schema-qualified. so like, you can be specific about which schema you mean. iykyk.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.
Arguments must be supplied for all procedure parameters that lack defaults, includingOUTparameters. 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.) β so bestie, no defaults = you gotta supply it. and for theOUTones, just writeNULLand move on. writing something spicy there could bite you with future PostgreSQL versions. π
π NOTES π
- The user must have
EXECUTEprivilege on the procedure in order to be allowed to invoke it. no privilege, no call. security said what it said. π - To call a function (not a procedure), use
SELECTinstead. different tool, different job, don't mix them up fr fr. - 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 if you're inside a transaction block, no transaction control statements from inside the procedure β that privilege only shows up whenCALLruns in its own transaction. respect the rules. π§ - PL/pgSQL handles output parameters in
CALLcommands differently; see Section 43.6.3. yes, differently. go read that section, i'm not spoiling it. π
β EXAMPLES β
CALL do_db_maintenance();
iconic. clean. no notes. β¨
π 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 like, standard says do it this way, postgres says "we do it our way, closer to the vibes." not us being messy, it's just β¨the handling of output parametersβ¨. π
π SEE ALSO π
CREATE PROCEDURE(CREATE_PROCEDURE(7)) β you gotta make the procedure before you can call it, bestie. that's the pipeline. π
and that's the whole page!! quick sign-off because the docs insist: this was PostgreSQL 16.15, dated 2026, and the page is CALL(7). slay, go call some procedures. πΈππ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-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