From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
---|---|
To: | Christoph Pingel <ch(dot)pingel(at)web(dot)de> |
Cc: | postgresql-general mailing list <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: no self-joins in views? |
Date: | 2005-02-10 16:54:20 |
Message-ID: | 20050210165419.GC19117@svana.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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(at)svana(dot)org> 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Fuhr | 2005-02-10 17:00:22 | Re: no self-joins in views? |
Previous Message | Richard Huxton | 2005-02-10 16:53:48 | Re: no self-joins in views? |