Re: Works as SELECT but not as a VIEW - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Works as SELECT but not as a VIEW
Date
Msg-id 27165.1119813527@sss.pgh.pa.us
Whole thread Raw
In response to Works as SELECT but not as a VIEW  (Robert Creager <Robert_Creager@LogicalChaos.org>)
Responses Re: Works as SELECT but not as a VIEW
List pgsql-bugs
Robert Creager <Robert_Creager@LogicalChaos.org> writes:
> This doesn't seem right:

> CREATE VIEW inci AS
> SELECT date, inci_id, protocol, a.ip_addr, b.ip_addr, spt, dpt
> FROM      (SELECT addr_id, ip_addr FROM addrs) AS a
>      JOIN incident ON incident.source_addr_id =3D a.addr_id=20
>      JOIN (SELECT addr_id, ip_addr FROM addrs)=20
>            AS b ON incident.destination_addr_id =3D b.addr_id
>      JOIN protocols USING( protocol_id );

> Produces: ERROR:  column "ip_addr" duplicated

Why doesn't it seem right?  You're asking it to generate a view with
two columns both named ip_addr.  Use "AS" to rename one or both.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Robert Creager
Date:
Subject: Works as SELECT but not as a VIEW
Next
From: Robert Creager
Date:
Subject: Re: Works as SELECT but not as a VIEW