From: Sergei Golubchik Date: October 14 2010 8:44am Subject: Re: Query Rewriting Plugin List-Archive: http://lists.mysql.com/internals/38149 Message-Id: <20101014084400.GA13867@janus.mylan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Hi, Padraig! On Oct 13, Padraig O'Sullivan wrote: > On Wed, Oct 13, 2010 at 4:52 PM, Sergei Golubchik wrote: > > On Oct 13, Padraig O'Sullivan wrote: > >> > >> I have a patch with a new plugin point for query rewriting that I'd > >> like to have considered. It allows someone to develop a plugin > >> which can modify the text of a query before it is parsed. > > > > What are the use cases? Do you have any practical examples? > > > > Just to make it clear - I'm not referring to the query rewriting in > > general, but precisely to your rewriting API, as you've implemented > > it. > > A very simple explanation of my use-case is to transform a query with > joins into a query on virtual tables that contains no joins. I need > this transformation to be transparent to the user who can submit their > original queries as before. > > One other possible use-case which I had thought of is to implement a > scheme for preventing SQL injection as a query rewriting plugin. Right. This is my point exactly. For these applications a plugin would need a parsed tree, not the original query string. Forcing every plugin to implement an SQL parser would make plugins very heavyweight and writing them - prohibitevely complex. This didn't show up in the simple lowercase example, that's why I asked for a real one. See, even Peter Volk - who, by all means, is not a newbie, you could've heard about his Revision Engine or attended his talk on UC a couple of years ago - would prefer MySQL to do the parsing, not a plugin :) > >> Any pointers to the procedure I should follow would be awesome. > > > > Here: http://forge.mysql.com/wiki/Contributing_Code > > Cool, thanks. I sent a copy of the SCA to the email address listed on > that page today. After I hear back from them, should I just send a > patch to the list? As you like. But having a tree on launchpad is good enough - they can grab the patch from there. Regards, Sergei