Robert Creager <Robert_Creager(at)LogicalChaos(dot)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