Skip to content

Cannot query set of enums within select clause: Column "GENERATEDALIAS1" not found #215

Closed
@molexx

Description

@molexx

This:

#should return the friends that have appearedIn A New Hope
query {
  Humans {
    select {
      name
      friends(where:{appearsIn:{EQ:A_NEW_HOPE}}) {
        name
      }
    }
  }
}

errors with:

"Exception while fetching data (/Humans) : org.hibernate.exception.SQLGrammarException: could not prepare statement"

and the log says:

Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Column "GENERATEDALIAS1" not found; SQL statement:
select human0_.id as id2_0_0_, character2_.id as id2_0_1_, character4_.id as id2_0_2_, human0_.name as name3_0_0_, human0_.favorite_droid_id as favorite5_0_0_, human0_.gender_code_id as gender_c6_0_0_, human0_.home_planet as home_pla4_0_0_, character2_.name as name3_0_1_, character2_.favorite_droid_id as favorite5_0_1_, character2_.gender_code_id as gender_c6_0_1_, character2_.home_planet as home_pla4_0_1_, character2_.primary_function as primary_7_0_1_, character2_.dtype as dtype1_0_1_, friends1_.source_id as source_i1_2_0__, friends1_.friend_id as friend_i2_2_0__, character4_.name as name3_0_2_, character4_.favorite_droid_id as favorite5_0_2_, character4_.gender_code_id as gender_c6_0_2_, character4_.home_planet as home_pla4_0_2_, character4_.primary_function as primary_7_0_2_, character4_.dtype as dtype1_0_2_, friends3_.source_id as source_i1_2_1__, friends3_.friend_id as friend_i2_2_1__ from character human0_ left outer join character_friends friends1_ on human0_.id=friends1_.source_id left outer join character character2_ on friends1_.friend_id=character2_.id left outer join character_friends friends3_ on human0_.id=friends3_.source_id left outer join character character4_ on friends3_.friend_id=character4_.id where human0_.dtype='Human' and (generatedAlias1 in (?)) order by human0_.id asc, character2_.name asc, character4_.name asc [42122-199]

I think the syntax is OK because the same query but just using 'name' works:

#returns the friends called Leia Organa
query {
  Humans {
    select {
      name
      friends(where:{name:{EQ:"Leia Organa"}}) {
        name
      }
    }
  }
}

and querying 'appearsIn' works in the top-level where clause:

#returns humans who have at least one friend who has appearedIn A New Hope
query {
  Humans (where: {
      friends: {
        appearsIn: {EQ:A_NEW_HOPE}      
      }
  }) {
    select {
      name
      friends {
        name
      }
    }
  }
}

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