public inbox for [email protected]  
help / color / mirror / Atom feed
From: David G. Johnston <[email protected]>
To: Shaozhong SHI <[email protected]>
Cc: pgsql-sql <[email protected]>
Subject: Re: stored procedures
Date: Tue, 17 Oct 2023 09:04:16 -0700
Message-ID: <CAKFQuwY7hQfApeNGPZT7-JS8rGMDW4YPjkePzr7OJnc0-aunGQ@mail.gmail.com> (raw)
In-Reply-To: <CA+i5JwYKT9MWjHd6Ae+_1-VmbLQFLXa0w9u-fNrVOptXWXc56Q@mail.gmail.com>
References: <CA+i5JwYKT9MWjHd6Ae+_1-VmbLQFLXa0w9u-fNrVOptXWXc56Q@mail.gmail.com>

On Tue, Oct 17, 2023 at 8:54 AM Shaozhong SHI <[email protected]>
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.


view thread (2+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: stored procedures
  In-Reply-To: <CAKFQuwY7hQfApeNGPZT7-JS8rGMDW4YPjkePzr7OJnc0-aunGQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox