Re: column default dependant on another columns value
От | Richard Broersma |
---|---|
Тема | Re: column default dependant on another columns value |
Дата | |
Msg-id | 396486430807011344t4e305cd8n510b1e79496c8cdd@mail.gmail.com обсуждение исходный текст |
Ответ на | column default dependant on another columns value ("Fernando Hevia" <fhevia@ip-tel.com.ar>) |
Ответы |
Re: column default dependant on another columns value
|
Список | pgsql-sql |
On Tue, Jul 1, 2008 at 1:12 PM, Fernando Hevia <fhevia@ip-tel.com.ar> wrote: > Given a table with columns seconds and minutes, how can I have minutes be > computed automatically at the insert statement? It is possible to do this with a trigger or a rule. A trigger would be more robust. > Is this correct? Is there another (better/simpler) way to achieve this? Well I might work, but it is a bad practice to get into since what you are trying to do violates the rules of database normalization. Wouldn't it be better to calculate the minutes with you query your table? SELECT *, seconds / 60 AS minutes FROM yourtable; -- Regards, Richard Broersma Jr. Visit the Los Angles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug
В списке pgsql-sql по дате отправления: