Re: where to divide application and database

Поиск
Список
Период
Сортировка
От Sam Mason
Тема Re: where to divide application and database
Дата
Msg-id 20090220203825.GF32672@frubble.xen.chris-lamb.co.uk
обсуждение исходный текст
Ответ на Re: where to divide application and database  (David Fetter <david@fetter.org>)
Список 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/

В списке pgsql-general по дате отправления:

Предыдущее
От: Cott Lang
Дата:
Сообщение: Re: Fixing invalid owners on pg_toast tables in 8.3.5
Следующее
От: Sam Mason
Дата:
Сообщение: Re: where to divide application and database