CALL(7)

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

πŸ’… 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 an OUT parameter might cause compatibility problems with future PostgreSQL versions. So like… don't be that girl. NULL it is. πŸ’€

πŸ’œ NOTES πŸ’œ

  • The user must have EXECUTE privilege on the procedure in order to be allowed to invoke it. No privilege, no procedure. Periodt. 🚫
  • Wanna call a function (not a procedure)? Use SELECT instead. Different tool, different vibe, we don't mix them up. 🌈
  • If CALL is executed inside 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 main character CALL gets to control transactions β€” group-project CALL does not. 😭
  • Heads up: PL/pgSQL handles output parameters in CALL commands 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 β€” CALL runs a procedure, EXECUTE privilege required, NULL your OUT args, use SELECT for 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