Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293925

Add ignore on duplicate key to insert query

$
0
0

Problem

Currently there is no way to use an insert query with ignore when duplicate key is found.

Proposed resolution

I think the best way to implement it is the following:

  • Update the base insert class with a new method to set a boolean that will enable this functionality.
  • Update the MySQL insert class to use INSERT IGNORE when the boolean is set.
  • Update the PostgreSQL insert class to use INSERT ... ON CONFLICT DO NOTHING when the boolean is set. This brings the requirement of having version 9.5 or newer. Is this a problem? Could add an extra requirement to this specific functionality.
  • Update the SQLite insert class to use INSERT OR IGNORE when the boolean is set.

Remaining tasks

  1. Discuss the proposed solution
  2. Write a patch
  3. Review

I have also some idea's about duplicate key update solutions, but for now lets first handle this ticket.


Viewing all articles
Browse latest Browse all 293925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>