On Wed, Oct 26, 2011 at 01:33, Dmitriy Sintsov <ques...@rambler.ru> wrote:
> * Jeremy Baron <jer...@tuxmachine.com> [Wed, 26 Oct 2011 01:09:07
> -0400]:
>> > Should I do not use table aliases at all?
>>
>> Aliases should be fine. (at least per the docs I found and reedy's
>> example)
>>
> If they are fine, why my second converted query (last post in bug 31534)
> https://bugzilla.wikimedia.org/show_bug.cgi?id=31534
> fails to execute on MySQL ?

I think you found the problem already in your comment 2 but I missed
it the first time around:
> произошёл из функции «qp_PollStore::pollVotersPager». База данных возвратила
> ошибку «1064: You have an error in your SQL syntax; check the manual that
> corresponds to your MySQL server version for the right syntax to use near
> ''qup' INNER JOIN `wiki_qp_users` 'qu' ON ((qup.uid = qu.uid)) WHERE pid = 7
> LI' at line 1 (127.0.0.1)».
>
> The Database class built query is identical to manually built query, except
> the Database class wraps table aliases into single quotes. Original query
> works.

Seems pretty clearly broken; we should fix the way we quote. (and
maybe not break anyone because anyone using the syntax that triggers
this would already be broken because of this) Maybe we need backticks
instead of quotes? I can test when I'm less sleepy but maybe someone
else knows. Looks like it per
http://dev.mysql.com/doc/refman/5.0/en/identifiers.html

> However my far goal is to make the whole extension
> compatible to non-MySQL DBMS, I guess this query will probably work, but
> I have another queries, like that second one with INNER JOIN.
> Maybe I should get rid of table aliases, the simpliest way.

That may be a solution but either way the bug shouldn't be ignored.
Hopefully (if someone (e.g. domas) agrees that it's safe) this can be
backported to 1.17 and you could use it. I'm not too familiar with the
standard backporting criteria for point releases.

-Jeremy

_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to