Mikhail Pinevskiy created NIFI-13116:
----------------------------------------

             Summary: PutDatabaseRecord (INSERT_IGNORE) uses Update keys while 
not specified
                 Key: NIFI-13116
                 URL: https://issues.apache.org/jira/browse/NIFI-13116
             Project: Apache NiFi
          Issue Type: Bug
    Affects Versions: 2.0.0-M2, 1.25.0
            Reporter: Mikhail Pinevskiy
             Fix For: 1.26.0


PutDatabaseRecord hides field "Update Keys" while using INSERT_IGNORE ("A 
comma-separated list of column names that uniquely identifies a row in the 
database for UPDATE statements. If the Statement Type is UPDATE and this 
property is not set, the table's Primary Keys are used. In this case, if no 
Primary Key exists, the conversion to SQL will fail if Unmatched Column 
Behaviour is set to FAIL. This property is ignored if the Statement Type is 
INSERT"). 

Despite this field not being set and not being used, classes like 
PostgreSQLDatabaseAdapter use it in methods for INSERT_IGNORE and UPSERT, which 
triggers an exception if list of Update Keys is empty or null. 
MySQLDatabaseAdapter methods have same checks for Update Keys, but do not use 
them. With that for PostgreSQL we have "instert ... on conflict (Update Keys) 
ignore", and for MySQL any constraint will trigger "on conflict" on any 
constraint, not specified. 

It means different and unclear behaviour, so i suggest removing use of Update 
Keys in said classes.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to