Thread: ctid matching behavior changed?

ctid matching behavior changed?

From
"Greg Sabino Mullane"
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message


Why is the subselect never executed for the inner select?


pgrocks=> SELECT VERSION() UNION ALL SELECT oid::text FROM pg_class WHERE ctid = (SELECT ctid FROM pg_class LIMIT 1);
                      version                            
 
--------------------------------------------------------------PostgreSQL 7.3.4 on i686-pc-linux-gnu, compiled by GCC
3.0.116416
(2 rows)


pgrocks=> SELECT VERSION() UNION ALL SELECT oid::text FROM pg_class WHERE ctid = (SELECT ctid FROM pg_class LIMIT 1);
                        version                             
 
-----------------------------------------------------------------PostgreSQL 7.4beta3 on i686-pc-linux-gnu, compiled by
GCC3.0.1
 
(1 row)


7.3.4:
pgrocks=> EXPLAIN ANALYZE SELECT oid FROM pg_class WHERR ctid = (SELECT ctid FROM pg_class LIMIT 1);
                             QUERY PLAN                                                    
 
------------------------------------------------------------------------------------------------------Tid Scan on
pg_class (cost=0.00..4.01 rows=1 width=4) (actual time=0.01..0.01 rows=1 loops=1)  Filter: (ctid = $0)  InitPlan    ->
Limit (cost=0.00..0.03 rows=1 width=6) (actual time=0.02..0.03 rows=1 loops=1)        ->  Seq Scan on pg_class
(cost=0.00..21.82rows=682 width=6) (actual time=0.02..0.02 rows=2 loops=1)
 


7.4beta3:
pgrocks=> EXPLAIN ANALYZE SELECT oid FROM pg_class WHERR ctid = (SELECT ctid FROM pg_class LIMIT 1);
                     QUERY PLAN                                           
 
------------------------------------------------------------------------------------------------Tid Scan on pg_class
(cost=0.04..4.05rows=2 width=4) (actual time=0.00..0.00 rows=0 loops=1)  Filter: (ctid = $0)  InitPlan    ->  Limit
(cost=0.00..0.04rows=1 width=6) (never executed)        ->  Seq Scan on pg_class  (cost=0.00..9.30 rows=230 width=6)
(neverexecuted)
 






--
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200309251929
-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html

iD8DBQE/c3r2vJuQZxSWSsgRAjorAJ9SyKGsLWk0zQkn1a6f63itq/p1xACg06IF
J28TltScrDcHvUec97RsTTM=
=3W1F
-----END PGP SIGNATURE-----




Re: ctid matching behavior changed?

From
Tom Lane
Date:
"Greg Sabino Mullane" <greg@turnstep.com> writes:
> Why is the subselect never executed for the inner select?

Fixed.  I'm kinda surprised that code ever worked; it was trying to run
a sub-plan before the rest of the executor was set up.
        regards, tom lane