Project

General

Profile

DBO unexpected error "not enough aliases"

Added by Torsten Schulz almost 3 years ago

Hello,

I've following code

void BranchNewProduction::productWidget() {
    Wt::Dbo::Transaction transaction(*session_);
    DOUT;
    auto widget = tmplt_->bindNew<Wt::WComboBox>("product");
    DOUT;
    Wt::Dbo::collection<std::tuple<int, std::string> > products = session_->query<std::tuple<int, std::string> >(
                "WITH prod (\"id\", \"tr\") AS ( "
                "    SELECT root.\"id\", root.\"tr\"  "
                "    FROM FALUKANT_TYPES.\"product\" root, FALUKANT_DATA.\"character\" root_c "
                "    WHERE root.\"product_min_title_id\"  "
                "          AND root.\"product_min_title_id\" <= root_c.\"character_title_id\"  "
                "          AND root_c.\"FALUKANT.character_user_id\" = 61 "
                "    UNION ALL  "
                "    SELECT child.\"id\", child.\"tr\" "
                "    FROM prod PARENT, FALUKANT_TYPES.\"product\" child, FALUKANT_DATA.\"character\" child_c  "
                "    WHERE PARENT.\"id\" = child.\"product_relation_id\"  "
                "          AND child.\"product_min_title_id\" <= child_c.\"character_title_id\"  "
                ") "
                "SELECT DISTINCT * "
                "FROM prod "
    );
    DOUT;

The DOUT are just Makros for debugging by show the line number, so they can be ignored. But with them I was able to identify where the error happens.
So I got following output:

/home/torsten/Programs/YourPart2/Falukant/src/branches.cpp:280
/home/torsten/Programs/YourPart2/Falukant/src/branches.cpp:282
std-error: Session::query(): not enough aliases for resultsDbo.backend.DB2Server: select "version", "user_id", "password_hash", "password_method", "password_salt", "status", "failed_login_attempts", "last_login_attempt", "email", "unverified_email", "email_token", "email_token_expires", "email_token_role" from "AUTH"."auth_info" where "id" = ?

As you can see, in my code is no request to auth_info or any authentication or user related data. Where does it come from? Any idea how to fix that?

Greetings
Torsten