Extracting data from the view to retrieve the foreign key is not declared - Mailing list pgsql-general

From nill
Subject Extracting data from the view to retrieve the foreign key is not declared
Date
Msg-id 1394472222116-5795408.post@n5.nabble.com
Whole thread Raw
Responses Re: Extracting data from the view to retrieve the foreign key is not declared  (Albe Laurenz <laurenz.albe@wien.gv.at>)
List pgsql-general
Given a view, I need to extract tables, the join columns (ON) . I need to do
this analysis because of the view (agreements with the join condition and
where) I can say that there is a foreign key

Example:

CREATE OR REPLACE VIEW x_customer AS
SELECT a.asset_id, a.client_id
FROM asset_d ad, asset a ON asset_id = ad.asset_id

Result:

NAMEVIEW |TABLE1    | COLUMN1  | TABLE2 | COLUMN2
x_customer| asset_d  | asset_id    | asset    | asset_id   |
x_customer| asset      | -                |  -           | -               |

OR

CREATE OR REPLACE VIEW x_customer AS
 SELECT a.asset_id, a.client_id, a.org_id, a.isactive, a.created,
a.createdby, a.updated, a.updatedby, a.value, a.name, a.description,
a.ad_user_id, ( SELECT count(*) AS count
           FROM asset_d ad
          WHERE a.asset_id = ad.asset_id) AS deliverycount
   FROM asset a
  WHERE a.bpartner_id IS NOT NULL;
Result:

NAMEVIEW |TABLE1    | COLUMN1  | TABLE2 | COLUMN2
x_customer| asset_d  | asset_id    | asset    | asset_id   |

Someone can help me?
Thanks




--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Extracting-data-from-the-view-to-retrieve-the-foreign-key-is-not-declared-tp5795408.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


pgsql-general by date:

Previous
From: bricklen
Date:
Subject: Re: Playing with 9.4devel - unnest
Next
From: "Daniel Verite"
Date:
Subject: Re: libpq - lack of support to set the fetch size