From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Sebastian Böck <sebastianboeck(at)freenet(dot)de> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Bug with view definition? |
Date: | 2005-06-08 16:11:59 |
Message-ID: | 42A718CF.30608@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Sebastian Böck wrote:
> Richard Huxton wrote:
>
>> Sebastian Böck wrote:
>>
>>> Hello all,
>>>
>>> why is the last definition of a view not working, although the
>>> documentation says all three are equal?
>>>
>>
>>
>>> CREATE OR REPLACE VIEW not_working AS
>>> SELECT one.*
>>> FROM one.one, two.two
>>> JOIN join1 ON join1.id = one.id;
>>
>>
>>
>> I think it's trying to join "two" to "join1" - try
>> ...FROM two.two, one.one
>> JOIN join1...
>
>
> Sure, but the problem still exists if you want to join with table one
> and table two.
Sorry - hadn't read the initial post carefully enough, and didn't see
the unconstrained join on one,two. Since "JOIN" has a high precedence
you'll want to force the issue with a subselect:
SELECT *
FROM (
SELECT one.* FROM one.one, two.two
) AS dummy
JOIN join1 ON join1.id = dummy.id
--
Richard Huxton
Archonet Ltd
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2005-06-08 16:15:30 | Re: Foreign keys and slow insert |
Previous Message | Sebastian Böck | 2005-06-08 16:07:43 | Re: Bug with view definition? |