[teiid-issues] [JBoss JIRA] (TEIID-5799) GENERATED_KEY cannot resolve primary key, if created via insert trigger on view

Christoph John (Jira) issues at jboss.org
Fri Aug 2 17:48:00 EDT 2019


    [ https://issues.jboss.org/browse/TEIID-5799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13766649#comment-13766649 ] 

Christoph John edited comment on TEIID-5799 at 8/2/19 5:47 PM:
---------------------------------------------------------------

Hello Steven,
I unfortunately had a bug in my curl script. All three scripts, also the curlCmdDK3.sh had to work. Please use the following command. Then you will see the error message. 

fkDatabaseKey":3 is the relevant path in the INSERT trigger


{code:java}
curl --user user:pwd -i -X POST -H 'Content-Type: application/json;charset=UTF-8;IEEE754Compatible=true' -d '{"fkProfile":"1","AddedDateTime":"2019-07-05T19:12:55Z","MealNumber":"5","AmountInG":20.31,"fkDatabaseKey":3,"product_name":"Ein Produkt","energy_100g":2259,"carbohydrates_100g":60.08,"proteins_100g":24.03,"fat_100g":15.89}' http://localhost:18080/odata4/svc/my_nutri_diary/Diary
{code}




was (Author: cjohn001):
Hello Steven,
I unfortunately had a bug in my curl script. All three scripts, also the curlCmdDK3.sh had to work. Please use the following command. Then you will see the error message. 

fkDatabaseKey":3 is the relevant path in the INSERT trigger

curl --user user:pwd -i -X POST -H 'Content-Type: application/json;charset=UTF-8;IEEE754Compatible=true' -d '{"fkProfile":"1","AddedDateTime":"2019-07-05T19:12:55Z","MealNumber":"5","AmountInG":20.31,"fkDatabaseKey":3,"product_name":"Ein Produkt","energy_100g":2259,"carbohydrates_100g":60.08,"proteins_100g":24.03,"fat_100g":15.89}' http://localhost:18080/odata4/svc/my_nutri_diary/Diary

> GENERATED_KEY cannot resolve primary key, if created via insert trigger on view
> -------------------------------------------------------------------------------
>
>                 Key: TEIID-5799
>                 URL: https://issues.jboss.org/browse/TEIID-5799
>             Project: Teiid
>          Issue Type: Bug
>    Affects Versions: 13.0
>            Reporter: Christoph John
>            Assignee: Steven Hawkins
>            Priority: Blocker
>         Attachments: svc-vdb-example.ddl
>
>
> 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



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the teiid-issues mailing list