Re: create view error - Mailing list pgsql-sql

From mila boldareva
Subject Re: create view error
Date
Msg-id 1717486813.20030707140629@pierro.dds.nl
Whole thread Raw
In response to create view error  (Gary Stainburn <gary.stainburn@ringways.co.uk>)
List pgsql-sql
Hi, Gary!

> CREATE
> create view loco_dets as
>   select * from locos l
>       left outer join 
>         (select * from lclass) lc on lc.lcid = l.lclass
>       left outer join
(*)          (select lnumber from lnumbers) ln on ln.lnid = l.lid and ln.lncurrent
> = true
>       left outer join
>         (select * from company) c on c.coid = lc.lcompany;
> ERROR:  No such attribute or function ln.lnid


your subselect on line (*) does not contain lnid in the list of
selected fields.

I suspect you can also use constructions like
select * from locos l left outer join lclass lc on (lc.lcid = l.lclass)
instead of what you use:
> select * from locos l
>       left outer join 
>         (select * from lclass) lc on lc.lcid = l.lclass 

in this way you automatically avoid the error that you had!

cheers,
Mila



pgsql-sql by date:

Previous
From: "Ali Adams"
Date:
Subject: help yourself by helping others
Next
From: markus brosch
Date:
Subject: max length of sql select statement ?