Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

Responses

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group