Re: stored procedures - Mailing list pgsql-sql

From David G. Johnston
Subject Re: stored procedures
Date
Msg-id CAKFQuwY7hQfApeNGPZT7-JS8rGMDW4YPjkePzr7OJnc0-aunGQ@mail.gmail.com
Whole thread Raw
In response to stored procedures  (Shaozhong SHI <shishaozhong@gmail.com>)
List pgsql-sql
On Tue, Oct 17, 2023 at 8:54 AM Shaozhong SHI <shishaozhong@gmail.com> wrote:
How easily turn do statement scripts into stored procedures?  Much modification is needed?

What is the advantage to do so?

Depends on the script but possibly a matter of copy-paste for the simplest.

Advantages: The script is on the server, can require permissions, has a name (I suppose a script file does too...).  Easier to deal with input parameters.  Fewer components involved.  Usable by components that can't issue SQL directly - e.g., GraphQL mutations.

Disadvantages: Changing the script is now a formal migration for the database instead of an application update.

David J.

pgsql-sql by date:

Previous
From: Shaozhong SHI
Date:
Subject: stored procedures
Next
From: "Campbell, Lance"
Date:
Subject: SQL issue after migrating from version 13 to 15