Re: where to divide application and database

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: where to divide application and database
Date: 2009-02-20 20:38:25
Message-ID: 20090220203825.GF32672@frubble.xen.chris-lamb.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Feb 20, 2009 at 06:50:22AM -0800, David Fetter wrote:
> On Thu, Feb 19, 2009 at 11:43:19PM +0000, Sam Mason wrote:
> > On Tue, Feb 17, 2009 at 09:53:00AM -0800, David Fetter wrote:
> > > user_name TEXT, -- unless length is an integrity constraint, use TEXT instead of VARCHAR.
> > >
> > > then later:
> > >
> > > CREATE UNIQUE INDEX unique_user_name_your_table
> > > ON your_table(LOWER(TRIM(user_name)))
> > >
> > > You might also require that whitespace be treated in some
> > > consistent way, one example of which is simply forbidding
> > > whitespace in user_name at all. This you can do via CHECK
> > > constraints or a DOMAIN.
> >
> > The reason behind this appears to be moving some of the checks into
> > the database and away from the application.
>
> Since a useful database has *many* applications instead of "the"
> application, I think this is an excellent move. Single Point of
> Truth and all that.

Oops, I think I failed to read your original message very well then.
I failed to notice the "forbidding whitespace" comment even though I
deliberately left it in. Doh!

> > I don't think that either my nor David's is better in general, they
> > apply to different situations.
>
> I don't even think they're *different* in general ;)

No, they're not really are they. :)

--
Sam http://samason.me.uk/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sam Mason 2009-02-20 20:45:20 Re: where to divide application and database
Previous Message Cott Lang 2009-02-20 19:48:45 Re: Fixing invalid owners on pg_toast tables in 8.3.5