Torque
  1. Torque
  2. TORQUE-241

qualified table names cause wrong sql to be created

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0-beta1
    • Fix Version/s: 4.0
    • Component/s: Runtime
    • Labels:
      None

      Description

      If I use the table name "bookstore.book" and then try to telete all booksby
      Criteria criteria = new Criteria();
      criteria.where(BookPeer.BOOK_ID, (Long) null, Criteria.NOT_EQUAL);
      BookPeer.doDelete(criteria);
      the generated sql will be
      DELETE FROM bookstore.book, book WHERE book.book_id IS NOT NULL
      whereas it should be
      DELETE FROM bookstore.book WHERE book.book_id IS NOT NULL

      Also other places should be checked for similar errors.

        Activity

        Hide
        Thomas Fox added a comment -

        Is due to fullTableAdded check fails (BasePeerImpl line 420) because not the fully qualified table name is fetched for comparison from the table map, but the unqualified name.
        We need to fetch the fully qualified table name from the table map.

        Show
        Thomas Fox added a comment - Is due to fullTableAdded check fails (BasePeerImpl line 420) because not the fully qualified table name is fetched for comparison from the table map, but the unqualified name. We need to fetch the fully qualified table name from the table map.
        Hide
        Thomas Fox added a comment -

        Derby does not resolve unqualified table names in select columns to fully qualified table names. In other words, the query
        delete from bookstore.book where book.id=1
        dies not work, derby needs
        delete from bookstore.book where bookstore.book.id=1
        Mysql and postgresql accept both variants.
        Need to check with mssql, hsqldb and oracle.

        Show
        Thomas Fox added a comment - Derby does not resolve unqualified table names in select columns to fully qualified table names. In other words, the query delete from bookstore.book where book.id=1 dies not work, derby needs delete from bookstore.book where bookstore.book.id=1 Mysql and postgresql accept both variants. Need to check with mssql, hsqldb and oracle.
        Hide
        Thomas Fox added a comment -

        oracle also at least accepts the second (fully qualified column name) variant

        Show
        Thomas Fox added a comment - oracle also at least accepts the second (fully qualified column name) variant
        Hide
        Thomas Fox added a comment -

        Other errors with schemata:

        • in idtable-init.sql the fully qualified name of the table is used, causing the idbroker not to find the table's entry
        • in some databases, the schema must be created explicitly by the "create schema" command
        • the qualified table name was used in the peer's TABLE_NAME constant
        Show
        Thomas Fox added a comment - Other errors with schemata: in idtable-init.sql the fully qualified name of the table is used, causing the idbroker not to find the table's entry in some databases, the schema must be created explicitly by the "create schema" command the qualified table name was used in the peer's TABLE_NAME constant
        Hide
        Thomas Fox added a comment -

        The error in the description and all errors in the comments above were fixed

        Show
        Thomas Fox added a comment - The error in the description and all errors in the comments above were fixed

          People

          • Assignee:
            Unassigned
            Reporter:
            Thomas Fox
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development