postgrest-docs icon indicating copy to clipboard operation
postgrest-docs copied to clipboard

Note about not supporting Stored Procedures

Open steve-chavez opened this issue 6 years ago • 3 comments

PostgreSQL 11 supports CREATE PROCEDURE see https://www.postgresql.org/docs/11/static/xproc.html, change the terms to be more precise in the next version.

steve-chavez avatar May 30 '18 19:05 steve-chavez

Actually the proper term for generalizing procedure/function is "routine" I believe. But most people will look for "stored procedures".

Pg 11 stored procedures are not supported since they don't play well with transactions for now, see https://github.com/PostgREST/postgrest/issues/1210.

Perhaps we could add a note about this.

steve-chavez avatar Aug 15 '19 17:08 steve-chavez

Would you like a PR for this? It was pretty confusing for it to return: To call a procedure, use CALL

The documentation made me think it was supported because there is a part about stored procedures: http://postgrest.org/en/v7.0.0/api.html#stored-procedures

Would this documentation change be good: renaming the section of the link above + adding a warning that procedures are not supported because of details about transactions

Also, I wanted to use procedures because I though procedures were wrapped in a transaction. I read in issue #1210 that there is a transaction through postgrest: would that revert inserts made in the function if the function fails?

Videl avatar Nov 24 '20 19:11 Videl

@Videl I think a warning about pg 11 stored procedures would be nice. However I'm not sure about renaming the section because many people conflate pg procedures with pg functions.

I read in issue #1210 that there is a transaction through postgrest: would that revert inserts made in the function if the function fails?

Yes, the insertions would be ROLLBACKed.

steve-chavez avatar Nov 24 '20 19:11 steve-chavez