From: | "Ray Madigan" <ray(at)madigans(dot)org> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Trigger on select :-( |
Date: | 2010-03-02 02:10:47 |
Message-ID: | CMEFJOLLJJDJKKLGEJJMOELBDDAA.ray@madigans.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
What I want is to have a trigger on select, but since I have searched the
archives I know that is not possible. I also read that view rules is the
technology is whats available. Having never used views before I can't seem
to get my mind to figure out what I need to do to solve my problem.
I have a table that defines a key that I will use in another table in a list
of items defined in the previous table.
The tables are
CREATE TABLE Foo ( INTEGER key not null primary key,
... characteristics for the Foo item );
CREATE TABLE Catalog ( INTEGER FooKey FOREIGN KEY,
... other catalog data );
The catalog will have rows that reference the elements in the Foo table.
I also have another table that references the Foo table
CREATE TABLE ToDo ( INTEGER FooKey FOREIGN KEY,
... other ToDo information.
What I want to do is when I do a SELECT on the Catalog and deliver the
result to the user, I want to check to see if the FooKey is in the users
ToDo table and set the value of a column isToDo to true or false depending
on if the FooKey exists in the ToDo table for the user. If I were building
a table I would use a trigger and select on the row in the ToDo table.
Please, all I want is an idea where to start, what I should read and I will
figure out how to do it.
Thanks in advance.
Attachment | Content-Type | Size |
---|---|---|
winmail.dat | application/ms-tnef | 2.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | rawi | 2010-03-02 09:43:23 | Re: kind of RULE on SELECT depending on existence of a WHERE condition |
Previous Message | Petru Ghita | 2010-03-01 22:38:14 | Re: Create functions using a function |