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

issues with rename - for join #132

Open
gowda opened this issue Dec 31, 2012 · 3 comments
Open

issues with rename - for join #132

gowda opened this issue Dec 31, 2012 · 3 comments

Comments

@gowda
Copy link
Contributor

gowda commented Dec 31, 2012

Database server: MySQL
There are two tables 'items' and 'users' each of them having a common column name 'id'. 'items.user' is a foreign key referring to 'users.id'

(-> items (join users (where (= :items.user :users.id))) (rename {:items.id :item_id}))

generates

SELECT items.*,users.* FROM items AS items(*) JOIN users ON (items.user = users.id)

whereas it should have been

SELECT items.id as item_id, items.*,users.* FROM items JOIN users ON (items.user = users.id)
@gowda
Copy link
Contributor Author

gowda commented Jan 2, 2013

this issue is same as #126

@gowda
Copy link
Contributor Author

gowda commented Jan 2, 2013

in fact, the same effect can be achieved without using 'rename' procedure:

(-> items (project [[:id :item_id] :user :data]) (join users (where (= :items.user :users.id))))

only disadvantage with using this approach is with listing all the columns of a schema during 'project'.

@gowda
Copy link
Contributor Author

gowda commented Jan 2, 2013

it would be nice if someone can document the details regarding the issue with 'rename' at http://clojureql.org/documentation.html

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

No branches or pull requests

1 participant