CALL(7)

โœจ CALL โœจ

ok bestie so this is from the PostgreSQL 18.6 Documentation โ€” it's the CALL page (that's CALL(7) if you're being formal ๐Ÿ’…) and it's literally just about invoking procedures. no cap. let's get into it ๐Ÿซถ


๐ŸŒธ NAME ๐ŸŒธ

CALL โ€” invoke a procedure ๐Ÿ’–

like, you have a procedure? this is how you poke it and make it do the thing.


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

CALL name ( [ argument ] [, ...] )

that's it. that's the whole vibe. โœจ


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

okay so CALL executes a procedure. that's the main character energy right there ๐Ÿ‘‘

and here's the tea ๐Ÿ“: if the procedure has any output parameters, then a result row will be returned, containing the values of those parameters. so you do get something back, just not in the way you'd expect from a function. iykyk.


๐Ÿ’œ PARAMETERS ๐Ÿ’œ

  • name โ€” the name of the procedure. it can optionally be schema-qualified, so you can point at exactly which one you mean, no confusion, no drama. ๐ŸŽฏ
  • argument โ€” an argument expression for the procedure call. lowkey the whole point.

arguments can include parameter names, using the syntax name => value. this works exactly the same as in ordinary function calls โ€” see Section 4.3 for the deets, bestie. ๐Ÿ“–

โš ๏ธ okay this part matters: arguments must be supplied for all procedure parameters that lack defaults, including OUT parameters. BUT โ€” and this is the iconic bit โ€” 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, so likeโ€ฆ don't be messy ๐Ÿ™ˆ)

๐Ÿ”ฅ NOTES ๐Ÿ”ฅ

  • the user must have EXECUTE privilege on the procedure to be allowed to invoke it. no privilege, no party. periodt. ๐Ÿ’…
  • to call a function (not a procedure), use SELECT instead. different tool, different slay. โœจ
  • if CALL is executed inside a transaction block, then the called procedure cannot execute transaction control statements. those are only allowed if CALL is executed in its own transaction. so like, pick a lane bestie ๐Ÿ˜ญ
  • PL/pgSQL handles output parameters in CALL commands differently โ€” see Section 41.6.3. yes, it's giving chaotic, but it's documented, so we move. ๐ŸŒˆ

โญ EXAMPLES โญ

CALL do_db_maintenance();

look at her go. iconic. ๐Ÿ‘‘


๐Ÿ’€ 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 we're doing our own thing there, and that's fine, we're built different. ๐Ÿงš


๐ŸŒˆ SEE ALSO ๐ŸŒˆ


k that's the whole page bestie!! ๐Ÿ’– this was PostgreSQL 18.6, dated 2026, and the page is CALL(7). go call a procedure, you got this ๐Ÿซถโœจ๐ŸŽ€