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

[Bug] Relation#union fails on virtual columns #421

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dgollahon
Copy link

@dgollahon dgollahon commented Jun 3, 2023

This PR is really an issue/bug report just in the form of a failing test. I don't have a good idea as to what the right solutin is but I figured it would be helpful to at least have a very concrete demonstration of the issue.

- When merging relations with virtual columns the qualified projection (added in rom-rb#334) causes the virtual column to be moved into the outer select. This means that column will always be hardcoded to `NULL` instead of selecting from the result of the union. This is a [not-that-esoteric technique with unions](https://stackoverflow.com/a/39766372). This also worked in ROM prior to rom-rb#334.

This PR is really an issue/bug report just in the form of a failing test. I don't have a good idea as to what the right solutin is but I figured it would be helpful to at least have a very concrete demonstration of the issue.
@dgollahon dgollahon requested a review from solnic as a code owner June 3, 2023 15:04
# SELECT
# `users__tasks`.`id`,
# `users__tasks`.`name`,
# NULL AS 'title'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the problematic column select. if this got transformed to users__tasks.title, all would be well

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

1 participant