Skip to content

Correctness of query: join omitted in output when executing query. #614

@germandiagogomez

Description

@germandiagogomez

Hello everyone,

Thanks for this great project. Have a quick question.

Problem

Maybe it is me (likely) but I fail to see why for this query the output omits the join when generating the code to be executed... Joins are not generated.

auto query =
      sqlpp::select(orsInvitationsTab.invitationId, orsInvitationsTab.recipe,
                   orsInvitationsTab.sender, orsInvitationsTab.kind)
          .from(orsInvitationsTab.left_outer_join(orsInvitationsRepliesTab).
                on(orsInvitationsRepliesTab.invitationId != orsInvitationsTab.invitationId ||
                    orsInvitationsRepliesTab.recipe != orsInvitationsTab.recipe))
          .where(orsInvitationsTab.recipe == userId_);

generates this:

SELECT online_rooms_invitations.invitation_id,online_rooms_invitations.sent_date,online_rooms_invitations.sender,online_rooms_invitations.recipe,online_rooms_invitations.kind FROM online_rooms_invitations WHERE (online_rooms_invitations.recipe='myuserid')

Tables

CREATE TABLE IF NOT EXISTS online_rooms_invitations (
       invitation_id CHAR(36) NOT NULL,
       sent_date DATETIME NOT NULL,
       sender VARCHAR(80) NOT NULL,
       recipe VARCHAR(80) NOT NULL,
       kind SMALLINT NOT NULL,
       PRIMARY KEY (invitation_id, recipe),
       FOREIGN KEY (recipe) REFERENCES online_rooms_users(email),
       FOREIGN KEY (sender) REFERENCES online_rooms_users(email)
);


CREATE TABLE IF NOT EXISTS online_rooms_invitations_replies (
       invitation_reply_id CHAR(36) NOT NULL PRIMARY KEY,
       invitation_id CHAR(36) NOT NULL,
       recipe VARCHAR(80) NOT NULL,
       sent_date DATETIME NOT NULL,
       action SMALLINT NOT NULL,
       FOREIGN KEY (invitation_id, recipe) REFERENCES online_rooms_invitations(invitation_id, recipe)
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions