BUG #14524: Commands compare with nested subquery expressions fail with "should not reference subplan var"

Started by Wèi Cōngruìabout 9 years ago4 messagesbugs
Jump to latest
#1Wèi Cōngruì
crvv.mail@gmail.com

The following bug has been logged on the website:

Bug reference: 14524
Logged by: Wei Congrui
Email address: crvv.mail@gmail.com
PostgreSQL version: 9.6.1
Operating system: Linux
Description:

SQLs which do not work are
SELECT '1' IN (SELECT (SELECT '1'::BOOL))
SELECT '1' = ANY (SELECT (SELECT '1'::BOOL))
SELECT '1' = ALL (SELECT (SELECT '1'::BOOL))
SELECT '1' = ALL (SELECT (SELECT '1'::TEXT))
SELECT '1' = ALL (SELECT (SELECT '1'::INT))

Similar SQLs but work are
SELECT '1' IN (SELECT (SELECT '1'::INT))
SELECT '1' = ANY (SELECT (SELECT '1'::TEXT))

Error message is "plan should not reference subplan's variable".

With all other majar verions, I can get the right result.

I reproduced it on Travis. https://travis-ci.org/crvv/pg

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

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Wèi Cōngruì (#1)
Re: BUG #14524: Commands compare with nested subquery expressions fail with "should not reference subplan var"

crvv.mail@gmail.com writes:

SELECT '1' IN (SELECT (SELECT '1'::BOOL))
Error message is "plan should not reference subplan's variable".

Seems to be a problem with pasting on Material nodes at the last minute.
As a short-term workaround, you might try turning off enable_material.

regards, tom lane

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

#3Wèi Cōngruì
crvv.mail@gmail.com
In reply to: Tom Lane (#2)
Re: BUG #14524: Commands compare with nested subquery expressions fail with "should not reference subplan var"

Thanks for your reply.

By turning off 'enable_material', I can execute these SQL successfully.

Will this be fixed in minor release or next major release?

2017-02-03 6:48 GMT+08:00 Tom Lane <tgl@sss.pgh.pa.us>:

Show quoted text

crvv.mail@gmail.com writes:

SELECT '1' IN (SELECT (SELECT '1'::BOOL))
Error message is "plan should not reference subplan's variable".

Seems to be a problem with pasting on Material nodes at the last minute.
As a short-term workaround, you might try turning off enable_material.

regards, tom lane

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Wèi Cōngruì (#3)
Re: BUG #14524: Commands compare with nested subquery expressions fail with "should not reference subplan var"

CR VV <crvv.mail@gmail.com> writes:

Will this be fixed in minor release or next major release?

Yes, it's fixed for this week's minor releases.

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=555494d1bc119173bbf712940da823303644d4de

regards, tom lane

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