pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: raf <raf@raf.org>
To: pgsql-general@lists.postgresql.org
Subject: Re: Are stored procedures/triggers common in your industry
Date: Fri, 22 Apr 2022 09:12:38 +1000
Message-ID: <YmHk5qajymooVgkz@raf.org> (raw)
In-Reply-To: <CANnWeTqp1GSiee60mDsusMOMs2dRaAA-=kP5r6Zdxp+JwnK_YQ@mail.gmail.com>
References: <1D9B083B-8C41-4BB1-9A30-5ED2799AE963@gmail.com>
	<YmDr/2TIDdjUOWiH@raf.org>
	<CANnWeTqp1GSiee60mDsusMOMs2dRaAA-=kP5r6Zdxp+JwnK_YQ@mail.gmail.com>

On Thu, Apr 21, 2022 at 08:42:10AM -0500, Alex Aquino <alex@efficiencygeek.com> wrote:

> You mentioned testing, and reminds me of another benefit.  Way faster, more
> reliable, cheaper to test on the DB side.  Testing logic in SPs or SQL is
> much easier, especially when testing requires a sequence of calls for a use
> case.  It is easier because of the DBs support for transactions.  With
> transactions and state management built into the DB, a testing process can
> always revert to a reliable starting point and end point, thereby
> facilitating more dependable, automated test harnesses.  The alternative
> done mostly now is testing via UIs or APIs where there is no inherent
> transaction management, so a lot of work goes into preparing the test bed
> to be a known state and introspecting the results to verify.  This is
> usually done with some mix of manual and automated processes.

Actually, my full work tests take ages to run (~40m).
I know that mocking the db to make unit tests fast is popular,
but that's not helpful when the most important code being tested
is in the database. :-) It's more important to me that the tests
actually test everything than that they be fast.

But yes, being able to do complex system testing with transaction
rollback is great.

cheers,
raf






view thread (14+ messages)

Message-ID: <YmHk5qajymooVgkz@raf.org>
Permalink:  ../YmHk5qajymooVgkz@raf.org/
Also on:    postgresql.org/message-id/YmHk5qajymooVgkz@raf.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: raf@raf.org
  Subject: Re: Are stored procedures/triggers common in your industry
  In-Reply-To: <YmHk5qajymooVgkz@raf.org>
  References: <1D9B083B-8C41-4BB1-9A30-5ED2799AE963@gmail.com> <YmDr/2TIDdjUOWiH@raf.org> <CANnWeTqp1GSiee60mDsusMOMs2dRaAA-=kP5r6Zdxp+JwnK_YQ@mail.gmail.com> <YmHk5qajymooVgkz@raf.org>

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

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