Error with views containing sub-queries with distinct

From: "Sean P(dot) Thomas" <spt(at)ulanji(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Error with views containing sub-queries with distinct
Date: 2003-10-17 14:59:50
Message-ID: 3F9003E6.1050601@ulanji.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shridhar Daithankar 2003-10-17 15:00:04 Re: Some thoughts about i/o priorities and throttling vacuum
Previous Message Shridhar Daithankar 2003-10-17 14:53:35 Re: Some thoughts about i/o priorities and throttling vacuum