Re: Database integrity issue in pagelinks table

Amir Sarabadani via MediaWiki-l <[email protected]> Tue, 28 Jul 2026 10:54:27 +0200
Newsgroups gmane.org.wikimedia.mediawiki
Message-ID <CA+ttme3EfcHS4LyvE8K1hoeLE-zkV4AA+5pBu0pG2XBPt2HrAw@mail.gmail.com>
--===============3559416903794009018==
Content-Type: multipart/alternative; boundary="000000000000bf788c0657a7fefe"

--000000000000bf788c0657a7fefe
Content-Type: text/plain; charset="UTF-8"

Hi,
My suggestion is to get rid of the rows and reparse, pagelinks rows are
derivative data and self-heals with reparse. Just delete the rows for that
specific error and reparse the page. That's what I did when I had the same
problem.

HTH.

Am So., 26. Juli 2026 um 20:27 Uhr schrieb Peter Hicks via MediaWiki-l <
[email protected]>:

> All,
>
> I have an issue with the pagelinks table in a MW 1.44.2 install.  When
> performing an upgrade to MW 1.46 (or indeed just to 1.44.3!) and running
> the update maintenance script, it bombs out:
>
> Table pagelinks contains pl_title field.
> Dropping...Wikimedia\Rdbms\DBQueryError from line 1230 of
> /opt/mediawiki/includes/libs/Rdbms/Database/Database.php: Error 1062:
> Duplicate entry '1-32' for key 'PRIMARY'
> Function: Wikimedia\Rdbms\Database::sourceFile(
> /opt/mediawiki/sql/mysql/patch-pagelinks-drop-pl_title.sql )
> Query: ALTER TABLE `pagelinks`
>  ADD PRIMARY KEY (pl_from, pl_target_id)
>
> Prior to running the 'update' maintenance script using 'run.php', there is
> only one row with pl_from=1 and pl_target_id=32, so the migration scripts
> are creating duplicate entries.
>
> Although running the 'update' script a second time causes it to succeed, I
> don't want to do this in a production environment and risk problems later
> down the line.
>
> According to https://www.mediawiki.org/wiki/Manual:Pagelinks_table,
> 'Regenerating the pagelinks table is always possible using the
> rebuildall.php maintenance script', but if I run this on the database prior
> to migration, it doesn't appear to delete anything from the pagelinks table.
>
> I am at a loss.  Can anyone help me work out what's going on?
>
> Best wishes,
>
>
> Peter
>
>
>
> _______________________________________________
> MediaWiki-l mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
>
> https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/



-- 
Amir (he/him)

--000000000000bf788c0657a7fefe
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hi,</div><div>My suggestion is to get rid of the rows=
 and reparse, pagelinks rows are derivative data and self-heals with repars=
e. Just delete the rows for that specific error and reparse the page. That&=
#39;s what I did when I had the same problem.</div><div><br></div><div>HTH.=
</div></div><br><div class=3D"gmail_quote gmail_quote_container"><div dir=
=3D"ltr" class=3D"gmail_attr">Am So., 26. Juli 2026 um 20:27=C2=A0Uhr schri=
eb Peter Hicks via MediaWiki-l &lt;<a href=3D"mailto:[email protected]=
media.org">[email protected]</a>&gt;:<br></div><blockquote cl=
ass=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid=
 rgb(204,204,204);padding-left:1ex"><div style=3D"font-family:Arial,sans-se=
rif;font-size:14px"><span>All,</span><div><br></div><div><span>I have an is=
sue with the pagelinks table in a MW 1.44.2 install.=C2=A0 When performing =
an upgrade to MW 1.46 (or indeed just to 1.44.3!) and running the update ma=
intenance script, it bombs out:</span></div><div><br></div><div><span style=
=3D"font-family:Menlo,Consolas,&quot;Courier New&quot;,monospace">Table pag=
elinks contains pl_title field. Dropping...Wikimedia\Rdbms\DBQueryError fro=
m line 1230 of /opt/mediawiki/includes/libs/Rdbms/Database/Database.php: Er=
ror 1062: Duplicate entry &#39;1-32&#39; for key &#39;PRIMARY&#39;</span></=
div><div><span style=3D"font-family:Menlo,Consolas,&quot;Courier New&quot;,=
monospace">Function: Wikimedia\Rdbms\Database::sourceFile( /opt/mediawiki/s=
ql/mysql/patch-pagelinks-drop-pl_title.sql )</span></div><div><span style=
=3D"font-family:Menlo,Consolas,&quot;Courier New&quot;,monospace">Query: AL=
TER TABLE `pagelinks`</span></div><div><span style=3D"font-family:Menlo,Con=
solas,&quot;Courier New&quot;,monospace">=C2=A0ADD PRIMARY KEY (pl_from, pl=
_target_id)</span></div><div><br></div><div><span>Prior to running the &#39=
;update&#39; maintenance script using &#39;run.php&#39;, there is only one =
row with pl_from=3D1 and pl_target_id=3D32, so the migration scripts are cr=
eating duplicate entries.</span></div><div><br></div><div><span>Although ru=
nning the &#39;update&#39; script a second time causes it to succeed, I don=
&#39;t want to do this in a production environment and risk problems later =
down the line.</span></div><div><br></div><div><span>According to <a rel=3D=
"noreferrer nofollow noopener" href=3D"https://www.mediawiki.org/wiki/Manua=
l:Pagelinks_table" target=3D"_blank">https://www.mediawiki.org/wiki/Manual:=
Pagelinks_table</a>, &#39;Regenerating the pagelinks table is always possib=
le using the rebuildall.php maintenance script&#39;, but if I run this on t=
he database prior to migration, it doesn&#39;t appear to delete anything fr=
om the pagelinks table.</span></div><div><br></div><div><span>I am at a los=
s.=C2=A0 Can anyone help me work out what&#39;s going on?=C2=A0</span></div=
><div><br></div><div><span>Best wishes,</span></div><div><br></div><div><br=
></div><div><span>Peter</span></div><div><br></div><div><br></div><span></s=
pan><br></div>
<div style=3D"font-family:Arial,sans-serif;font-size:14px">
    <div>
       =20
            </div>
   =20
            <div>
       =20
            </div>
</div>
_______________________________________________<br>
MediaWiki-l mailing list -- <a href=3D"mailto:[email protected]=
rg" target=3D"_blank">[email protected]</a><br>
To unsubscribe send an email to <a href=3D"mailto:[email protected]=
ikimedia.org" target=3D"_blank">[email protected]</a><b=
r>
<a href=3D"https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wi=
kimedia.org/" rel=3D"noreferrer" target=3D"_blank">https://lists.wikimedia.=
org/postorius/lists/mediawiki-l.lists.wikimedia.org/</a></blockquote></div>=
<div><br clear=3D"all"></div><br><span class=3D"gmail_signature_prefix">-- =
</span><br><div dir=3D"ltr" class=3D"gmail_signature"><div dir=3D"ltr"><div=
>Amir (he/him)<br><br></div></div></div>

--000000000000bf788c0657a7fefe--

--===============3559416903794009018==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
MediaWiki-l mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
--===============3559416903794009018==--