From: Reedy Date: Sun, 10 May 2020 01:14:35 +0000 (+0100) Subject: Fixup some SELECT * usages in sqlite schema patches X-Git-Tag: 1.34.2~11 X-Git-Url: http://git.cyclocoop.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=65e25dd3e98c3f65b9bec0a9ec9523c768fdf4ff Fixup some SELECT * usages in sqlite schema patches Bug: T252311 Change-Id: I7abdb7db89873c20f3a79df9452ab45c59ca6395 (cherry picked from commit 634024b03005f835f086e2f8b244fde1f9101252) --- diff --git a/maintenance/sqlite/archives/patch-categorylinks-fix-pk.sql b/maintenance/sqlite/archives/patch-categorylinks-fix-pk.sql index 13a75a36f9..6bf2295510 100644 --- a/maintenance/sqlite/archives/patch-categorylinks-fix-pk.sql +++ b/maintenance/sqlite/archives/patch-categorylinks-fix-pk.sql @@ -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); diff --git a/maintenance/sqlite/archives/patch-interwiki-fix-pk.sql b/maintenance/sqlite/archives/patch-interwiki-fix-pk.sql index f25f54ca6f..d616b219e4 100644 --- a/maintenance/sqlite/archives/patch-interwiki-fix-pk.sql +++ b/maintenance/sqlite/archives/patch-interwiki-fix-pk.sql @@ -21,8 +21,8 @@ CREATE TABLE /*_*/interwiki_tmp ( iw_trans tinyint NOT NULL default 0 ) /*$wgDBTableOptions*/; -INSERT INTO /*_*/interwiki_tmp - SELECT * FROM /*_*/interwiki; +INSERT INTO /*_*/interwiki_tmp(iw_prefix, iw_url, iw_api, iw_wikiid, iw_local, iw_local, iw_trans) + SELECT iw_prefix, iw_url, iw_api, iw_wikiid, iw_local, iw_local, iw_trans FROM /*_*/interwiki; DROP TABLE /*_*/interwiki; diff --git a/maintenance/sqlite/archives/patch-iwlinks-fix-pk.sql b/maintenance/sqlite/archives/patch-iwlinks-fix-pk.sql index 91ce25196d..e973c9d750 100644 --- a/maintenance/sqlite/archives/patch-iwlinks-fix-pk.sql +++ b/maintenance/sqlite/archives/patch-iwlinks-fix-pk.sql @@ -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); diff --git a/maintenance/sqlite/archives/patch-langlinks-fix-pk.sql b/maintenance/sqlite/archives/patch-langlinks-fix-pk.sql index da096aceb0..ee164cc103 100644 --- a/maintenance/sqlite/archives/patch-langlinks-fix-pk.sql +++ b/maintenance/sqlite/archives/patch-langlinks-fix-pk.sql @@ -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); diff --git a/maintenance/sqlite/archives/patch-log_search-fix-pk.sql b/maintenance/sqlite/archives/patch-log_search-fix-pk.sql index 153e415014..7c559930f0 100644 --- a/maintenance/sqlite/archives/patch-log_search-fix-pk.sql +++ b/maintenance/sqlite/archives/patch-log_search-fix-pk.sql @@ -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); diff --git a/maintenance/sqlite/archives/patch-module_deps-fix-pk.sql b/maintenance/sqlite/archives/patch-module_deps-fix-pk.sql index 73bcbe23f4..bf5153fd4b 100644 --- a/maintenance/sqlite/archives/patch-module_deps-fix-pk.sql +++ b/maintenance/sqlite/archives/patch-module_deps-fix-pk.sql @@ -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; diff --git a/maintenance/sqlite/archives/patch-objectcache-fix-pk.sql b/maintenance/sqlite/archives/patch-objectcache-fix-pk.sql index f2bef5838d..c3228a9b65 100644 --- a/maintenance/sqlite/archives/patch-objectcache-fix-pk.sql +++ b/maintenance/sqlite/archives/patch-objectcache-fix-pk.sql @@ -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); diff --git a/maintenance/sqlite/archives/patch-page_props-fix-pk.sql b/maintenance/sqlite/archives/patch-page_props-fix-pk.sql index 3a40d861d0..cc246320b5 100644 --- a/maintenance/sqlite/archives/patch-page_props-fix-pk.sql +++ b/maintenance/sqlite/archives/patch-page_props-fix-pk.sql @@ -7,12 +7,12 @@ CREATE TABLE /*_*/page_props_tmp ( PRIMARY KEY (pp_page,pp_propname) ) /*$wgDBTableOptions*/; -INSERT INTO /*_*/page_props_tmp - SELECT * FROM /*_*/page_props; +INSERT INTO /*_*/page_props_tmp(pp_page, pp_propname, pp_value, pp_sortkey) + SELECT pp_page, pp_propname, pp_value, pp_sortkey FROM /*_*/page_props; DROP TABLE /*_*/page_props; ALTER TABLE /*_*/page_props_tmp RENAME TO /*_*/page_props; CREATE UNIQUE INDEX /*i*/pp_propname_page ON /*_*/page_props (pp_propname,pp_page); -CREATE UNIQUE INDEX /*i*/pp_propname_sortkey_page ON /*_*/page_props (pp_propname,pp_sortkey,pp_page); \ No newline at end of file +CREATE UNIQUE INDEX /*i*/pp_propname_sortkey_page ON /*_*/page_props (pp_propname,pp_sortkey,pp_page); diff --git a/maintenance/sqlite/archives/patch-protected_titles-fix-pk.sql b/maintenance/sqlite/archives/patch-protected_titles-fix-pk.sql index 083221433d..03b2c54c85 100644 --- a/maintenance/sqlite/archives/patch-protected_titles-fix-pk.sql +++ b/maintenance/sqlite/archives/patch-protected_titles-fix-pk.sql @@ -11,8 +11,8 @@ CREATE TABLE /*_*/protected_titles_tmp ( PRIMARY KEY (pt_namespace,pt_title) ) /*$wgDBTableOptions*/; -INSERT INTO /*_*/protected_titles_tmp - SELECT * FROM /*_*/protected_titles; +INSERT INTO /*_*/protected_titles_tmp(pt_namespace, pt_title, pt_user, pt_reason, pt_reason_id, pt_timestamp, pt_expiry, pt_create_perm) + SELECT pt_namespace, pt_title, pt_user, pt_reason, pt_reason_id, pt_timestamp, pt_expiry, pt_create_perm FROM /*_*/protected_titles; DROP TABLE /*_*/protected_titles; diff --git a/maintenance/sqlite/archives/patch-querycache_info-fix-pk.sql b/maintenance/sqlite/archives/patch-querycache_info-fix-pk.sql index d9483be4e9..6960667fa1 100644 --- a/maintenance/sqlite/archives/patch-querycache_info-fix-pk.sql +++ b/maintenance/sqlite/archives/patch-querycache_info-fix-pk.sql @@ -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; diff --git a/maintenance/sqlite/archives/patch-site_identifiers-fix-pk.sql b/maintenance/sqlite/archives/patch-site_identifiers-fix-pk.sql index 7ceadb708c..f4828d3107 100644 --- a/maintenance/sqlite/archives/patch-site_identifiers-fix-pk.sql +++ b/maintenance/sqlite/archives/patch-site_identifiers-fix-pk.sql @@ -11,12 +11,12 @@ CREATE TABLE /*_*/site_identifiers_tmp ( PRIMARY KEY (si_type, si_key) ) /*$wgDBTableOptions*/; -INSERT INTO /*_*/site_identifiers_tmp - SELECT * FROM /*_*/site_identifiers; +INSERT INTO /*_*/site_identifiers_tmp(si_site, si_type, si_key) + SELECT si_site, si_type, si_key FROM /*_*/site_identifiers; DROP TABLE /*_*/site_identifiers; ALTER TABLE /*_*/site_identifiers_tmp RENAME TO /*_*/site_identifiers; CREATE INDEX /*i*/site_ids_site ON /*_*/site_identifiers (si_site); -CREATE INDEX /*i*/site_ids_key ON /*_*/site_identifiers (si_key); \ No newline at end of file +CREATE INDEX /*i*/site_ids_key ON /*_*/site_identifiers (si_key); diff --git a/maintenance/sqlite/archives/patch-site_stats-fix-pk.sql b/maintenance/sqlite/archives/patch-site_stats-fix-pk.sql index d785e9841c..b5b60f1534 100644 --- a/maintenance/sqlite/archives/patch-site_stats-fix-pk.sql +++ b/maintenance/sqlite/archives/patch-site_stats-fix-pk.sql @@ -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; diff --git a/maintenance/sqlite/archives/patch-text-fix-pk.sql b/maintenance/sqlite/archives/patch-text-fix-pk.sql index 380887b179..623bdb3c02 100644 --- a/maintenance/sqlite/archives/patch-text-fix-pk.sql +++ b/maintenance/sqlite/archives/patch-text-fix-pk.sql @@ -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; diff --git a/maintenance/sqlite/archives/patch-user_former_groups-fix-pk.sql b/maintenance/sqlite/archives/patch-user_former_groups-fix-pk.sql index 4f5d62253a..969c24b5d1 100644 --- a/maintenance/sqlite/archives/patch-user_former_groups-fix-pk.sql +++ b/maintenance/sqlite/archives/patch-user_former_groups-fix-pk.sql @@ -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; diff --git a/maintenance/sqlite/archives/patch-user_properties-fix-pk.sql b/maintenance/sqlite/archives/patch-user_properties-fix-pk.sql index 8362d23365..682f568137 100644 --- a/maintenance/sqlite/archives/patch-user_properties-fix-pk.sql +++ b/maintenance/sqlite/archives/patch-user_properties-fix-pk.sql @@ -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);