Re: Trigger on Postgres for tables syncronization

From: Arguile <arguile(at)lucentstudios(dot)com>
To: Prabu Subroto <prabu_subroto(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Trigger on Postgres for tables syncronization
Date: 2004-07-27 20:36:48
Message-ID: 1090960608.4530.13545.camel@broadswd.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 2004-07-27 at 09:55, Prabu Subroto wrote:
> PS>and if the view changes, does it also change the
> related record in table "appointment0" and "appointment1"?

Yes, because a view is pretty much just a stored query (Pg does't have
materialised views).

CREATE VIEW apointment0 AS
SELECT *
FROM appointment
WHERE done = 'Y';

You can then do further queries on that view in the same way as a table.
If you want to treat the view as a table for DML as well -- or to see
how views work internally -- see the "Rules" section of the Pg
documentation.

P.S. Consider using "done BOOLEAN NOT NULL DEFAULT FALSE" (the boolean
is what really matters) instead of "done CHAR(1) NOT NULL CHECK(done
IN('Y', 'N'))".. You might also consider some sort of index that
includes "done" depending on your data and usage.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Arguile 2004-07-27 21:08:41 Re: isNumeric function?
Previous Message =?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?= 2004-07-27 18:55:39 tablename type?