Fixup some SELECT * usages in sqlite schema patches
authorReedy <reedy@wikimedia.org>
Sun, 10 May 2020 01:14:35 +0000 (02:14 +0100)
committerReedy <reedy@wikimedia.org>
Mon, 18 May 2020 20:21:11 +0000 (21:21 +0100)
Bug: T252311
Change-Id: I7abdb7db89873c20f3a79df9452ab45c59ca6395

maintenance/sqlite/archives/patch-categorylinks-fix-pk.sql
maintenance/sqlite/archives/patch-iwlinks-fix-pk.sql
maintenance/sqlite/archives/patch-langlinks-fix-pk.sql
maintenance/sqlite/archives/patch-log_search-fix-pk.sql
maintenance/sqlite/archives/patch-module_deps-fix-pk.sql
maintenance/sqlite/archives/patch-objectcache-fix-pk.sql
maintenance/sqlite/archives/patch-querycache_info-fix-pk.sql
maintenance/sqlite/archives/patch-site_stats-fix-pk.sql
maintenance/sqlite/archives/patch-text-fix-pk.sql
maintenance/sqlite/archives/patch-user_former_groups-fix-pk.sql
maintenance/sqlite/archives/patch-user_properties-fix-pk.sql

index 13a75a3..6bf2295 100644 (file)
@@ -40,8 +40,8 @@ CREATE TABLE /*_*/categorylinks_tmp (
   PRIMARY KEY (cl_from,cl_to)
 ) /*$wgDBTableOptions*/;
 
-INSERT INTO /*_*/categorylinks_tmp
-       SELECT *
+INSERT INTO /*_*/categorylinks_tmp(cl_from, cl_to, cl_sortkey, cl_sortkey_prefix, cl_timestamp, cl_collation, cl_type)
+       SELECT cl_from, cl_to, cl_sortkey, cl_sortkey_prefix, cl_timestamp, cl_collation, cl_type
                FROM /*_*/categorylinks;
 
 DROP TABLE /*_*/categorylinks;
@@ -57,4 +57,4 @@ CREATE INDEX /*i*/cl_sortkey ON /*_*/categorylinks (cl_to,cl_type,cl_sortkey,cl_
 CREATE INDEX /*i*/cl_timestamp ON /*_*/categorylinks (cl_to,cl_timestamp);
 
 -- Used when updating collation (e.g. updateCollation.php)
-CREATE INDEX /*i*/cl_collation_ext ON /*_*/categorylinks (cl_collation, cl_to, cl_type, cl_from);
\ No newline at end of file
+CREATE INDEX /*i*/cl_collation_ext ON /*_*/categorylinks (cl_collation, cl_to, cl_type, cl_from);
index 91ce251..e973c9d 100644 (file)
@@ -10,8 +10,8 @@ CREATE TABLE /*_*/iwlinks_tmp (
   PRIMARY KEY (iwl_from,iwl_prefix,iwl_title)
 ) /*$wgDBTableOptions*/;
 
-INSERT INTO /*_*/iwlinks_tmp
-       SELECT * FROM /*_*/iwlinks;
+INSERT INTO /*_*/iwlinks_tmp(iwl_from, iwl_prefix, iwl_title)
+       SELECT iwl_from, iwl_prefix, iwl_title FROM /*_*/iwlinks;
 
 DROP TABLE /*_*/iwlinks;
 
@@ -21,4 +21,4 @@ ALTER TABLE /*_*/iwlinks_tmp RENAME TO /*_*/iwlinks;
 CREATE INDEX /*i*/iwl_prefix_title_from ON /*_*/iwlinks (iwl_prefix, iwl_title, iwl_from);
 
 -- Index for ApiQueryIWLinks
-CREATE INDEX /*i*/iwl_prefix_from_title ON /*_*/iwlinks (iwl_prefix, iwl_from, iwl_title);
\ No newline at end of file
+CREATE INDEX /*i*/iwl_prefix_from_title ON /*_*/iwlinks (iwl_prefix, iwl_from, iwl_title);
index da096ac..ee164cc 100644 (file)
@@ -10,12 +10,12 @@ CREATE TABLE /*_*/langlinks_tmp (
   PRIMARY KEY (ll_from,ll_lang)
 ) /*$wgDBTableOptions*/;
 
-INSERT INTO /*_*/langlinks_tmp
-       SELECT * FROM /*_*/langlinks;
+INSERT INTO /*_*/langlinks_tmp(ll_from, ll_lang, ll_title)
+       SELECT ll_from, ll_lang, ll_title FROM /*_*/langlinks;
 
 DROP TABLE /*_*/langlinks;
 
 ALTER TABLE /*_*/langlinks_tmp RENAME TO /*_*/langlinks;
 
 -- Index for ApiQueryLangbacklinks
-CREATE INDEX /*i*/ll_lang ON /*_*/langlinks (ll_lang, ll_title);
\ No newline at end of file
+CREATE INDEX /*i*/ll_lang ON /*_*/langlinks (ll_lang, ll_title);
index 153e415..7c55993 100644 (file)
@@ -8,11 +8,11 @@ CREATE TABLE /*_*/log_search_tmp (
   PRIMARY KEY (ls_field,ls_value,ls_log_id)
 ) /*$wgDBTableOptions*/;
 
-INSERT INTO /*_*/log_search_tmp
-       SELECT * FROM /*_*/log_search;
+INSERT INTO /*_*/log_search_tmp(ls_field, ls_value, ls_log_id)
+       SELECT ls_field, ls_value, ls_log_id FROM /*_*/log_search;
 
 DROP TABLE /*_*/log_search;
 
 ALTER TABLE /*_*/log_search_tmp RENAME TO /*_*/log_search;
 
-CREATE INDEX /*i*/ls_log_id ON /*_*/log_search (ls_log_id);
\ No newline at end of file
+CREATE INDEX /*i*/ls_log_id ON /*_*/log_search (ls_log_id);
index 73bcbe2..bf5153f 100644 (file)
@@ -8,9 +8,9 @@ CREATE TABLE /*_*/module_deps_tmp (
   PRIMARY KEY (md_module,md_skin)
 ) /*$wgDBTableOptions*/;
 
-INSERT INTO /*_*/module_deps_tmp
-       SELECT * FROM /*_*/module_deps;
+INSERT INTO /*_*/module_deps_tmp(md_module, md_skin, md_deps)
+       SELECT md_module, md_skin, md_deps FROM /*_*/module_deps;
 
 DROP TABLE /*_*/module_deps;
 
-ALTER TABLE /*_*/module_deps_tmp RENAME TO /*_*/module_deps;
\ No newline at end of file
+ALTER TABLE /*_*/module_deps_tmp RENAME TO /*_*/module_deps;
index f2bef58..c3228a9 100644 (file)
@@ -4,11 +4,11 @@ CREATE TABLE /*_*/objectcache_tmp (
   exptime datetime
 ) /*$wgDBTableOptions*/;
 
-INSERT INTO /*_*/objectcache_tmp
-       SELECT * FROM /*_*/objectcache;
+INSERT INTO /*_*/objectcache_tmp(keyname, "value", exptime)
+       SELECT keyname, "value", exptime FROM /*_*/objectcache;
 
 DROP TABLE /*_*/objectcache;
 
 ALTER TABLE /*_*/objectcache_tmp RENAME TO /*_*/objectcache;
 
-CREATE INDEX /*i*/exptime ON /*_*/objectcache (exptime);
\ No newline at end of file
+CREATE INDEX /*i*/exptime ON /*_*/objectcache (exptime);
index d9483be..6960667 100644 (file)
@@ -7,9 +7,9 @@ CREATE TABLE /*_*/querycache_info_tmp (
   qci_timestamp binary(14) NOT NULL default '19700101000000'
 ) /*$wgDBTableOptions*/;
 
-INSERT INTO /*_*/querycache_info_tmp
-       SELECT * FROM /*_*/querycache_info;
+INSERT INTO /*_*/querycache_info_tmp(qci_type, qci_timestamp)
+       SELECT qci_type, qci_timestamp FROM /*_*/querycache_info;
 
 DROP TABLE /*_*/querycache_info;
 
-ALTER TABLE /*_*/querycache_info_tmp RENAME TO /*_*/querycache_info;
\ No newline at end of file
+ALTER TABLE /*_*/querycache_info_tmp RENAME TO /*_*/querycache_info;
index d785e98..b5b60f1 100644 (file)
@@ -25,9 +25,9 @@ CREATE TABLE /*_*/site_stats_tmp (
   ss_images int default 0
 ) /*$wgDBTableOptions*/;
 
-INSERT INTO /*_*/site_stats_tmp
-       SELECT * FROM /*_*/site_stats;
+INSERT INTO /*_*/site_stats_tmp(ss_row_id, ss_total_edits, ss_good_articles, ss_total_pages, ss_users, ss_active_users, ss_images)
+       SELECT ss_row_id, ss_total_edits, ss_good_articles, ss_total_pages, ss_users, ss_active_users, ss_images FROM /*_*/site_stats;
 
 DROP TABLE /*_*/site_stats;
 
-ALTER TABLE /*_*/site_stats_tmp RENAME TO /*_*/site_stats;
\ No newline at end of file
+ALTER TABLE /*_*/site_stats_tmp RENAME TO /*_*/site_stats;
index 380887b..623bdb3 100644 (file)
@@ -29,9 +29,9 @@ CREATE TABLE /*_*/text_tmp (
   old_flags tinyblob NOT NULL
 ) /*$wgDBTableOptions*/ MAX_ROWS=10000000 AVG_ROW_LENGTH=10240;
 
-INSERT INTO /*_*/text_tmp
-       SELECT * FROM /*_*/text;
+INSERT INTO /*_*/text_tmp(old_id, old_text, old_flags)
+       SELECT old_id, old_text, old_flags FROM /*_*/text;
 
 DROP TABLE /*_*/text;
 
-ALTER TABLE /*_*/text_tmp RENAME TO /*_*/text;
\ No newline at end of file
+ALTER TABLE /*_*/text_tmp RENAME TO /*_*/text;
index 4f5d622..969c24b 100644 (file)
@@ -5,9 +5,9 @@ CREATE TABLE /*_*/user_former_groups_tmp (
   PRIMARY KEY (ufg_user,ufg_group)
 ) /*$wgDBTableOptions*/;
 
-INSERT INTO /*_*/user_former_groups_tmp
-       SELECT * FROM /*_*/user_former_groups;
+INSERT INTO /*_*/user_former_groups_tmp(ufg_user, ufg_group)
+       SELECT ufg_user, ufg_group FROM /*_*/user_former_groups;
 
 DROP TABLE /*_*/user_former_groups;
 
-ALTER TABLE /*_*/user_former_groups_tmp RENAME TO /*_*/user_former_groups;
\ No newline at end of file
+ALTER TABLE /*_*/user_former_groups_tmp RENAME TO /*_*/user_former_groups;
index 8362d23..682f568 100644 (file)
@@ -10,11 +10,11 @@ CREATE TABLE /*_*/user_properties_tmp (
   PRIMARY KEY (up_user,up_property)
 ) /*$wgDBTableOptions*/;
 
-INSERT INTO /*_*/user_properties_tmp
-       SELECT * FROM /*_*/user_properties;
+INSERT INTO /*_*/user_properties_tmp(up_user, up_property, up_value)
+       SELECT up_user, up_property, up_value FROM /*_*/user_properties;
 
 DROP TABLE /*_*/user_properties;
 
 ALTER TABLE /*_*/user_properties_tmp RENAME TO /*_*/user_properties;
 
-CREATE INDEX /*i*/user_properties_property ON /*_*/user_properties (up_property);
\ No newline at end of file
+CREATE INDEX /*i*/user_properties_property ON /*_*/user_properties (up_property);