Re: help please - Mailing list pgsql-general

From frbn
Subject Re: help please
Date
Msg-id 3D75D12C.6030001@efbs-seafrigo.fr
Whole thread Raw
In response to help please  ("Dorward Villaruz" <dorwardv@ntsp.nec.co.jp>)
Responses clog problem  (Bob Parkinson <rwp@biome.ac.uk>)
List 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



pgsql-general by date:

Previous
From: Curt Sampson
Date:
Subject: A Testimonial
Next
From: Bob Parkinson
Date:
Subject: clog problem