This is not a bug; given your test queries whenever you reference “id1” you
are ALWAYS referencing the column “id1” in table “test2”.

>>test=# select * from test2 where id1 in (select id1 from test1) and
charge=70;
>> id1 | charge 
>>-----+--------
>>  10 |     70
>> (1 row)

Hint: Consider the results of:

SELECT ‘literal’ FROM table1;

AND

SELECT
t1.*,
(SELECT t2.col2 FROM t2 WHERE t2.id = t1.id)
FROM t1;

David J.



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to