Triggers, Stored Procedures, PHP. was: Re: PostgreSQL Advocacy, Thoughts and Comments - Mailing list pgsql-general

From Paul Thomas
Subject Triggers, Stored Procedures, PHP. was: Re: PostgreSQL Advocacy, Thoughts and Comments
Date
Msg-id 20031129114528.E9760@bacon
Whole thread Raw
Responses Re: Triggers, Stored Procedures, PHP. was: Re: PostgreSQL  (Jonathan Bartlett <johnnyb@eskimo.com>)
Re: Triggers, Stored Procedures, PHP. was: Re: PostgreSQL Advocacy, Thoughts and Comments  ("Rod K" <rod@23net.net>)
Re: Triggers, Stored Procedures, PHP. was: Re: PostgreSQL Advocacy, Thoughts and Comments  (Martin Marques <martin@bugs.unl.edu.ar>)
Re: Triggers, Stored Procedures, PHP. was: Re: PostgreSQL Advocacy, Thoughts and Comments  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On 28/11/2003 17:10 Jason Tesser wrote:
> [snip]
>
> I completely disagree.  I do a lot of programming with PHP and the
> features
> of Postgres come in handy.  Let me give you an example of just some
> basic things.  Triggers!  Why should I have to write insert and update
> triggers in the logic (PHP) if I can handle it at the database level.
> Sql
> is 10x as fast as the language.  Better to handle what you can at the
> database
> level. Same with views and stored procedures.

Stored procedures can be a 2-edged sword. They can lead to business logic
being scattered between the persistence layer and the business layer.
Thats not good for maintaining the application 3 years down the line.
Triggers can also cause maintenance problems. Its so easy to forget/fail
to document that inserting a record into table x causes column y of table
z to be updated. Be careful how and where you use these features as they
can come back to bite you!

> MySQL cannot even handle
> sub-queries yet. I also use Python for standalone interfaces to the data.
>
> Why should I not be able to use the same views and triggers etc  in there
> that I use for my web apps.  PHP is quite powerful if used correctly.

You are, of course, free to do whatever want. But if you have to use
features of the database to compensate for inadequacies in your
programming language maybe you should be using another language?

> Java has its own issues and I am not sure it is as far supiour as you
> are claming it is.  But that is not for this dscussion.

I'm not aware of any "issues" with Java (unless you mean Swing ;)).
> MySQL may be more
> popular with (cheap) web hosting places but that doesn't mean it is the
> best
> or that Postgres wouldn't serve better even in this area.  I am glad
> to see the article written for PHP mag as Postgres would help alot of PHP
> guys that are using MySQL.

Much of the populatity of MySQL seems to stem from PHPs out-of-the-box
support for it. With the MySQL client library license change, this
situation will probably change. There was a long thread about this earlier
this year. Check the archives.


--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for the Smaller
Business |
| Computer Consultants         |
http://www.thomas-micro-systems-ltd.co.uk   |
+------------------------------+---------------------------------------------+


pgsql-general by date:

Previous
From: Unihost Web Hosting
Date:
Subject: Re: PostgreSQL Advocacy, Thoughts and Comments
Next
From: Jeff Davis
Date:
Subject: Re: Misplaced modifier in Postgresql license