Patrick A. Mol created NIFI-11465:
-------------------------------------

             Summary: UpdateDatabaseTable returns PostgreSQL error when there 
are multiple fields in Primary Key Fields property
                 Key: NIFI-11465
                 URL: https://issues.apache.org/jira/browse/NIFI-11465
             Project: Apache NiFi
          Issue Type: Bug
    Affects Versions: 1.21.0
         Environment: nifi 1.21.0 on ubuntu 20.04
            Reporter: Patrick A. Mol
         Attachments: image-2023-04-17-15-48-14-841.png, 
update_database_table_issue.json

When I have two fields separated by a comma in the Primary Key Fields property 
of UpdateDatabaseTable processor with Database Type PostgreSQL I get an error 
returned when running the flow (see screenprint)

!image-2023-04-17-15-48-14-841.png!


Logfile contains:
{noformat}
2023-04-17 18:45:57,792 ERROR [Timer-Driven Process Thread-1] 
o.a.n.p.standard.UpdateDatabaseTable 
[UpdateDatabaseTable[id=0187100e-5a73-1181-61bb-71e93f7fa6ff], 
StandardFlowFileRecord[uuid=b6df9e88-3097-4f87-bdfa-1fd5ed555de8,claim=StandardContentClaim
 [resourceClaim=StandardResourceClaim[id=1681737334979-1, container=default, 
section=1], offset=1583, 
length=132],offset=0,name=b6df9e88-3097-4f87-bdfa-1fd5ed555de8,size=132]] 
Exception while processing {} - routing to failure
java.io.IOException: org.postgresql.util.PSQLException: ERROR: multiple primary 
keys for table "my_new_three_field_table" are not allowed
  Position: 94
{noformat}

When I have one field in the Primary Key Fields property a table gets created 
with a unique key as expected.
When I add parentheses to the Primary Key Fields property to conform to primary 
key clause format, i.e. instead of 
{noformat}
field1, field2{noformat}
 use
{noformat}
 (field1, field2){noformat}
I do not get an error, and the table gets created, but without a primary key.



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

Reply via email to