Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getLimitSubquery fails if multiple tables are in FROM Clause #78

Open
Amonadidis opened this issue May 13, 2020 · 2 comments
Open

getLimitSubquery fails if multiple tables are in FROM Clause #78

Amonadidis opened this issue May 13, 2020 · 2 comments

Comments

@Amonadidis
Copy link

Amonadidis commented May 13, 2020

For example a query with self join syntax SELECT * FROM example a, example b defined in DQL $query = ExampleTable::createInstance()->createQuery('a')->addFrom('example b'); is ignored by getLimitSubquery from Doctrine_Query in Query.php:1495. Commas are missing between the tables because getLimitSubquery just concats all parts from the FROM clause with a space character. The generated Query fails: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax.

@iricketson
Copy link

@Amonadidis Your best bet will be to extend your own query class (i.e. My_Query) and override the getLimitSubquery method. This way you can control behavior on a one-off basis if necessary.

@alquerci
Copy link

alquerci commented Sep 1, 2020

Hello @Amonadidis,

Firstly thank you for raise this issue.

In order to be explicit, the way to reproduce this bug it to execute this following statement?

ExampleTable::createInstance()
    ->createQuery('a')
    ->addFrom('example b')
    ->execute()
;

Hum, I suppose that it miss something.

Can you confirm or complete the full case, in order to reproduce the issue easily ?


Anyway, did you find a way to reach the same result by converting the second from to a join ? (I guess no, but it cost nothing to ask/suggest).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants