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

GENERATED_KEY cannot resolve primary key, if created via insert trigger on view

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Blocker Blocker
    • None
    • 13.0
    • None
    • None

      Hello Steven,
      I just ran into the next issue with the generated key functionality. Attached you find an example. The relevant section is given in
      CREATE TRIGGER ON Diary INSTEAD OF INSERT AS
      with the block following:
      ELSE IF (new.fkDatabaseKey = 3)

      In the insert trigger I am trying to duplicate a record from table "UserDefinedProducts" and reference it in the row to be created from the trigger.

      I again the the error message:

      POST on 'Diary' failed; will be repeated automatically - Error: TEIID16016 Insert into Diary success, but failed to retrieve auto generated keys from source, thus failed to show result entity; Supply the key values.

      I am using the most recent sources checked out about an hour ago.

      Do you see a bug in my code, or is it again an issue I have hit? Thanks for your help!

      Let me know if I shall assemble a docker-compose file for you to debug the issue.

      Update: As I seem to be not able to delete attachments here. One further note. My example hat a permission error in one line where I have red from the wrong table. It should instead be:

      SELECT * INTO #tmpItem FROM UserDefinedProductsOfAllUsers WHERE fkProduct = new.fkProduct LIMIT 1;

      However, the previously described error stays the same.

      Best regards,
      Christoph

            rhn-engineering-shawkins Steven Hawkins
            cjohn001 Christoph John (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: