Re: regarding triggers

Поиск
Список
Период
Сортировка
От Harry Jackson
Тема Re: regarding triggers
Дата
Msg-id 45b42ce40601100946y2f1e3297hdaf9eb7d66184b34@mail.gmail.com
обсуждение исходный текст
Ответ на Re: regarding triggers  (John McCawley <nospam@hardgeus.com>)
Список pgsql-general
On 1/10/06, John McCawley <nospam@hardgeus.com> wrote:
> Regarding the usefulness of triggers...I tend to stay away from them.  I
> like to keep my data in my database and my logic in my application.  I
> try to relegate triggers to very simple things like timestamping
> records.  i.e. things that I won't later wonder "What in the hell is
> going on???"

I always try to get all the relationships from the data into the
database using whatever the database can do ie triggers, foriegn keys,
check constraints etc. I find that leaving all the logic to the
application is a disaster waiting to happen particularly when the
application is being developed by lots of people.

If you insist in having all the logic in the application then surely
you could use triggers to make sure that if the application makes a
cock up then the integrity of the data won't be compromised. I know
you can use "begin;  commit;" from the application but when working
with other developers there are no guarantees that they will always be
using them or more likely a mistake will be made by me or someone else
and I want the database to handle it.

--
Harry
http://www.hjackson.org
http://www.uklug.co.uk

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

Предыдущее
От: Jaime Casanova
Дата:
Сообщение: Re: q: explain analyze
Следующее
От: "Jonathan Roby"
Дата:
Сообщение: copy a postgres dbase to the same machine with different name?