django-pg-upsert icon indicating copy to clipboard operation
django-pg-upsert copied to clipboard

Escape column names in IgnoreConflictSuffix._action_sql property

Open Zagrebelin opened this issue 1 year ago • 1 comments

We have a table with a order column. When i try to use this field in a update=['order'] i got an error:

'syntax error at or near "order"
LINE 1: ..."network_id") DO UPDATE SET data = EXCLUDED.data, order = EX...
                                                             ^

Need to wrap column names in a DO UPDATE SET clause with a " double quotes (like a _conflict_sql). Or mention in documentation that caller need to put double quotes around the fieldname: update=['"order"']

Zagrebelin avatar Apr 14 '23 07:04 Zagrebelin

HI, thanks for your report.

Will be good if you could take care about this issue (PR welcome). If no, I will take a look when I have free time for it.

artofhuman avatar Apr 14 '23 13:04 artofhuman