dbTalk Databases Forums  

Re: [BUGS] Works as SELECT but not as a VIEW

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss Re: [BUGS] Works as SELECT but not as a VIEW in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] Works as SELECT but not as a VIEW - 06-26-2005 , 02:20 PM






Robert Creager <Robert_Creager (AT) LogicalChaos (DOT) org> writes:
Quote:
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

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org


Reply With Quote
  #2  
Old   
Robert Creager
 
Posts: n/a

Default Re: [BUGS] Works as SELECT but not as a VIEW - 06-26-2005 , 02:34 PM






--Signature_Sun__26_Jun_2005_13_32_48_-0600_Ku3nq68QCS6X22G5
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

When grilled further on (Sun, 26 Jun 2005 15:18:47 -0400),
Tom Lane <tgl (AT) sss (DOT) pgh.pa.us> confessed:

Quote:
Robert Creager <Robert_Creager (AT) LogicalChaos (DOT) org> writes:
This doesn't seem right:
=20
[ snip embarrassing mistake ]
=20
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.
=20
So the SELECT can manage this bot not the VIEW? Thanks for catching my mis=
take.

Cheers,
Rob

--=20
13:29:26 up 24 days, 15:07, 6 users, load average: 1.90, 2.31, 2.78
Linux 2.6.5-02 #8 SMP Mon Jul 12 21:34:44 MDT 2004

--Signature_Sun__26_Jun_2005_13_32_48_-0600_Ku3nq68QCS6X22G5
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iEYEARECAAYFAkK/AuAACgkQLQ/DKuwDYzl0egCfVGPFQZtYRCCsL5u05OR3ok+m
cdUAoIGjvd7x2fgI7p/LAZe55DaX7v64
=oM+1
-----END PGP SIGNATURE-----

--Signature_Sun__26_Jun_2005_13_32_48_-0600_Ku3nq68QCS6X22G5--


Reply With Quote
  #3  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] Works as SELECT but not as a VIEW - 06-26-2005 , 02:45 PM



Robert Creager <Robert_Creager (AT) LogicalChaos (DOT) org> writes:
Quote:
So the SELECT can manage this bot not the VIEW?
The spec constrains tables (and views) not to have duplicate column
names, but it does not say that about SELECT output lists.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.