Error with views containing sub-queries with distinct - Mailing list pgsql-hackers

From Sean P. Thomas
Subject Error with views containing sub-queries with distinct
Date
Msg-id 3F9003E6.1050601@ulanji.com
Whole thread Raw
Responses Re: Error with views containing sub-queries with distinct
Re: Error with views containing sub-queries with distinct
List pgsql-hackers
Last night I just upgraded to a nightly snapshot of 7.4 and noticed an 
error on queries that had previously worked (in version 7.3.x and 
previous 7.4's snapshots up to about a month old).

I have a view that I can distill into a base case of:

CREATE VIEW testing_v AS    SELECT table_a.*    FROM table_a    WHERE    (table_a.some_id IN (        SELECT DISTINCT
table_b.some_id       FROM table_b    ));
 

When I do :

select * from testing_v;

I get:

JOIN qualification may not refer to other relations

I have found that if I remove the distinct on the sub-query, it behaves 
as expected.

Yes, I know the distinct is probably useless but we are in the process 
of porting it to postgres and have lots of cleanup left.

We are migrating from a commercial database (and paid good money) and 
found postgres to be a joy (substantially fast, less gotchas, better at 
embeding business logic at db level).

Thank you very much.  I appreciate all the effort that has put into such 
a great product.

                        --spt



PS:  Please cc me as I am not on list.




pgsql-hackers by date:

Previous
From: Mike Mascari
Date:
Subject: Re: Some thoughts about i/o priorities and throttling vacuum
Next
From: "Eduardo D Piovesam"
Date:
Subject: Re: PostgreSQL on Novell Netware 6.5.