[
https://issues.apache.org/jira/browse/NIFI-13116?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mikhail Pinevskiy updated NIFI-13116:
-
Description:
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, 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.
was:
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.
> 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: 1.25.0, 2.0.0-M2
>Reporter: Mikhail Pinevskiy
>Priority: Major
> Time Spent: 40m
> Remaining Estimate: 0h
>
> 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, 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)