Skip to content

Allow save query as view without column alias #680

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

Closed
goldmedal opened this issue Jul 18, 2024 · 1 comment · Fixed by #727
Closed

Allow save query as view without column alias #680

goldmedal opened this issue Jul 18, 2024 · 1 comment · Fixed by #727
Assignees

Comments

@goldmedal
Copy link
Contributor

Description

We have introduced the view in #645 but there are some column limitations for it. Currently, we query the complex expression with the alias name in the view. The followed SQL isn't valid:

select order_id, sum(price) from wrenai.public.order_items group by order_id

It should be

select order_id, sum(price) as sum_price from wrenai.public.order_items group by order_id

There're some todo case that should be enabled:

// TODO: support expression without alias inside view
// .view(ViewBuilder::new("revenue_orders").statement("select order_id, sum(price) from wrenai.public.order_items group by order_id").build())

@goldmedal
Copy link
Contributor Author

I found even we add an alias for it, the complex expressions are also broken. I disable the test at

// .statement("select order_id, sum(price) as totalprice from wrenai.public.order_items group by order_id")

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

Successfully merging a pull request may close this issue.

1 participant