Re: Stored procedure - change columns in a table that is being updated / inserted on?

From: bryan(at)flyingiranch(dot)com
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Stored procedure - change columns in a table that is being updated / inserted on?
Date: 2003-03-08 23:11:17
Message-ID: H00000660001d07b.1047165077.mule.flyingiranch.com@MHS
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

> This sure seems like the hard way to do it. If you really want
> tbluserhealthcalculated to be separate from the underlying table,
> why don't you make it a view?
>
> CREATE VIEW tbluserhealthcalculated AS
> SELECT *, (userWeight / (userHeight * userHeight)) AS bmi
> FROM tbluserhealthbasic;

Excellent idea - thanks. I _am_ a novice, so that advice really gives me
some insight.

>
> On the other hand, if you'd rather there were only one table, you
> should be fixing the bmi value in a BEFORE trigger not an
> AFTER trigger.

Also good advice - I didn't really understand the purpose of BEFORE, but
now I undestand that it preps the values before they are committed to
the table.

Thanks again,

Bryan

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2003-03-08 23:17:50 Re: Stored procedure - change columns in a table that is being updated / inserted on?
Previous Message bryan 2003-03-08 22:41:15 Stored procedure - change columns in a table that is being updated / inserted on?