Re: is it possible to store results of aggregate calculations in table fields? - Mailing list pgsql-novice

From David G Johnston
Subject Re: is it possible to store results of aggregate calculations in table fields?
Date
Msg-id 1413237609420-5822886.post@n5.nabble.com
Whole thread Raw
In response to is it possible to store results of aggregate calculations in table fields?  (Jude DaShiell <jdashiel@panix.com>)
List pgsql-novice
Jude DaShiell wrote
> If I can do that and use table field values to do calculations once moved
> it won't be necessary for me to use plr.  Earlier I tried:
> max_cystalic_pressure int NOT NULL, default max(cystalic_pressure),
> and psql won't create the table complaining about default and DEFAULT and
> def_EXPR I intended to be max(cystalic_pressure).
> Unfortunately Linux command line environment hasn't got anything able to
> compete with excel in terms of excel's functions which is why I tried this
> database system at all.   I hope I do not have to use Windows to get this
> done.

Insert into sometable (somefield)
Select max(field) from someothertable

You can try trigger functions

You can try a materialized view

You can try a simple view

You cannot use an aggregate in a default...it doesn't even make sense what
doing so would mean.

You can explain in more detail what your goal is instead and not assume you
need to store an aggregate in a field to accomplish it.

David J.



--
View this message in context:
http://postgresql.1045698.n5.nabble.com/is-it-possible-to-store-results-of-aggregate-calculations-in-table-fields-tp5822876p5822886.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.


pgsql-novice by date:

Previous
From: Daniel Staal
Date:
Subject: Re: is it possible to store results of aggregate calculations in table fields?
Next
From: Jude DaShiell
Date:
Subject: got some help with aggregates