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

Cursor paginate uses incorrect column name for where on union #50796

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.

@thijsvdanker
Copy link
Contributor Author

Test failed when initializing the containers.
Should be unrelated to this PR.

CleanShot 2024-03-27 at 22 41 01@2x

@thijsvdanker thijsvdanker force-pushed the fix-cursor-paginate-with-union-and-column-alias branch from f1f755c to 46301ff Compare March 28, 2024 07:57
@chu121su12
Copy link
Contributor

Can this be in to 10.x?

@driesvints
Copy link
Member

Please send this to 10.x

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.

None yet

3 participants