[ 
http://issues.apache.org/jira/browse/DERBY-39?page=comments#action_12366404 ] 

Erik Bengtson commented on DERBY-39:
------------------------------------

> I'm puzzled by this last query.

Me too ;) This query is generated by a ORM tool, and I don't have control over 
it unless I fine tune the code that generates it. Since the ORM tool is 
covering a lot of scenarios, that's the best we can get for now.

We want to return PERSON crossjoin PROJECT where PROJECT  has NAME=? and exists 
for PERSON

There is a join table PROJECT_MEMBER where member is PERSON
Say

PERSON = { "John", "Mary", "Mark" }
PROJECT = {"Derby", "Ant", "Log4j" }
PROJECT_MEMBER = 
{("John","Derby"),("Mary","Ant"),("Mark","Derby"),("Mark","Ant")}

We want to return PERSON crossjoin PROJECT where PROJECT  has NAME="Ant" and 
exists for PERSON

results are

{("Mary","Ant"),("Mark","Ant")}

> Strange error in JOIN ON clause
> -------------------------------
>
>          Key: DERBY-39
>          URL: http://issues.apache.org/jira/browse/DERBY-39
>      Project: Derby
>         Type: Bug
>   Components: SQL, Newcomer
>     Versions: 10.0.2.0
>     Reporter: Erik Bengtson

>
> The exception:
> ---------------------------------------
> Error: An ON clause associated with a JOIN operator is not valid.
> ---------------------------------------
> happens when I run the below SQL script:
> ---------------------------------------
> SELECT
> THIS.DOSSIERTEMPLATE_ID
> FROM DOSSIERTEMPLATE THIS,
> ENTITLEMENT UNBOUND_ENTITLE 
> INNER JOIN 
> ENTITLEMENT II 
> ON UNBOUND_ENTITLE.ENTITLEMENT_ID = II.ENTITLEMENT_ID 
> INNER JOIN 
> DOSSIERTEMPLATERESOURCE BB 
> ON II.ENTITLED_TO_RESOURCE_ID_OID = BB.DOSSIERTEMPLATERESOURCE_ID 
> INNER JOIN 
> I18N THIS_LABEL
> ON THIS.LABEL_I18N_ID_OID = THIS_LABEL.I18N_ID
> ---------------------------------------
> It works fine if I run without the LABEL join
> ---------------------------------------
> SELECT
> THIS.DOSSIERTEMPLATE_ID
> FROM DOSSIERTEMPLATE THIS,
> ENTITLEMENT UNBOUND_ENTITLE 
> INNER JOIN 
> ENTITLEMENT II 
> ON UNBOUND_ENTITLE.ENTITLEMENT_ID = II.ENTITLEMENT_ID 
> INNER JOIN 
> DOSSIERTEMPLATERESOURCE BB 
> ON II.ENTITLED_TO_RESOURCE_ID_OID = BB.DOSSIERTEMPLATERESOURCE_ID 
> ---------------------------------------
> The column LABEL_I18N_ID_OID is BIGINT and has a FK to I18N_ID, which is 
> BIGINT as well

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to