db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Fischer (JIRA)" <j...@apache.org>
Subject [jira] Commented: (TORQUE-10) doSelectJoinYYY in Oracle fails with limit/offset and same column names
Date Wed, 11 Oct 2006 21:08:50 GMT
    [ http://issues.apache.org/jira/browse/TORQUE-10?page=comments#action_12441556 ] 
            
Thomas Fischer commented on TORQUE-10:
--------------------------------------

For example, in the test project, Torque 3.2 would produce statements like this (irrelevant
columns removed):

SELECT B.* FROM ( SELECT A.*, rownum AS TORQUE$ROWNUM FROM ( SELECT book.author_id, author.author_id
FROM book, author WHERE book.author_id=author.author_id) A  ) B WHERE  B.TORQUE$ROWNUM >
5 AND B.TORQUE$ROWNUM <= 15;

which would produce the following Error: ORA-00918: column ambiguously defined

The problem is that the prefix from the column is removed.
The following does also not work:

SELECT book.author_id, author.author_id from (SELECT book.author_id, author.author_id, rownum
AS TORQUE$ROWNUM FROM (SELECT book.author_id, author.author_id FROM book, author WHERE book.author_id=author.author_id)
) WHERE  TORQUE$ROWNUM > 5 AND TORQUE$ROWNUM <= 15;

which fails with ORA-00904: "AUTHOR"."AUTHOR_ID": invalid identifier (tested with 10.2.0.1)

The only way I see around this is to use aliases for equally named colums. Aliases should
be used only in the necessary cases, so that people who address columns by their names will
be able to do that in most cases.

>  doSelectJoinYYY in Oracle fails with limit/offset and same column names
> ------------------------------------------------------------------------
>
>                 Key: TORQUE-10
>                 URL: http://issues.apache.org/jira/browse/TORQUE-10
>             Project: Torque
>          Issue Type: Bug
>          Components: Runtime
>    Affects Versions: 3.2
>         Environment: Oracle
>            Reporter: Thomas Fischer
>
> Reported by Bouvet Konsulent: If a criteria with a limit or Offset is used in XXXPeer.doSelectJoinYYY(Criteria),
and the Tables XXX and YYY have columns with same names, the method fails with a ORA-00918:
column ambiguously defined. 
> This is because the "select *" from the limit/offset query clashes with the two same
names in the inner select clause.

-- 
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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message