From: | Andreas <maps(dot)on(at)gmx(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Is there something like an dynamic view ? |
Date: | 2004-01-24 17:49:07 |
Message-ID: | 4012B013.5020904@gmx.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
I'd like to fetch a selection of records out of a big n:m-relation.
It's something like:
customers (c_id, c_name, c_address, ....);
projects (p_id, p_name, c_start, ....);
cp_relation (c_id, p_id, status_id, ....);
I use Access2000 as client.
The user selects an project_id by a combobox in the customer form. Then
the form should limit it's scope to only those customers that relate to
this project. The form's recordsource should be a SELECT that fetches
just the relevant customer-ids and collects the individual customer's
data when his id is current record.
I'd rather not let Access do the SELECT locally because then the whole
cp_relation had to be transferred.
A postgres-view would be as far as I know static. That is I'd need a
seperate view for every project. That's possible but seems a bit unelegant.
It would be:
view1 : SELECT c_id FROM cp_relation WHERE p_id = 1;
view2 : SELECT c_id FROM cp_relation WHERE p_id = 2;
view3 : SELECT c_id FROM cp_relation WHERE p_id = 3;
...
That screams for a parameter.
Is this possible ?
Thanks for reading so far
Andreas
From | Date | Subject | |
---|---|---|---|
Next Message | Nate Teller | 2004-01-24 17:49:54 | failed index creation: ERROR: index_formtuple |
Previous Message | Tom Lane | 2004-01-24 17:18:53 | Re: Touch row ? |