Re: Writing most code in Stored Procedures - Mailing list pgsql-general

From Trevor Talbot
Subject Re: Writing most code in Stored Procedures
Date
Msg-id 90bce5730708151824t74a5f3b2s61032656673d8e1c@mail.gmail.com
Whole thread Raw
In response to Re: Writing most code in Stored Procedures  (Steve Manes <smanes@magpie.com>)
Responses Re: Writing most code in Stored Procedures  (Steve Manes <smanes@magpie.com>)
List pgsql-general
On 8/15/07, Steve Manes <smanes@magpie.com> wrote:

> I'm fairly hardcore about keeping as much business logic as I can in the
> database.  In fact, I only do SELECTs from the application, and usually
> via Views.  All inserts, updates and deletes are via procs.  I'm a
> proponent of separating application code from presentation and
> application code from database code.  And HTML from layout style, for
> that matter.
>
> In addition to the other reasons you've gotten:

> Another is because I want transactions to start and end in the database,
> not in external application code which might crash before a COMMIT.

Hmm, how do you handle this logically?  Do your applications never
need to submit chunks of work at once?  Or do you do something like
fill in a temporary table, and have a proc work from that?

> Another is because I'm a freelancer and generally hand off my
> applications to the client's tech department, which is often a junior
> level grasshopper who knows just enough SQL to be dangerous. Using
> stored procedures raises the bar on what they need to know about RDMBSes
>   before they start hacking working code.

...although that helps explain "why" a bit more: if you're stuck with
people who can't use transactions properly, it makes sense to keep
them out of reach...

pgsql-general by date:

Previous
From: "Phoenix Kiula"
Date:
Subject: Re: pg_dump on local Windows, pg_restore on Linux?
Next
From: "서기석"
Date:
Subject: please! SPI_finish is strange