Skip to content

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

@Janderio

Description

@Janderio

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 ;)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions