# Pt-online-schema-change loses data from unaltered primary key column \`id\`

**URL:** https://forums.percona.com/t/pt-online-schema-change-loses-data-from-unaltered-primary-key-column-id/15012
**Category:** Percona Toolkit
**Tags:** mysql
**Created:** [March 31, 2022, 1:19pm UTC](https://forums.percona.com/t/pt-online-schema-change-loses-data-from-unaltered-primary-key-column-id/15012 "2022-03-31T13:19:17Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![romonion](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@romonion](https://forums.percona.com/u/romonion)
#### Post date: [March 31, 2022, 1:19pm UTC](https://forums.percona.com/t/pt-online-schema-change-loses-data-from-unaltered-primary-key-column-id/15012/1 "2022-03-31T13:19:17Z")

</div>

It seems that pt-online-schema-change can’t handle certain kinds of tables. The content of one column is lost entirely and since it’s part of the primary key some rows are lost as well.

I’m running `/usr/bin/pt-online-schema-change --alter="DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci" --no-check-plan D=global,t=_views_display` on the table below:

```sql
CREATE TABLE `views_display` (
  `vid` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'The view this display is attached to.',
  `id` varchar(64) NOT NULL DEFAULT '' COMMENT 'An identifier for this display; usually generated from the display_plugin, so should be something like page or page_1 or block_2, etc.',
  `display_title` varchar(64) NOT NULL DEFAULT '' COMMENT 'The title of the display, viewable by the administrator.',
  `display_plugin` varchar(64) NOT NULL DEFAULT '' COMMENT 'The type of the display. Usually page, block or embed, but is pluggable so may be other things.',
  `position` int(11) DEFAULT 0 COMMENT 'The order in which this display is loaded.',
  `display_options` longtext DEFAULT NULL COMMENT 'A serialized array of options for this display; it contains options that are generally only pertinent to that display plugin type.',
  PRIMARY KEY (`vid`,`id`),
  KEY `vid` (`vid`,`position`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPRESSED COMMENT='Stores information about each display attached to a view.'

```

This gives the following warning although the columns are not altered:

```auto
Using original table index PRIMARY for the DELETE trigger instead of new table index PRIMARY because the new table index uses column id which does not exist in the original table.

```

The resulting table has only empty strings in the `id` column and all but one matching row is deleted. Any ideas on how to resolve this?

---

<div class="post-metadata">

### Author: ![romonion](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@romonion](https://forums.percona.com/u/romonion)
#### Post date: [March 31, 2022, 6:27pm UTC](https://forums.percona.com/t/pt-online-schema-change-loses-data-from-unaltered-primary-key-column-id/15012/2 "2022-03-31T18:27:38Z")

</div>

The problem stops occurring when I remove the `DEFAULT ''` from the `id` column’s definition. This looks a lot like a bug.

---

<div class="post-metadata">

### Author: ![Ivan\_Groenewold](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ivan_groenewold/32/6299_2.png) [@Ivan\_Groenewold](https://forums.percona.com/u/Ivan_Groenewold)
#### Post date: [March 31, 2022, 6:31pm UTC](https://forums.percona.com/t/pt-online-schema-change-loses-data-from-unaltered-primary-key-column-id/15012/3 "2022-03-31T18:31:39Z")

</div>

Hi, would you mind opening a bug with this information? [jira.percona.com](http://jira.percona.com)

Thanks for reporting this

---

<div class="post-metadata">

### Author: ![romonion](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@romonion](https://forums.percona.com/u/romonion)
#### Post date: [March 31, 2022, 7:16pm UTC](https://forums.percona.com/t/pt-online-schema-change-loses-data-from-unaltered-primary-key-column-id/15012/4 "2022-03-31T19:16:41Z")

</div>

I’m going to file a bug report tomorrow. Initially I just wasn’t sure this isn’t something on my part that I overlooked. 🙂
