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

"missing FROM-clause" when using many to many #377

Open
bennythomps opened this issue Apr 1, 2017 · 2 comments
Open

"missing FROM-clause" when using many to many #377

bennythomps opened this issue Apr 1, 2017 · 2 comments

Comments

@bennythomps
Copy link

I have the following definitions:

(defentity permissions)
(defentity entity)
(defentity account
  (many-to-many entity))

When I try to select data using my join, it fails

(select db/account (with db/entity) (where {:id (:id user)}))

resulting in
ERROR: missing FROM-clause entry for table "entity"

Here's my table definitions...

CREATE TABLE IF NOT EXISTS account (
    id bigserial  NOT NULL,
    email varchar(50)  NOT NULL,
    password varchar(256)  NULL,
    CONSTRAINT account_pk PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS entity (
    id bigserial NOT NULL,
    name varchar(50) NOT NULL,
    CONSTRAINT entity_pk PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS permissions (
    account_id bigint  NOT NULL REFERENCES account (id),
    entity_id bigint  NOT NULL REFERENCES entity (id),
    CONSTRAINT permissions_pk PRIMARY KEY (account_id,entity_id)
);

Am I doing something wrong?

@venantius
Copy link
Contributor

I'm going through old issues and trying to clean them up. Has this issue persisted?

If there hasn't been a response to this issue in 2 weeks, I'll close the ticket.

@MrEbbinghaus
Copy link

I'm getting this too. :-(

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

3 participants