Hussain Towaileb has uploaded this change for review. ( 
https://asterix-gerrit.ics.uci.edu/3414


Change subject: [ASTERIXDB-2579][DOC] Document uuid/upsert/insert behavior
......................................................................

[ASTERIXDB-2579][DOC] Document uuid/upsert/insert behavior

- user model changes: yes
- storage format changes: no
- interface changes: no

Details:
- Document the new behavior for the autogenerated
keys with the insert/upsert statements.

Change-Id: I7ba526c79de8cb744dc41ebc797389e68333c5ce
---
M asterixdb/asterix-doc/src/main/markdown/sqlpp/5_ddl_dml.md
1 file changed, 9 insertions(+), 5 deletions(-)



  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/14/3414/1

diff --git a/asterixdb/asterix-doc/src/main/markdown/sqlpp/5_ddl_dml.md 
b/asterixdb/asterix-doc/src/main/markdown/sqlpp/5_ddl_dml.md
index 2eb5820..44e914e 100644
--- a/asterixdb/asterix-doc/src/main/markdown/sqlpp/5_ddl_dml.md
+++ b/asterixdb/asterix-doc/src/main/markdown/sqlpp/5_ddl_dml.md
@@ -26,10 +26,11 @@
 The INSERT statement is used to insert new data into a dataset.
 The data to be inserted comes from a query expression.
 This expression can be as simple as a constant expression, or in general it 
can be any legal query.
-If the target dataset has an auto-generated primary key field, the insert 
statement should not include a
-value for that field in it.
-(The system will automatically extend the provided object with this additional 
field and a corresponding value.)
-Insertion will fail if the dataset already has data with the primary key 
value(s) being inserted.
+In case the dataset has an auto-generated primary key, when performing an 
INSERT operation, the system allows the user to manually add the
+auto-generated key field in the INSERT statement, or skip that field and the 
system will automatically generate it and add it. However,
+it's important to note that if the a record already exists in the dataset with 
the auto-generated key provided by the user, then
+that operation is going to fail. As a general rule, insertion will fail if the 
dataset already has data with the primary key value(s)
+being inserted.

 Inserts are processed transactionally by the system.
 The transactional scope of each insert transaction is the insertion of a 
single object plus its affiliated secondary index entries (if any).
@@ -47,7 +48,10 @@

 The UPSERT statement syntactically mirrors the INSERT statement discussed 
above.
 The difference lies in its semantics, which for UPSERT are "add or replace" 
instead of the INSERT "add if not present, else error" semantics.
-Whereas an INSERT can fail if another object already exists with the specified 
key, the analogous UPSERT will replace the previous object's value with that of 
the new object in such cases.
+Whereas an INSERT can fail if another object already exists with the specified 
key, the analogous UPSERT will replace the previous object's value
+with that of the new object in such cases. Like the INSERT statement, the 
system allows the user to manually provide the auto-generated key
+for datasets with auto-generated key as primary key, this operation will 
insert the record if no record with that key already exists, however,
+if a record with the key already exists, then that's converted to a 
replace/update operation.

 The following example illustrates a query-based upsert operation.


--
To view, visit https://asterix-gerrit.ics.uci.edu/3414
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7ba526c79de8cb744dc41ebc797389e68333c5ce
Gerrit-Change-Number: 3414
Gerrit-PatchSet: 1
Gerrit-Owner: Hussain Towaileb <hussai...@gmail.com>

Reply via email to