[JBoss JIRA] (TEIID-5790) Generated key is not made available depending upon the number of column values on the insert
by Steven Hawkins (Jira)
Steven Hawkins created TEIID-5790:
-------------------------------------
Summary: Generated key is not made available depending upon the number of column values on the insert
Key: TEIID-5790
URL: https://issues.jboss.org/browse/TEIID-5790
Project: Teiid
Issue Type: Sub-task
Components: Query Engine
Reporter: Steven Hawkins
Assignee: Steven Hawkins
Fix For: 12.3, 12.2.2
The logic to calculate when to return the generated key was not generally correct. If there were other columns beside the key left out of the explicit insert variable list, then the generated key would not be returned.
For example:
create temporary table t (x serial, y string, primary key (x));
would not return the generated key on:
insert into t (y) values ('a');
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
5 years, 5 months
[JBoss JIRA] (TEIID-5782) When overwriting an Insert trigger with custom logic in a ddl file, the primary key is not correctly transferred back in the response of the odata layer with a dummy insert value
by Christoph John (Jira)
[ https://issues.jboss.org/browse/TEIID-5782?page=com.atlassian.jira.plugin... ]
Christoph John commented on TEIID-5782:
---------------------------------------
Hello Steven,
I can now provide further insides. I have now used the most recent teiid sources (From yesterday). The good news is, that the simple example which we discussed previously is now working for me as well. Unfortunately, in a more complex situation, which is my real use case things seem not to work. I provided a docker compose file here
[https://c.gmx.net/@328076122686231878/Ptq3LUdSQOyClUqR3gvBmA|https://c.gm...]
which shows the situation. I also provided 3 curl scripts
- "curlCmdSimple.sh" showing that the just mentioned simple situation is working now
- "curlCmdDummy.sh"showing that the wrong primary key is returned when the create command provides a dummy value for the primary key, i.e. according to your explanation.
- "curlCmd.sh" being the to-be solution, which is not working yet and gives
{"error":{"code":null,"message":"TEIID16016 Insert into Diary success, but failed to retrieve auto generated keys from source, thus failed to show result entity; Supply the key values."}}
The relevant insert trigger is given with
CREATE TRIGGER ON Diary INSTEAD OF INSERT AS
Please let me know if I can be of further help for the issue.
Best regards and thanks for your help
Christoph
> When overwriting an Insert trigger with custom logic in a ddl file, the primary key is not correctly transferred back in the response of the odata layer with a dummy insert value
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: TEIID-5782
> URL: https://issues.jboss.org/browse/TEIID-5782
> Project: Teiid
> Issue Type: Quality Risk
> Components: OData
> Affects Versions: 12.3
> Reporter: Christoph John
> Assignee: Steven Hawkins
> Priority: Major
>
> Hello,
> in the past we had an issue in the odata layer, that the generated primary key of an autoincrement key was not corretly transfered back in the odata response. This issue was fixed.
> However, the current issues derives from the discussion in
> https://issues.jboss.org/browse/TEIID-5763
> where we havewritten an INSTEAD OF INSERT trigger. According to my last comment to https://issues.jboss.org/browse/TEIID-5763, there are two situations which can arrise. I have to set the 1. key group explicitely or 2. it is set implicitely.
> Now in both situations I observe the same result. When I POST an INSERT with a dummy primary key, say key=0 (as it was NOT NULL in the past, and I am still using the old sources) I retrieve key=0 in the odata response. Correct would be to get a response with the generated key instead.
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
5 years, 5 months