Uploaded image for project: 'Hibernate ORM'
  1. Hibernate ORM
  2. HHH-11450

The testWithClause from WithClauseTest class fails on PostgreSQL

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.2.7
    • Fix Version/s: 5.2.8, 5.1.8
    • Component/s: None
    • Labels:
      None
    • Last commented by a user?:
      true

      Description

      While this test runs just fine on H2, on PostgreSQL, it fails with the following error message:

      Caused by: org.postgresql.util.PSQLException: ERROR: missing FROM-clause entry for table "human2_2_"
        Position: 1701
      

      The query in question looks like this:

      select
              human0_.mammal as id1_3_0_,
              human2_.mammal as id1_3_1_,
              human0_2_.description as descript2_3_0_,
              human0_2_.body_weight as body_wei3_3_0_,
              human0_2_.mother_id as mother_i4_3_0_,
              human0_2_.father_id as father_i5_3_0_,
              human0_2_.zoo_id as zoo_id6_3_0_,
              human0_2_.serialNumber as serialNu7_3_0_,
              human0_1_.pregnant as pregnant2_14_0_,
              human0_1_.birthdate as birthdat3_14_0_,
              human0_.name_first as name_fir2_7_0_,
              human0_.name_initial as name_ini3_7_0_,
              human0_.name_last as name_las4_7_0_,
              human0_.nickName as nickName5_7_0_,
              human0_.height_centimeters / 2.54E0 as height_c6_7_0_,
              human0_.intValue as intValue7_7_0_,
              human0_.floatValue as floatVal8_7_0_,
              human0_.bigDecimalValue as bigDecim9_7_0_,
              human0_.bigIntegerValue as bigInte10_7_0_,
              human2_2_.description as descript2_3_1_,
              human2_2_.body_weight as body_wei3_3_1_,
              human2_2_.mother_id as mother_i4_3_1_,
              human2_2_.father_id as father_i5_3_1_,
              human2_2_.zoo_id as zoo_id6_3_1_,
              human2_2_.serialNumber as serialNu7_3_1_,
              human2_1_.pregnant as pregnant2_14_1_,
              human2_1_.birthdate as birthdat3_14_1_,
              human2_.name_first as name_fir2_7_1_,
              human2_.name_initial as name_ini3_7_1_,
              human2_.name_last as name_las4_7_1_,
              human2_.nickName as nickName5_7_1_,
              human2_.height_centimeters / 2.54E0 as height_c6_7_1_,
              human2_.intValue as intValue7_7_1_,
              human2_.floatValue as floatVal8_7_1_,
              human2_.bigDecimalValue as bigDecim9_7_1_,
              human2_.bigIntegerValue as bigInte10_7_1_ 
          from
              Human human0_ 
          inner join
              Mammal human0_1_ 
                  on human0_.mammal=human0_1_.animal 
          inner join
              Animal human0_2_ 
                  on human0_.mammal=human0_2_.id 
          inner join
              Human_friends friends1_ 
                  on human0_.mammal=friends1_.human1 
          inner join
              Human human2_ 
                  on friends1_.human2=human2_.mammal 
                  and (
                      human2_2_.body_weight<?
                  ) 
          inner join
              Mammal human2_1_ 
                  on human2_.mammal=human2_1_.animal 
          inner join
              Animal human2_2_ 
                  on human2_.mammal=human2_2_.id
      

      It could be because the human2_2_ alias is referenced in a JOIN ON clause before it's being declared in an INNER JOIN as an alias.

        Attachments

          Issue links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: