<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Cannot insert duplicate key in object</title><link>https://community.appian.com/discussions/f/data/40476/cannot-insert-duplicate-key-in-object</link><description>I have a record type with following releation Request Master (one to one) Payment Request (One to One) Invoice Header (One to One) Invoice Payment Info but getting following error 
 Unable to write to or delete from the source due to a data integrity</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Cannot insert duplicate key in object</title><link>https://community.appian.com/thread/154804?ContentTypeID=1</link><pubDate>Thu, 04 Jun 2026 05:48:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6dfac7b3-a9a7-4c33-8b5b-bc79b3116b0f</guid><dc:creator>subhankar-Maantic</dc:creator><description>&lt;p&gt;Appian is attempting to INSERT a new row into INVOICE_PAYMENT_INFO instead of UPDATE the existing one &amp;mdash; because the PK of INVOICE_PAYMENT_INFO is null during the write operation.&lt;/p&gt;
&lt;p&gt;The constraint UQ_PAYMENT_INFO_HEADER_INVOICE_ID is on INVOICE_ID &amp;mdash; not the PK. So even though PK is blank, the duplicate is caught on INVOICE_ID = 21769 which already exists.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot insert duplicate key in object</title><link>https://community.appian.com/thread/154802?ContentTypeID=1</link><pubDate>Thu, 04 Jun 2026 05:39:12 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e13cacba-ca64-441b-b636-c47b4232d89a</guid><dc:creator>Shubham Aware</dc:creator><description>&lt;p&gt;Most probably&amp;nbsp;unique constraint UQ_PAYMENT_INFO_HEADER_INVOICE_ID is on the invoice_id column, and a row with invoice_id = 21769 already exists in INVOICE_PAYMENT_INFO.&lt;br /&gt;For 1:1 relationships, Write Records inserts a new child when PK is blank; but your FK (invoice_id) duplicates an existing row. Fetch the existing child record first and pass its PK so Write Records performs an update instead of insert.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>