Search Postgresql Archives

Re: no self-joins in views?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 10, 2005 at 05:13:51PM +0100, Christoph Pingel wrote:
> Hello,
> 
> is there any restriction re the use of self joins in views? I have a 
> moderately complicated query where I scan the same table twice using 
> aliases, and I would like to put that into a view to keep my python 
> code clean. However, I get an error 'column xy duplicated'. Is this 
> so by design?

It's probably complaining that the *resultset* has two columns with the
same name. Consider:

CREATE VIEW test AS
  SELECT * FROM table, table 
  WHERE table.a = table.b;

Basically, the output of the view will have all the columnnames listed
twice. You'll need to rename them to make it work...

Hope this helps,
-- 
Martijn van Oosterhout   <kleptog@xxxxxxxxx>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment: pgprxvjJncsiI.pgp
Description: PGP signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux