Re: help please

From: frbn <frbn(at)efbs-seafrigo(dot)fr>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: help please
Date: 2002-09-04 09:23:56
Message-ID: 3D75D12C.6030001@efbs-seafrigo.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dorward Villaruz a écrit:
> i need to create a table with this property
>
>
> the fields are f1 integer , f2 integer , f3 integer defaults to f1 + f2

you shouldn't store f1+f2, as you already store f1 and f2.

> i have created something like this
>
>
> create table table1(a integer not null unique primary key, b integer not
> null, c not null default a + b)

"you can't use attributes in the default clause"

if you *really* want to do that, use a trigger after insert: update f3 with f1+f2

In response to

  • help please at 2002-09-02 14:48:50 from Dorward Villaruz

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bob Parkinson 2002-09-04 10:16:59 clog problem
Previous Message Søren Neigaard 2002-09-04 08:36:51 'Bad timestamp external representation' error when restoring database