Reedy added a comment.

  Hacking in searching for `''` in the SQL... The only results I get are like 
this the below, where the `''` is involving escaped `'` as part of a page name
  
      string(90) "( cl_from = '60585988' AND cl_to > 'Ulmus_\'Concavaefolia\'' 
) OR ( cl_from > '60585988' )"
    string(1983) "SELECT  cl_from,cl_to  FROM `categorylinks`    WHERE cl_type 
= 'subcat' AND cl_from IN 
(6917262,11731108,11731115,6917321,6917308,22999510,22999506,6917324,19618347,6917263,3901226,36136947,71803983,15481013,15643460,15643457,4168969,23720883,11731128,26544904,6917270,6917541,81853210,6917487,6917504,11355945,81853101,6917492,14751164,8831727,41214113,6917575,19146951,11731159,6917395,48699998,11731135,8843251,6917470,6917359,80175799,81853112,6917526,48700003,6917586,26543831,11355935,7417687,9744646,6917532,6917569,75438180,6917605,6917458,6917273,45631507,30329485,90128015,7100286,80347216,13335754,70286641,15643569,17462056,79164124,87026969,7270189,1503240,8374419,8480627,2088961,2088986,35410655,39175699,77851420,77851406,11301195,27675596,30481165,11301152,50148533,42139045,27675562,35626227,77851336,84656381,49129500,49129533,49129498,57618508,48948238,48948388,48948149,49243838,48948380,48948139,49129706,49129519,49129494,57618498,8300337,27675358,9814610,8300363,42139117,27675328,42139176,42107188,29042464,15723045,40463923,87003026,69747457,69747412,69747483,81202445,90219115,90218996,90219590,90218955,90219659,90219453,90219094,87310587,87321275,69747470,90219917,90219597,90219023,59283448,59285253,59284734,59284549,59308876,59609905,90219677,90219816,90220014,59285239,90219159,69747392,59308911,59309432,69747449,69747363,59283466,8300374,18294650,9814499,81518518,59607943,59608094,30302635,59614610,59611723,59611876,59612109,59608959,60670799,59610338,59610473,59609608,59609722,59608716,59609973,30302676,59614318,59723405,59687995,59723471,30218594,30218635,59608352,59688006,30218483,60671152,30218507,30258073,3537699,90663308,90663255,90663227,59643008,59610599,90663158,90662992,59643024,90663496,90663454,59610687,77851187,77851130,77851349,1503250,6609354,19838991,34323319,19838988,66147515,84866975)
  AND (( cl_from = '30329485' AND cl_to > 'Bo\'+Bo\'Bo\'+Bo\'' ) OR ( cl_from > 
'30329485' ))  ORDER BY cl_from ASC,cl_to ASC LIMIT 200  "
      string(85) "( cl_from = '30329485' AND cl_to > 'Bo\'+Bo\'Bo\'+Bo\'' ) OR 
( cl_from > '30329485' )"
  
  But these queries have an extra condtion on the end, not what the originally 
reported example was
  
        /**
         * Uses the primary key list and the maximal result row from the
         * previous iteration to build an SQL condition sufficient for
         * selecting the next page of results.  All except the final key use
         * `=` conditions while the final key uses a `>` condition
         *
         * Example output:
         *     [ '( foo = 42 AND bar > 7 ) OR ( foo > 42 )' ]
         *
         * @return array The SQL conditions necessary to select the next set
         *  of rows in the batched query
         */
        protected function buildConditions() {
                if ( !$this->current ) {
                        return $this->conditions;
                }
    
                $maxRow = end( $this->current );
                $maximumValues = [];
                foreach ( $this->primaryKey as $alias => $column ) {
                        $name = is_numeric( $alias ) ? $column : $alias;
                        $maximumValues[$column] = $this->db->addQuotes( 
$maxRow->{$name} );
                }
    
                $pkConditions = [];
                // For example: If we have 3 primary keys
                // first run through will generate
                //   col1 = 4 AND col2 = 7 AND col3 > 1
                // second run through will generate
                //   col1 = 4 AND col2 > 7
                // and the final run through will generate
                //   col1 > 4
                while ( $maximumValues ) {
                        $pkConditions[] = $this->buildGreaterThanCondition( 
$maximumValues );
                        array_pop( $maximumValues );
                }
    
                $conditions = $this->conditions;
                $conditions[] = sprintf( '( %s )', implode( ' ) OR ( ', 
$pkConditions ) );
    
                return $conditions;
        }
  
  I wonder if I'm looking in the wrong place; 
`maintenance/categoryChangesAsRdf.php` also does a similar query (but from an 
input), which might explain Cormac's question/confusion about it not apparently 
being what would seem to have come from `order by page_title` (ie it's being 
generated from recent changes)
  
  That is also run by cron 
https://github.com/wikimedia/puppet/blob/c54076e866b49e3a737dc728a6d063f2b31ae076/modules/snapshot/files/cron/dumpcategoriesrdf-daily.sh
  
  Obviously it'd be very helpful if `BatchRowIterator::next` wasn't coming up 
as the calling function... but I guess that's harder with the iterator function 
calls... I wonder if we can do much about that?

TASK DETAIL
  https://phabricator.wikimedia.org/T260232

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Reedy
Cc: ArielGlenn, CBogen, Cparle, Umherirrender, DannyS712, Naike, WDoranWMF, 
Krinkle, aaron, Reedy, Ladsgroup, Aklapper, Marostegui, XeroS_SkalibuR, 
jannee_e, Akuckartz, Adidsone1, darthmon_wmde, holger.knust, EvanProdromou, 
Nandana, Namenlos314, Phukettaxigroup, Lahi, Gq86, Darkminds3113, 
Lucas_Werkmeister_WMDE, GoranSMilovanovic, Jayprakash12345, Lunewa, QZanden, 
EBjune, merbst, LawExplorer, Vali.matei, _jensen, rosalieper, Agabi10, 
Scott_WUaS, Pchelolo, Jonas, Xmlizer, Volker_E, gnosygnu, jkroll, 
Wikidata-bugs, Jdouglas, aude, Tobias1984, GWicke, Dcljr, Dinoguy1000, 
Manybubbles, Mbch331, Rxy, Jay8g
_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to