结果发现set子句的右侧不是要插入的表,而是要插入的数据。此外,必须使用关键字
EXCLUDED
INSERT INTO change.payer (
"account_id", "entity_identifier", "entity_type", "name",
"contact_information", "etin", "document_fetched_at"
)
VALUES (
%(account_id)s, %(entity_identifier)s, %(entity_type)s, %(name)s,
%(contact_information)s, %(etin)s, %(document_fetched_at)s
)
ON CONFLICT ON CONSTRAINT payer_account_id_pk
DO UPDATE SET
entity_identifier = EXCLUDED.entity_identifier,
entity_type = EXCLUDED.entity_type,
name = EXCLUDED.name,
contact_information = EXCLUDED.contact_information,
etin = EXCLUDED.etin,
document_fetched_at = EXCLUDED.document_fetched_at
;