Was getting this, so here's a patch to add a new primary key to this database to help replicating data.
[ERROR in query 4282] Percona-XtraDB-Cluster prohibits use of DML command on a table (db.flag_types) without an explicit primary key with pxc_strict_mode = ENFORCING or MASTER

Comments

joelpittet created an issue. See original summary.

joelpittet’s picture

StatusFileSize
new1.37 KB
joachim’s picture

Status: Active » Needs work
+++ b/flag.install
@@ -135,6 +135,12 @@ function flag_schema() {
+        'description' => 'The unique identifier for this flag type.',

That description isn't correct. Each row here isn't a flag type, it's just part of the flag bundle setting.

Just call this something like 'Serial primary key'. It's nothing to do with the flag at all and we don't want people to think it might be.

BTW, there's another issue somewhere to fold this table into serialized data.

Delphine Lepers’s picture

New patch as the hook_update was jumping one number

Delphine Lepers’s picture

StatusFileSize
new573 bytes

To keep consistency with the other tables, I used fid as primary key in this new patch

Delphine Lepers’s picture

StatusFileSize
new577 bytes
shura80’s picture

The patch gives the following error if trying to add multiple bundles on the same flag (no difference if flag is new like the one that gives me this error or updated):

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '11' for key 'PRIMARY': INSERT INTO {flag_types} (fid, type) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array.... in flag_flag->insert()

this line in the patch:

db_add_primary_key($db_table, array('fid'));

should be:

db_add_primary_key($db_table, array('fid', 'type'));

shura80’s picture

StatusFileSize
new589 bytes
shura80’s picture

StatusFileSize
new592 bytes
shura80’s picture

StatusFileSize
new593 bytes
Delphine Lepers’s picture

Status: Needs work » Reviewed & tested by the community

You are perfectly right, i have the same issue and tested your patch successfully
Thank you :)
I am marking as RTBC

shura80’s picture

Thank you too, Delphine!

ivnish’s picture

Status: Reviewed & tested by the community » Closed (outdated)

Closed as outdated because Drupal 7 is EOL