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

Unable to use alias on mysql for parent primary key column when you have a parent child relationship #24

Closed
mooreds opened this Issue Oct 11, 2012 · 1 comment

Comments

Projects
None yet
2 participants
@mooreds
Copy link
Contributor

mooreds commented Oct 11, 2012

If you modify the LangFilm.xml example sqlresource file and change the select statement from select language.language_id lid, language.name "langName", film_id, title, release_year "year" to select language.language_id, language.name "langName", film_id, title, release_year "year", you get this error message when visiting this url .../res/lang.LangFilm?_limit=10&_offset=0:

Column 'language_id' in order clause is ambiguous :: select language.language_id lid, language.name "langName", film_id, title, release_year "year" from language left outer join film on film.language_id = language.language_id ORDER BY language_id, film_id LIMIT 10 OFFSET 0

This is mysql5, java7, tomcat6, on windows 7. If you remove the alias, everything works fine alright.

@restsql

This comment has been minimized.

Copy link
Owner

restsql commented Oct 12, 2012

Indeed, aliasing the PK in a hierarchical resource is not working for me either. I only had a test case for a flat, single table resource. It's a little more work than fixing the order by. The inserts/deletes on children are not working either with the aliased parent PK.

@restsql restsql closed this in d92362e Oct 14, 2012

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