-
Notifications
You must be signed in to change notification settings - Fork 346
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
Random postgresql ? #654
Comments
What is the resulting query? |
resulting is error Invalid column reference: 7 ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list But like i say with normal query no problem happen only when i use knp paginator |
I try again: what is the query that gives error? |
public function testPaginator(){ |
That's not a query. A query is something you can put inside postgresql |
|
@garak I have the same error.
A problem appears if I try to paginate such a query
But it works OK, if I try same query, but without |
Is the query working if you run it directly in postgres? |
Yes, it does. |
Can you provide the difference between the raw query and the query resulting from applying the paginator? |
@garak Sure.
In Knp\Component\Pager\Event\Subscriber\Paginate\Doctrine\ORM\QuerySubscriber::items() I get
The only difference is that it adds
But the raw SQL works if I run directly in postgres. |
That's not the right query, since (based on your error), it must contain a DISTINCT. |
@garak Yes, here it is SELECT DISTINCT k0_.id AS id_0
FROM kiids k0_
WHERE (k0_.isin LIKE '%IE00B%' OR k0_.name LIKE '%IE00B%')
AND (k0_.deleted_at IS NULL)
ORDER BY CASE WHEN (k0_.isin LIKE '%IE00B%') THEN 1 WHEN (k0_.name LIKE '%IE00B%') THEN 2 ELSE 3 END ASC
LIMIT 10; |
So a problem seems to be, that it produces this additional DISTINCT request, but there are additional fields in the ORDER query part. |
Can you try using manual counting? |
@garak Thanks, I think I can use it as a workaround for now. |
@Noido is it OK for you? |
Hi i have create DQL Function Random in postgresql but not work
But got error
Invalid column reference: 7 ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
i have test
And it works but with paginator no
Thanks for your help
The text was updated successfully, but these errors were encountered: