In PostgreSQL 11 beta1 announcement, it is stated that a major feature of the new version is

SQL Stored Procedures

PostgreSQL 11 introduces SQL stored procedures that allow users to use embedded transactions (i.e. BEGIN, COMMIT/ROLLBACK) within a procedure. Procedures can be created using the CREATE PROCEDURE command and executed using the CALL command.

My questions are,

  1. What's the difference between a procedure created with CREATE PROCEDURE and a traditional function created with CREATE FUNCTION?

    From browsing the two documentation page, they seem to be quite similar and can both ,e.g., take parameters and return OUT values. Is transaction behavior the only difference?

  2. I have written many functions in PL/PGSQL. Should I change my functions to the new procedures? (If so, what are the advantages?)

marked as duplicate by Evan Carroll postgresql Jun 1 '18 at 3:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.