CALL(7)

πŸ“¦ version 17.11, in opensuse-leap 16.0

πŸ’… 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 OUT parameters. However, arguments matching OUT parameters are not evaluated, so it's customary to just write NULL for them. (Writing something else for an OUT parameter might cause compatibility problems with future PostgreSQL versions. Not me warning you twice, but... consider this your warning 🫢)

πŸ”₯ NOTES πŸ”₯

  • The user must have EXECUTE privilege on the procedure in order to be allowed to invoke it. No privilege, no party.
  • To call a function (not a procedure), use SELECT instead. That's the move, bestie.
  • If CALL is executed in a transaction block, then the called procedure cannot execute transaction control statements. Transaction control statements are only allowed if CALL is executed in its own transaction. So yes, this is a real boundary β€” respect it πŸ’…
  • PL/pgSQL handles output parameters in CALL commands 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 🐚


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