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

From bryan@flyingiranch.com
Subject Re: Stored procedure - change columns in a table that is being updated / inserted on?
Date
Msg-id H00000660001d07f.1047165655.mule.flyingiranch.com@MHS
Whole thread Raw
In response to Stored procedure - change columns in a table that is being updated / inserted on?  (bryan@flyingiranch.com)
Responses Re: Stored procedure - change columns in a table that is
List 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;

Next question: One of the reasons a function is attractive to me in this
situation is that I also have some conditionals to handle. For instance,
Base Metabolic Rate is different whether you are male or female (gender
is a boolean value in my table). Can I use IF/THEN syntax in a view
definition?

Bryan


Attachment

pgsql-novice by date:

Previous
From: bryan@flyingiranch.com
Date:
Subject: Re: Stored procedure - change columns in a table that is being updated / inserted on?
Next
From: "Rod Kreisler"
Date:
Subject: String manipulation in plpgsql