Re: [SQL] column default dependant on another columns value

2008-07-02 Thread Fernando Hevia
> -Mensaje original- > De: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] En nombre de Tom Lane > Enviado el: Martes, 01 de Julio de 2008 19:24 > Para: Fernando Hevia > CC: 'Richard Broersma'; pgsql-sql@postgresql.org > Asunto: Re: [SQL] column default dep

Re: [SQL] column default dependant on another columns value

2008-07-01 Thread Tom Lane
"Fernando Hevia" <[EMAIL PROTECTED]> writes: > Anyway, the rule didn't work. Got "an infinite recursion error" when > inserting on the table. > Can't figure out where the recursion is You didn't show us the rule, but I imagine that you think the WHERE clause is applied while expanding the rule. I

Re: [SQL] column default dependant on another columns value

2008-07-01 Thread Fernando Hevia
> -Mensaje original- > De: Richard Broersma [mailto:[EMAIL PROTECTED] > > 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 prac

Re: [SQL] column default dependant on another columns value

2008-07-01 Thread Richard Broersma
On Tue, Jul 1, 2008 at 1:12 PM, Fernando Hevia <[EMAIL PROTECTED]> 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 c