Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: 在什么情况下同一个表能出现重复字段名?
I found that there are two fields with the same name in a table, and all attributes are the same.
The strange thing is that the field names are the same, but the data inside is different!
When I try to add a new field, it reports an error:
ALTER TABLE soa_system.app_version_control_history
ADD COLUMN force_upgrade_range tinyint(1) NULL COMMENT ‘Force upgrade range 1: Minimum version 2: Specified version’ AFTER force_upgrade
1060 - Duplicate column name ‘force_upgrade_range’
Please share the table creation statement, it’s amazing.
CREATE TABLE app_version_control_history (
id bigint(19) NOT NULL /*T![auto_rand] AUTO_RANDOM(5) */ COMMENT ‘Primary key id’,
app_id int(11) NOT NULL COMMENT ‘xxxxxx’,
app_type tinyint(1) NOT NULL COMMENT ‘app type (0: IOS; 1: Android)’,
app_version varchar(128) COLLATE utf8mb4_general_ci NOT NULL COMMENT ‘app version number’,
zip_download_url varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT ‘download URL’,
description text COLLATE utf8mb4_general_ci NOT NULL COMMENT ‘description’,
notes varchar(255) COLLATE utf8mb4_general_ci NOT NULL DEFAULT ‘’ COMMENT ‘notes’,
force_upgrade tinyint(1) NOT NULL COMMENT ‘force upgrade (0: not forced; 1: forced)’,
force_upgrade_range tinyint(1) DEFAULT NULL COMMENT ‘force upgrade range 1: minimum version 2: specified version’,
force_upgrage_range tinyint(1) DEFAULT NULL COMMENT ‘force upgrade range 1: minimum version 2: specified version’,
force_app_version_num int(0) DEFAULT NULL COMMENT ‘minimum version for forced upgrade, versions below this need to be upgraded’,
create_id bigint(19) NOT NULL COMMENT ‘creator’,
create_time datetime NOT NULL COMMENT ‘creation time’,
update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT ‘update time’,
title varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT ‘title’,
sub_title varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT ‘subtitle’,
warning varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT ‘warning’,
positive_btn varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT ‘confirm button’,
negative_btn varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT ‘cancel button’,
del_flag tinyint(1) NOT NULL DEFAULT ‘0’ COMMENT ‘delete flag 0 for not deleted, 1 for deleted’,
PRIMARY KEY (id) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci /*T![auto_rand_base] AUTO_RANDOM_BASE=630001 */ COMMENT=‘app version upgrade control table’;
Take a look at these two columns in information_schema.columns.
One is “upgrade,” and the other is “upgrage” 
Master, you have sharp eyes; I must have been seeing things.
I discovered it using a comparison tool. Initially, it executed successfully on my local machine, which I found unbelievable. So, I used a comparison tool to check, and the differences immediately became apparent~
Good eyesight, I actually didn’t notice it.
dg 
It turns out that working overtime on weekends is not advisable.
To do a good job, one must first sharpen one’s tools.
In the middle of winter, weekends should be spent lying in bed and sleeping.
The field names “upgrade” and “upgrage” are different. In theory, a DBA is a meticulous profession and should not make such mistakes.
Too similar, you can’t tell without looking closely.
It’s still better to be meticulous and careful.
Therefore, the profession of a DBA can affect a person’s habits and level of meticulousness.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.