https://bugzilla.wikimedia.org/show_bug.cgi?id=42659

--- Comment #22 from José Antonio <[email protected]> ---
Both php uni-test errors are caused because the uni-test
PropertyStatisticsTableTest is assigning an out bounds value, 2147483648, to a
postgresql integer data type. Therefore postgresql system is working as it
should, failing the transaction.

http://www.postgresql.org/docs/9.1/static/datatype-numeric.html. 

Indeed  in the table: smw_prop_stats,  if the data type for the Colum:
usage_count is changed to bigint, then the unit test
PropertyStatisticsTableTest completes with no errors:
" 
  php   phpunit.php   includes/storage/sqlstore/PropertyStatisticsTableTest.php 
  PHPUnit 3.6.10 by Sebastian Bergmann.
  Configuration read from
/a/d2/data/asa/mediawiki/mediawiki-1.21.3_testing/tests/phpunit/suite.xml
  ..............................................
  Time: 3 seconds, Memory: 23.75Mb
  OK (46 tests, 314 assertions)
 "


 Moreover the statement  usage_count=$dbtypes[j] defines as integer data type
in postgresql.  Assuming the possibility of big data sets, the   a possible
solution would convert usage_count to a bigint data type for postgresql. 
Perhaps it would be a reasonable exercise to consider for postgresql that for
an statistical domain, all the integers (-2147483648 to +2147483647) should be
converted to bigints (-9223372036854775808 to 9223372036854775807).


Then  $dbtypes  array is defined  in the function setupTables, line 63 of
includes/storage/SQLStore/SMW_SQLStore3.php.

 $dbtypes = array(
            'b' => ( $wgDBtype == 'postgres' ? 'BOOLEAN' : 'TINYINT(1)' ),
            't' => SMWSQLHelpers::getStandardDBType( 'title' ),
            'l' => SMWSQLHelpers::getStandardDBType( 'blob' ),
            'f' => ( $wgDBtype == 'postgres' ? 'DOUBLE PRECISION' : 'DOUBLE' ),
            'i' => ( $wgDBtype == 'postgres' ? 'INTEGER' : 'INT(8)' ),
            'j' => ( $wgDBtype == 'postgres' || $wgDBtype == 'sqlite' ?
'INTEGER' : 'INT(8) UNSIGNED' ),
            'p' => SMWSQLHelpers::getStandardDBType( 'id' ),
            'n' => SMWSQLHelpers::getStandardDBType( 'namespace' ),
            'w' => SMWSQLHelpers::getStandardDBType( 'iw' )
        );

Now it seems that type 'i' should be  bigint, which is 8 bytes, 
Thus the  statement: 'usage_count' => $dbtypes['j']  in line 133 seems that
should be changed to 'usage_count' => $dbtypes['i']; after type 
'i' being set to be bigint for postgresql.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to