Outer joins in views

Started by PostgreSQL Bugs Listover 25 years ago2 messagesbugs
Jump to latest
#1PostgreSQL Bugs List
pgsql-bugs@postgresql.org

Grzegorz M. Mucha (mucher@tigana.pl) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
Outer joins in views

Long Description
In the 7.1 devel version, the OUTER JOIN statementes are working, but not in VIEWs. I have created the below listed view, and while it allows to be created, any attempt of using it ends with:

ERROR: Internal error: no jointree entry for rel *OLD*

Sample Code
create view ec_recommendations_cats_view as select
recs.recommendation_id,
COALESCE(cats.category_name,COALESCE(subs.category_name,subsubs.category_name)) AS the_category_name,
COALESCE(subs.subcategory_name,subsubs.subcategory_name) AS the_subcategory_name,
subsubs.subsubcategory_name AS the_subsubcategory_name,
p.product_name,
c.user_class_name
from ec_products p,
ec_product_recommendations recs LEFT OUTER JOIN
ec_categories cats on recs.category_id = cats.category_id
LEFT OUTER JOIN
ec_subcategories_augmented subs on recs.subcategory_id = subs.subcategory_id
LEFT OUTER JOIN
ec_subsubcategories_augmented subsubs on recs.subsubcategory_id = subsubs.subcategory_id
left outer join
ec_user_classes c on recs.user_class_id=c.user_class_id
where recs.active_p='t'
and recs.product_id = p.product_id;

No file was uploaded with this report

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: PostgreSQL Bugs List (#1)
Re: Outer joins in views

pgsql-bugs@postgresql.org writes:

In the 7.1 devel version, the OUTER JOIN statementes are working, but
not in VIEWs. I have created the below listed view, and while it
allows to be created, any attempt of using it ends with:
ERROR: Internal error: no jointree entry for rel *OLD*

Thanks for the report. However, I can't easily reproduce it with just
the CREATE VIEW command. Could I have CREATE TABLE statements for the
referenced tables, too, please?

regards, tom lane