Prior to PostgreSQL 11, you could not control transactions explicitly inside a function. The function would always run within a transaction. This caused some difficulty in performing a number of development and administrative tasks. For example, a database administrator has performed bulk indexing inside a function, and, after a certain period of time, the administrator cancelled the function execution due to a time or performance constraint. In the preceding scenario, all work done is lost due to the nature of the transaction. From a development perspective, being able to control transactions inside a function is important because it allows the developers to control transactions based on business logic requirements.
PostgreSQL 11 provides a new feature, which is CREATE PROCEDURE. The procedure has a different transaction behavior than a...