Last modified: 2014-05-08 15:33:21 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T64127, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 62127 - GeoData Error Upon Adding Coordinates to a Page: 1054 Unknown column 'gt_lat_int' in 'field list'
GeoData Error Upon Adding Coordinates to a Page: 1054 Unknown column 'gt_lat_...
Status: RESOLVED WORKSFORME
Product: MediaWiki extensions
Classification: Unclassified
GeoData (Other open bugs)
REL1_22-branch
PC Windows 8
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-03-02 15:38 UTC by ogul oncel
Modified: 2014-05-08 15:33 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description ogul oncel 2014-03-02 15:38:49 UTC
Hi! I have to let you know that I am a non-specialist, knowing only Matlab programming. Please excuse me if my description is not very helpful. I can provide further information if needed.

I made the installation of the extension as directed. Checked it from Special:Version. When I wanted to add a coordinate to a page via {{#‎coordinates}} ( for example: {{#coordinates:primary|26|04|N|42|05|E}} ) I receive the following error: 

"
A database query error has occurred. This may indicate a bug in the software.
Query:
INSERT INTO `mw_geo_tags` (gt_page_id,gt_id,gt_lat,gt_lon,gt_globe,gt_primary,gt_dim,gt_type,gt_name,gt_country,gt_region,gt_lat_int,gt_lon_int) VALUES ('14',NULL,'26.0666666667','42.0833333333','1','1','1000',NULL,NULL,NULL,NULL,'261','421')
Function: GeoDataHooks::doSmartUpdate
Error: 1054 Unknown column 'gt_lat_int' in 'field list' (localhost)
"
another error:
"Notice: Uncommitted DB writes (transaction from DatabaseBase::query (GeoData::getAllCoordinates)). in /home/username/public_html/includes/db/Database.php on line 3944"

I searched the web but couldn't find a solution to this. Also played around with some parameters but nothing changed. Does anyone have any idea about this problem? Thanks a lot in advance!
Comment 1 Andre Klapper 2014-03-02 23:37:41 UTC
Thanks for taking the time to report this!

Which MediaWiki version, which GeoData version, and which database backend is this about?
Comment 2 Sam Reed (reedy) 2014-03-03 00:00:07 UTC
Quick glance at the code would suggest you're using the database schema that is used when you use it with solr, rather than using the mysql backend.

What is $wgGeoDataBackend set to?
Comment 3 ogul oncel 2014-03-03 01:22:46 UTC
Thank you for your attention Andre and Sam! My wiki is operated on Godaddy.com hosting.

MediaWiki:	1.22.3
PHP:	5.4.23 (cgi-fcgi)
MySQL:	5.5.32-cll-lve
GeoData: master(latest version) 

$wgGeoDataBackend parameter is not set in localsettings.php. On extension page it says default is "db" and not "solr" so I thought it should be okay?
Comment 4 ogul oncel 2014-03-03 01:34:36 UTC
Upon your message, I have deleted the extension, installed again with $wgGeoDataBackend parameter set to 'db' and updated the database again. The errors stay the same. But on the update report it also said "geo tag table already exists".
Comment 5 Max Semenik 2014-03-03 18:26:16 UTC
Ogul, you'll need to drop that table to let the installer to create it in a proper form. I just checked - GeoData works just fine after installation with default settings.
Comment 6 ogul oncel 2014-03-03 18:58:47 UTC
Max, do you mean erasing the table by dropping? Can you tell me how I should properly remove it, I'm not sure how to do it.

The thing I don't get is that; why it didn't work properly at first installation? There were no tables during first installation and everything I did was fresh and  default? Could this  be pointing to some other error?
Comment 7 ogul oncel 2014-03-03 19:07:54 UTC
Max, I was trying to learn the process you wrote. I am checking phpmyadmin>structure. There are 2 relevant tables:

mw_geo_killlist
mw_geo_tags	
mw_geo_updates

with "Browse,Structure,Search,Insert,Empty,Drop" options. Should I "drop" all these files and re-install the GeoData again?
Comment 8 ogul oncel 2014-03-03 19:39:07 UTC
Max, the problem is not solved. Here what I have done:

1. Removed require once from localsettings.php
2. Deleted the GeoData folder from extensions
3. Dropped the three tables from database via phpmyadmin

mw_geo_killlist
mw_geo_tags	
mw_geo_updates

4. Re-installed GeoData Extension
5. Added require once to localsettings.php
6. Updated the software via webupdater. Seen "geo tables created"
7. Logged in and added "{{#coordinates:primary|26|04|N|178|46|E}}" to a page
8. Received the same error:

"A database query error has occurred. This may indicate a bug in the software.
Query:
INSERT INTO `mw_geo_tags` (gt_page_id,gt_id,gt_lat,gt_lon,gt_globe,gt_primary,gt_dim,gt_type,gt_name,gt_country,gt_region,gt_lat_int,gt_lon_int) VALUES ('31',NULL,'26.0666666667','178.766666667','earth','1','1000',NULL,NULL,NULL,NULL,'261','1788')
Function: GeoDataHooks::doSmartUpdate
Error: 1054 Unknown column 'gt_lat_int' in 'field list' (localhost)"

"Notice: Uncommitted DB writes (transaction from DatabaseBase::query (WikiPage::pageData)). in /home/username/public_html/includes/db/Database.php on line 3944"

Any idea, what might be wrong?
Comment 9 ogul oncel 2014-03-03 19:50:26 UTC
Additional Information: I checked mw_table_geo_tags. There are only 11 parameters there:(gt_page_id,gt_id,gt_lat,gt_lon,gt_globe,gt_primary,gt_dim,gt_type,gt_name,gt_country,gt_region)

But the error message returns 13 parameters, adding (gt_lat_int,gt_lon_int) at the end which doesn't exist in database table. I think this is the source of trouble but I don't know how or why this is happening. I hope this helps.
Comment 10 ogul oncel 2014-03-03 20:15:36 UTC
Sorry for posting too much here, but I wanted to share what I found for one last time: I checked GeoData/sql/db-backed.sql file in localsettings.php. And there I found the two lost files (gt_lat_int,gt_lon_int) mentioned. So there is a contradiction between the actual database and localsettings.php file. Does this ring a bell?
Comment 11 ogul oncel 2014-03-04 01:17:05 UTC
Partial Solution(?): I have recognized that during creation of geo tags table, two rows are omitted all the time. I don't know if it's to do with software or my hosting settings. gt_lat_int,gt_lon_int do not show up in sql database. So I added them manually with my hand through phpmyadmin which eliminated the warning. Yet I am not sure if I configured it correctly. My configuration for both are as follows:

type=smallint(6)
null=no
default=none

An example:
{{#coordinates:primary|51|55|29|N|6|55|9|E|}} returns gt_lat_in=519 gt_lot_in=69. It says, data should be by default 1/10th of degree. but x10? MobileFrontEnd extension is also not working. I think it is to do with the error here.
Comment 12 ogul oncel 2014-03-04 16:31:54 UTC
Another manifestation of the problem:

"Search around the point with coordinates" api.php?action=query&list=geosearch&gsradius=10000&gscoord=50.923275|6.916073 does not work and returns the following error:

<?xml version="1.0"?>
<api>
  <error code="internal_api_error_DBQueryError" info="Exception Caught: A database error has occurred. Did you forget to run maintenance/update.php after upgrading?  See: https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script&#10;Query: SELECT  page_id,page_namespace,page_title,gt_lat,gt_lon,gt_primary,gt_globe  FROM `mw_page`,`mw_geo_tags` FORCE INDEX (gt_spatial)   WHERE page_namespace = &#039;0&#039; AND gt_globe = &#039;earth&#039; AND (gt_page_id = page_id) AND gt_primary = &#039;1&#039; AND gt_lat_int = &#039;51&#039; AND gt_lon_int = &#039;7&#039; AND (gt_lat>=&#039;50.8333429806&#039;) AND (gt_lat<=&#039;51.0132070194&#039;) AND (gt_lon>=&#039;6.77340540165&#039;) AND (gt_lon<=&#039;7.05874059835&#039;)  &#10;Function: ApiQueryGeoSearchDb::run&#10;Error: 1176 Key &#039;gt_spatial&#039; doesn&#039;t exist in table &#039;mw_geo_tags&#039; (localhost)&#10;" xml:space="preserve">

#0 /home/richardwakefield/public_html/includes/db/Database.php(1039): DatabaseBase->reportQueryError('Key 'gt_spatial...', 1176, 'SELECT  page_id...', 'ApiQueryGeoSear...', false)
#1 /home/richardwakefield/public_html/includes/db/Database.php(1496): DatabaseBase->query('SELECT  page_id...', 'ApiQueryGeoSear...')
#2 /home/richardwakefield/public_html/includes/api/ApiQueryBase.php(274): DatabaseBase->select(Array, Array, Array, 'ApiQueryGeoSear...', Array, Array)
#3 /home/richardwakefield/public_html/extensions/GeoData/api/ApiQueryGeoSearchDb.php(41): ApiQueryBase->select('ApiQueryGeoSear...')
#4 /home/richardwakefield/public_html/extensions/GeoData/api/ApiQueryGeoSearch.php(13): ApiQueryGeoSearchDb->run()
#5 /home/richardwakefield/public_html/includes/api/ApiQuery.php(275): ApiQueryGeoSearch->execute()
#6 /home/richardwakefield/public_html/includes/api/ApiMain.php(829): ApiQuery->execute()
#7 /home/richardwakefield/public_html/includes/api/ApiMain.php(380): ApiMain->executeAction()
#8 /home/richardwakefield/public_html/includes/api/ApiMain.php(351): ApiMain->executeActionWithErrorHandling()
#9 /home/richardwakefield/public_html/api.php(73): ApiMain->execute()
#10 {main}

</error>
</api>

But, "get a list of coordinates of an article" works well:

You are looking at the HTML representation of the XML format.
HTML is good for debugging, but is unsuitable for application use.
Specify the format parameter to change the output format.
To see the non HTML representation of the XML format, set format=xml.
See the complete documentation, or API help for more information.
<?xml version="1.0"?>
<api>
  <query>
    <normalized>
      <n from="Çevrimiçi_Bilgi_Kaynakları" to="Çevrimiçi Bilgi Kaynakları" />
    </normalized>
    <pages>
      <page pageid="31" ns="0" title="Çevrimiçi Bilgi Kaynakları">
        <coordinates>
          <co lat="50.9233" lon="6.91607" primary="" globe="earth" />
        </coordinates>
      </page>
    </pages>
  </query>
</api>
Comment 13 ogul oncel 2014-03-04 17:40:49 UTC
Hey Guys!

I have noticed that the database does not create gt_spatial INDEX. So I also added it manually. And now everything seems working fine, also MobileFrontEnd!

To sum up, the changes I made:

1. Added gt_lat_int to mw_geo_tags table.
2. Added gt_lon_int to mw_geo_tags table.
3. Added gt_spatial with 4 columns  ( gt_lat_int, gt_lon_int, gt_lon, gt_primary ) to mw_geo_tags Indexes.

I still don't know if this is a bug or a problem with my personal settings/hosting. I can provide more information if you have any questions.
Comment 14 massimiliano.pisani 2014-04-07 23:27:55 UTC
Hi!
I have the same issue, I sent you an email to ask some information
Comment 15 massimiliano.pisani 2014-05-08 15:33:21 UTC
(In reply to ogul oncel from comment #13)
> Hey Guys!
> 
> I have noticed that the database does not create gt_spatial INDEX. So I also
> added it manually. And now everything seems working fine, also
> MobileFrontEnd!
> 
> To sum up, the changes I made:
> 
> 1. Added gt_lat_int to mw_geo_tags table.
> 2. Added gt_lon_int to mw_geo_tags table.
> 3. Added gt_spatial with 4 columns  ( gt_lat_int, gt_lon_int, gt_lon,
> gt_primary ) to mw_geo_tags Indexes.
> 
> I still don't know if this is a bug or a problem with my personal
> settings/hosting. I can provide more information if you have any questions.

Hi!
I tried to make the changes you suggested, but I have not figured out exactly how to create tables... 
I sent you two pictures through e-mail so you can see them and tell me where I'm wrong.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links