From 127fbb41d5d31a2eef87fdfb0e37c5edafe9c790 Mon Sep 17 00:00:00 2001 From: Joe Nelson Date: Sun, 18 Jun 2017 12:06:21 -0500 Subject: [PATCH] Note function volatility in RPC Fixes #64 --- api.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api.rst b/api.rst index 0128e0b22..52b0e714b 100644 --- a/api.rst +++ b/api.rst @@ -380,12 +380,14 @@ The PostgREST URL grammar limits the kinds of queries clients can perform. It pr Stored Procedures ================= -Every stored procedure in the API-exposed database schema is accessible under the :code:`/rpc` prefix. The API endpoint supports only POST which executes the function. Such function can perform any operations allowed by PostgreSQL (read data, modify data, and even DDL operations). +Every stored procedure in the API-exposed database schema is accessible under the :code:`/rpc` prefix. The API endpoint supports only POST which executes the function. .. code:: http POST /rpc/function_name HTTP/1.1 +Such functions can perform any operations allowed by PostgreSQL (read data, modify data, and even DDL operations). However procedures in PostgreSQL marked with :code:`stable` or :code:`immutable` `volatility `_ can only read, not modify, the database and PostgREST executes them in a read-only transaction compatible for read-replicas. + Procedures must be used with `named arguments `_. To supply arguments in an API call, include a JSON object in the request payload and each key/value of the object will become an argument. For instance, assume we have created this function in the database.