[
https://issues.jboss.org/browse/TEIID-5763?page=com.atlassian.jira.plugin...
]
Christoph John edited comment on TEIID-5763 at 6/23/19 7:24 PM:
----------------------------------------------------------------
Hello Steven,
I have one more note regarding the removal of the NOT NULL constraint on the autoincrement
key, as I just added a further Jira issue to a similar topic.
I have not found the time to simply test the current sources out, as I am already on my
way to holiday.
I was wondering, in case I do not sent a dummy primary key, if I than still get the
autogenerated key in the response of the odata request back?
I am not sure what the standard specifies in this context, but I would expect that I
always need to have the generated key on the client side to refer back to the created
item.
Here the standard says the response shall include the created entity.Even though it does
not explicitely state that each attribute needs to be included, I think it would make
sense.
http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part1-pr...
My thinking is that this unintuitive NOT NULL on the autogenerated key, like it was
implemented in the past might derive from such a constraint.
was (Author: cjohn001):
Hello Steven,
I have one more note regarding the removal of the NOT NULL constraint on the autoincrement
key, as I just added a further Jira issue to a similar topic.
I have not found the time to simply test the current sources out, as I am already on my
way to holiday.
I was wondering, in case I do not sent a dummy primary key, if I than still get the
autogenerated key in the response of the odata request back?
I am not sure what the standard specifies in this context, but I would expect that I
always need to have the generated key on the client side to refer back to the created
item. My thinking is that this unintuitive NOT NULL on the autogenerated key like it was
in the past might derive from such a constraint.
GENERATED_KEY returns NULL if used in INSTEAD OF INSERT Triggers in
DDL files
-----------------------------------------------------------------------------
Key: TEIID-5763
URL:
https://issues.jboss.org/browse/TEIID-5763
Project: Teiid
Issue Type: Bug
Affects Versions: 12.2
Reporter: Christoph John
Assignee: Steven Hawkins
Priority: Critical
Fix For: 12.3
The issue arrised in:
https://developer.jboss.org/message/989700#989700
Following sceanarios are given:
Variant 1:
Table Product(id), primary key = autoincrement;
Table QuicklyAddedProduct, primary key is foreign key on Product.id
Table Diary_SRC
View Diary on Diary_SRC
INSTEAD OF INSERT Trigger on Diary should :
-create new record on Product,
-get autoincremented Product.id of new record,
- create new QuicklyAddedProduct with returned Product.id as primary key
- create new Diary record with QuicklyAddedProduct
{
INSERT a new record on Product;
idProduct = CONVERT(GENERATED_KEY('idProduct'),long); // fails
}
Variant 2:
INSTEAD OF INSERT trigger on Diary should :
- create new QuicklyAddedProduct
- add Quickly added prodcut to Diary
additionally a INSTEAD OF trigger on QuicklyAddedProduct exists which:
- creates new Product record
- uses returned GENERATED_KEY(Product.id) to add record on QuicklyAddedProduct with
Product.id as primary key
--
This message was sent by Atlassian Jira
(v7.12.1#712002)