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

Do has-many relations not work with (fields :otherthan*)? #393

Open
Janderio opened this issue May 24, 2018 · 0 comments
Open

Do has-many relations not work with (fields :otherthan*)? #393

Janderio opened this issue May 24, 2018 · 0 comments

Comments

@Janderio
Copy link

Janderio commented May 24, 2018

Hi, I have the following test:

Table user [id, username] pk(id)
Table emails [user_id, email] pk(user_id, email)

(defentity user 
    (database db)
    (has-many emails))
(defentity emails 
    (database db) 
    (pk [:user_id :email]) 
    (belongs-to user))

When selecting with

(select user 
    (with emails
        (fields :email))
    (fields :*)
    (where {:id 1}))

I am getting the emails as content, when change the (field :*) to (field :username) the :emails is added but empty. The fieldfilter not accepting :emails.email or :email too. Which I tried as I thougth it might be required in this case.

This is the normal behavior or a bug? I supposed it would be possible to filter has-many fields statements too?

Forgot to mention: [korma "0.4.3"]; Oh and mysql with mariadb backend ;)

@Janderio Janderio changed the title Do has-many relations not work with (fields ...)? Do has-many relations not work with (fields :namedfield)? May 24, 2018
@Janderio Janderio changed the title Do has-many relations not work with (fields :namedfield)? Do has-many relations not work with (fields :otherthan*)? May 24, 2018
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