Re: Works as SELECT but not as a VIEW

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Creager <Robert_Creager(at)LogicalChaos(dot)org>
Cc: PGBugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Works as SELECT but not as a VIEW
Date: 2005-06-26 19:18:47
Message-ID: 27165.1119813527@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Creager 2005-06-26 19:32:48 Re: Works as SELECT but not as a VIEW
Previous Message Robert Creager 2005-06-26 18:54:03 Works as SELECT but not as a VIEW