Re: stored procedures

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Shaozhong SHI <shishaozhong(at)gmail(dot)com>
Cc: pgsql-sql <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: Re: stored procedures
Date: 2023-10-17 16:04:16
Message-ID: CAKFQuwY7hQfApeNGPZT7-JS8rGMDW4YPjkePzr7OJnc0-aunGQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, Oct 17, 2023 at 8:54 AM Shaozhong SHI <shishaozhong(at)gmail(dot)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.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Campbell, Lance 2023-10-23 15:19:35 SQL issue after migrating from version 13 to 15
Previous Message Shaozhong SHI 2023-10-17 15:52:16 stored procedures