Re: is it possible to store results of aggregate calculations in table fields?

From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: is it possible to store results of aggregate calculations in table fields?
Date: 2014-10-13 22:00:09
Message-ID: 1413237609420-5822886.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Jude DaShiell 2014-10-14 13:35:49 got some help with aggregates
Previous Message Daniel Staal 2014-10-13 21:53:10 Re: is it possible to store results of aggregate calculations in table fields?