Re: Database query: Notification about change?

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Database query: Notification about change?
Дата
Msg-id 20051205204053.GB19356@wolff.to
обсуждение исходный текст
Ответ на Database query: Notification about change?  (Erik Sigra <sigra@kth.se>)
Ответы Re: Database query: Notification about change?  (Erik Sigra <sigra@kth.se>)
Список pgsql-sql
On Mon, Dec 05, 2005 at 19:22:22 +0100, Erik Sigra <sigra@kth.se> wrote:
> Hi,
> I plan to develop an application that is somewhat like a spreadsheet
> with cells containing formulas. When a cell value is changed, things
> must be updated. But the formulas can contain database queries, which
> means that the cell has to be notified when the database changes in such 
> a way that the result of the query changes. How is this done? I would 
> really like to avoid recalculating the whole thing for each change to 
> the database.
> 
> I looked in my database book and read about materialized views and 
> triggers. It seems like I should do the following:
> 1. Make a materialized view from the query.
> 2. Add a trigger for changes to this view.
> 3. Make the trigger notify the application program when it is trigged.
> 
> Would this be possible? (I was planning to use Qt for application 
> programming and database access.)

Postgres provides the NOTIFY command
(http://developer.postgresql.org/docs/postgres/sql-notify.html)
and you could use that in appropiate triggers to let your application know
that it needs to refresh that values in at least some cells.
You shouldn't need to use materialized views though. Just put the triggers
on the base tables.


В списке pgsql-sql по дате отправления:

Предыдущее
От: Michael Burke
Дата:
Сообщение: Database with "override" tables
Следующее
От: "Lane Van Ingen"
Дата:
Сообщение: Re: Database with "override" tables