[wp-hackers] LEFT JOIN in 2.7 to JOIN in 2.8; Why?

Mike Schinkel mikeschinkel at newclarity.net
Wed Jun 17 05:02:35 GMT 2009


"Austin Matzko" <if.website at gmail.com> wrote:
> According to this ticket, it was done for better performance:
> http://core.trac.wordpress.org/ticket/9720

Thanks for finding that.  OTOH, it looks like Ryan reverted it anyway because of other regression bugs: 

   http://core.trac.wordpress.org/ticket/9851

> You could use a negative lookbehind, which will match "LEFT JOIN" and "JOIN", but not "RIGHT JOIN":
> preg_match('/(?<!RIGHT )JOIN/', $text)

Thanks for that. I'm still not a regex whiz so unless it's obvious I don't think to use regex.
OTOH, isn't preg_match() significantly slower than strpos()?

Also, for future finders of this thread the follow is what you'd need in hook post_join_paged($join) - note the space after the closing paren, not before:

   preg_match('/(?<!RIGHT) JOIN/', $join)

-Mike Schinkel
Custom Wordpress Plugins
http://mikeschinkel.com/custom-wordpress-plugins


More information about the wp-hackers mailing list