I agree the query is a little odd, but I like backwards compatibility!


Postgres 8.4.1
----------------------
CREATE VIEW v_members AS
 SELECT
   1 as member_id,
   100 as tenant_id,
   3732 as conference_id,
   200 as uid
 FROM
   (select 1 as uid_user, 2 as uid_contact) as m;

SELECT
   u.tenant_id,
   u.uid
 FROM
   (select 100 as tenant_id, 200 as uid) u
   LEFT JOIN v_members m ON (m.uid = u.uid AND m.conference_id = 3732)
 WHERE
  (
    SELECT 1
    FROM   (select 3732 as conference_id) c
    WHERE  (c.conference_id = 3732) AND (m.uid IS NOT NULL)
  ) = 1;

 tenant_id | uid
-----------+-----
       100 | 200
(1 row)




postgres 9.1.3
--------------------------

CREATE VIEW v_members AS
 SELECT
   1 as member_id,
   100 as tenant_id,
   3732 as conference_id,
   200 as uid
 FROM
   (select 1 as uid_user, 2 as uid_contact) as m;

SELECT
   u.tenant_id,
   u.uid
 FROM
   (select 100 as tenant_id, 200 as uid) u
   LEFT JOIN v_members m ON (m.uid = u.uid AND m.conference_id = 3732)
 WHERE
  (
    SELECT 1
    FROM   (select 3732 as conference_id) c
    WHERE  (c.conference_id = 3732) AND (m.uid IS NOT NULL)
  ) = 1;

ERROR:  Upper-level PlaceHolderVar found where not expected



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

Reply via email to