Re: Trigger on Postgres for tables syncronization - Mailing list pgsql-general

From Arguile
Subject Re: Trigger on Postgres for tables syncronization
Date
Msg-id 1090960608.4530.13545.camel@broadswd.local
Whole thread Raw
In response to Re: Trigger on Postgres for tables syncronization  (Prabu Subroto <prabu_subroto@yahoo.com>)
List 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.



pgsql-general by date:

Previous
From: "Marc G. Fournier"
Date:
Subject: Re: NNTP server
Next
From: Bill Moran
Date:
Subject: PostgreSQL running in FreeBSD jail corrupts PostgreSQL running on the host system