Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-2553

Partial insert statements being submitted with incorrect default values

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Critical
    • 8.4.1, 8.5
    • 8.2
    • Query Engine
    • None
    • Hide

      Execute an INSERT statement against a view with a trigger action to handle the insert that has a column with a default value, but omit that column from the INSERT.

      Show
      Execute an INSERT statement against a view with a trigger action to handle the insert that has a column with a default value, but omit that column from the INSERT.
    • Workaround Exists
    • Hide

      Expand the insert to include the default values.

      Show
      Expand the insert to include the default values.

    Description

      InsertResolver is causing incorrect default values to be returned by the ResolverUtil due to the wrong element symbol being sent to the ResolverUtil.getDefault() method. In the code below, taken from InsertResolver.getVariableValues(), I believe the first two rows inside the if statement should be reversed so that next.clone() is used to determine the default value rather than the varSymbol whose type has been changed to BOOLEAN.

      Collection<ElementSymbol> insertElmnts = ResolverUtil.resolveElementsInGroup(insert.getGroup(), metadata);
      insertElmnts.removeAll(insert.getVariables());

      Iterator<ElementSymbol> defaultIter = insertElmnts.iterator();
      while(defaultIter.hasNext()) {
      ElementSymbol next = defaultIter.next();
      ElementSymbol varSymbol = next.clone();
      varSymbol.getGroupSymbol().setName(ProcedureReservedWords.CHANGING);
      varSymbol.setType(DataTypeManager.DefaultDataClasses.BOOLEAN);
      result.put(varSymbol, new Constant(Boolean.FALSE));

      if (!changingOnly)

      { Expression value = ResolverUtil.getDefault(varSymbol, metadata); varSymbol = next.clone(); varSymbol.getGroupSymbol().setName(SQLConstants.Reserved.NEW); result.put(varSymbol, value); }

      }

      Attachments

        Activity

          People

            rhn-engineering-shawkins Steven Hawkins
            bobby.diaz Bobby Diaz (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: