Re: using queries as default value? - Mailing list pgsql-novice

From Josh Berkus
Subject Re: using queries as default value?
Date
Msg-id 200305301524.21168.josh@agliodbs.com
Whole thread Raw
In response to using queries as default value?  (Don Patou <pknoob@noos.fr>)
List pgsql-novice
Don,

> is it possible to have a query as a column default value. I have a statistic
> table and I would like one of its column to do like "select count(colx) from
> anothertable".
> What's the best way to do this?

Add a Trigger to the table.   See Triggers in the online docs, and also under
the PL/pgSQL docs (under "Procedural Languages").

--
-Josh Berkus
 Aglio Database Solutions
 San Francisco


pgsql-novice by date:

Previous
From: Herbie
Date:
Subject: nOOB Question..
Next
From: Nabil Sayegh
Date:
Subject: Re: using queries as default value?