Toggle navigation
Home
New Query
Recent Queries
Discuss
Database tables
Database names
MediaWiki
Wikibase
Replicas browser and optimizer
Login
History
Fork
Fork of
Edit notices disconnected from their pages in mainspace
by
Cryptic
This query is marked as a draft
This query has been published
by
Cryptic
.
Edit notices attached titles that are either redlinks or redirects. In the latter case, the edit notice must not also be a redirect, with the unchecked assumption that it points to an edit notice for the page the redirect is pointing to. For [[WP:RAQ#Orphaned editnotices]] circa 25 Dec 2024.
Toggle Highlighting
SQL
WITH editnotices(en_title, en_is_redirect) AS ( SELECT page_title, page_is_redirect FROM page WHERE page_namespace = 10 AND page_title LIKE 'Editnotices/Page/%' ), -- unfortunately, trying to use these ctes for the non-0 namespaces kills performance - -- if there's a less fugly way of doing it than all of these unions, I can't think of it. ns(ns_n, ns_s) AS (VALUES (-2, 'Media:'), (-1, 'Special:'), (0, ''), (1, 'Talk:'), (2, 'User:'), (3, 'User talk:'), (4, 'Wikipedia:'), (5, 'Wikipedia talk:'), (6, ':File:'), (7, 'File talk:'), (8, 'MediaWiki:'), (9, 'MediaWiki talk:'), (10, 'Template:'), (11, 'Template talk:'), (12, 'Help:'), (13, 'Help talk:'), (14, ':Category:'), (15, 'Category talk:'), (100, 'Portal:'), (101, 'Portal talk:'), (118, 'Draft:'), (119, 'Draft talk:'), (126, 'MOS:'), (127, 'MOS talk:'), (710, 'TimedText:'), (711, 'TimedText talk:'), (828, 'Module:'), (829, 'Module talk:')), prefixes AS (SELECT CONCAT('Editnotices/Page/', REPLACE(REPLACE(ns_s, ':', ''), ' ', '_')) FROM ns WHERE ns_n <> 0) -- mainspace SELECT 0 AS namespace, CONCAT('Template:', en_title) AS title, page_is_redirect AS 'exists as redirect' FROM editnotices LEFT JOIN page ON page_namespace = 0 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) NOT IN (SELECT * FROM prefixes) UNION SELECT 1, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 1 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/Talk:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/Talk' UNION SELECT 2, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 2 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/User:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/User' UNION SELECT 3, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 3 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/User_talk:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/User_talk' UNION SELECT 4, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 4 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/Wikipedia:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/Wikipedia' UNION SELECT 5, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 5 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/Wikipedia_talk:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/Wikipedia_talk' UNION SELECT 6, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 6 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/File:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/File' UNION SELECT 7, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 7 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/File_talk:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/File_talk' UNION SELECT 8, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 8 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/MediaWiki:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/MediaWiki' UNION SELECT 9, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 9 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/MediaWiki_talk:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/MediaWiki_talk' UNION SELECT 10, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 10 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/Template:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/Template' UNION SELECT 11, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 11 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/Template_talk:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/Template_talk' UNION SELECT 12, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 12 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/Help:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/Help' UNION SELECT 13, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 13 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/Help_talk:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/Help_talk' UNION SELECT 14, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 14 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/Category:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/Category' UNION SELECT 15, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 15 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/Category_talk:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/Category_talk' UNION SELECT 100, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 100 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/Portal:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/Portal' UNION SELECT 101, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 101 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/Portal_talk:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/Portal_talk' UNION SELECT 118, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 118 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/Draft:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/Draft' UNION SELECT 119, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 119 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/Draft_talk:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/Draft_talk' UNION SELECT 126, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 126 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/MOS:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/MOS' UNION SELECT 127, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 127 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/MOS_talk:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/MOS_talk' UNION SELECT 710, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 710 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/TimedText:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/TimedText' UNION SELECT 711, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 711 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/TimedText_talk:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/TimedText_talk' UNION SELECT 828, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 828 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/Module:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/Module' UNION SELECT 829, CONCAT('Template:', en_title), page_is_redirect FROM editnotices LEFT JOIN page ON page_namespace = 829 AND page_title = SUBSTRING(en_title, LENGTH('Editnotices/Page/Module_talk:') + 1) WHERE (page_is_redirect IS NULL -- doesn't exist OR (page_is_redirect = 1 -- exists as redirect AND en_is_redirect = 0)) -- but the editnotice isn't also a redirect AND SUBSTRING_INDEX(en_title, ':', 1) = 'Editnotices/Page/Module_talk' ORDER BY namespace ASC, title ASC;
By running queries you agree to the
Cloud Services Terms of Use
and you irrevocably agree to release your SQL under
CC0 License
.
Submit Query
Stop Query
All SQL code is licensed under
CC0 License
.
Checking query status...