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

From Prabu Subroto
Subject Re: Trigger on Postgres for tables syncronization
Date
Msg-id 20040727133537.34475.qmail@web41807.mail.yahoo.com
Whole thread Raw
In response to Re: Trigger on Postgres for tables syncronization  (Csaba Nagy <nagy@ecircle-ag.com>)
Responses Re: Trigger on Postgres for tables syncronization  (Csaba Nagy <nagy@ecircle-ag.com>)
Re: Trigger on Postgres for tables syncronization  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
List pgsql-general
But I think, the modification of records to the table
"appointment0" dan "appointment1" must be done
automatically if my program modifies the
"appointment". That's why I think I should use trigger
and function.

Please tell me more detail.
--- Csaba Nagy <nagy@ecircle-ag.com> wrote:
> Prabu,
>
> You should use views for appointment0 and
> appointment1.
> That way when you insert/modify in appointment, the
> modifications will
> automatically show up in the views too.
>
> See also
>
http://www.postgresql.org/docs/7.4/static/sql-createview.html
> on how to create a view.
>
> Cheers,
> Csaba.
>
> On Tue, 2004-07-27 at 13:58, Prabu Subroto wrote:
> > Dear my friends...
> >
> > I am using SuSE Linux 9.1 and postgres. I am a
> > beginner in postgres, usually I use MySQL.
> >
> > I have 3 tables : appointment, appointment0 and
> > appointment1.
> >
> > the fields of table "appointment" are as follows:
> > noapp*         (int4):ID Number of appointment (PK)
> > custid        (int4) : Customer ID
> > salesid        (int4) : Sales ID
> > date        (date) : Date of appointment
> > time        (time) : Time of appointment
> > todo        (char(150)) : What's to do with them
> > done        (char(1)): whether done (N/Y)
> > warned        (char(1)): whether warned with prompt
> > timestamp    (timestamp) : timestamp of record
> >
> > "appointment0" and "appointment1" have exactly the
> > same field names as what "appointment" has.
> >
> > But...
> > 1. the population of "appointment0" and
> "appointment1"
> > are the subset of "appointment"
> > 2. what the "appointment0" has are the members of
> > "appointment" whose "Y" as the value of fieldname
> > "done".
> > 3. and what "appointmnet1" has are the members of
> > "appointment" whose "N" as the value of fieldname
> > "done".
> >
> > I want if my program inserted, updated, deleted
> the
> > record of "appointment" than the postgres does the
> > syncronization to the corresponded tables
> > (appointment0 or appointment1 or both).
> >
> > Is it possible to implement this strategy with
> > trigger? But how?
> >
> > Where Can I find a good documentation about the
> > trigger of postgres especially the PLPGSQL of the
> > postgres?
> >
> > Anybody would be so nice to tell me the steps and
> the
> > command of the triggers should be in order to
> > implement my strategy? Please....
> >
> > Please....
> >
> > Thank you very much in advance.
> >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Mail - 50x more storage than other
> providers!
> > http://promotions.yahoo.com/new_mail
> >
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 7: don't forget to increase your free space
> map settings
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose
> an index scan if your
>       joining column's datatypes do not match
>




__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail

pgsql-general by date:

Previous
From: Mike Nolan
Date:
Subject: Re: Trigger on Postgres for tables syncronization
Next
From: Prabu Subroto
Date:
Subject: Re: Trigger on Postgres for tables syncronization