Works as SELECT but not as a VIEW

From: Robert Creager <Robert_Creager(at)LogicalChaos(dot)org>
To: PGBugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Works as SELECT but not as a VIEW
Date: 2005-06-26 18:54:03
Message-ID: 20050626125403.5e8c6cae@thunder.logicalchaos.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


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 = a.addr_id
JOIN (SELECT addr_id, ip_addr FROM addrs)
AS b ON incident.destination_addr_id = b.addr_id
JOIN protocols USING( protocol_id );

Produces: ERROR: column "ip_addr" duplicated

Yet the select on it's own works just fine... I've attached the database
definition.

version

-------------------------------------------------------------------------------
--------------------------
PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.2
(Mandrake Linux 10.0 3.3.2-6mdk)

Thanks,
Rob

--
12:31:42 up 24 days, 14:10, 6 users, load average: 3.08, 2.63, 2.63
Linux 2.6.5-02 #8 SMP Mon Jul 12 21:34:44 MDT 2004

Attachment Content-Type Size
test.sql application/octet-stream 1.7 KB

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2005-06-26 19:18:47 Re: Works as SELECT but not as a VIEW
Previous Message Magnus Hagander 2005-06-26 18:47:49 Re: BUG #1727: Corrupt Zip file?