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

[10.x] Fix cursor paginate with union and column alias #50809

Conversation

thijsvdanker
Copy link
Contributor

When using cursorPaginate on a query with a union the where clause on the union uses the wrong column name.

Table Post:

id
start_time

Table News:

id
created_at

Post::toBase()->select('id', 'start_time as created_at')->union(News::toBase()->select('id', 'created_at'))->orderBy('created_at')->cursorPaginate(10, ['created_at']);

Should sort Post by the start_time column and News by thecreated_at column.

The current implementation sorts both Post and News by the start_time column.

This is similar to #50796 but applied against 10.x

@thijsvdanker thijsvdanker changed the title Fix cursor paginate with union and column alias [10.x] Fix cursor paginate with union and column alias Mar 28, 2024
@taylorotwell
Copy link
Member

It concerns me we are just straight up changing existing tests.

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

Successfully merging this pull request may close these issues.

2 participants