Page MenuHomePhabricator

Comments extension does not support SQLite as database backend // Error: 1 no such function: UNIX_TIMESTAMP
Closed, ResolvedPublic

Description

A database query error has occurred. This may indicate a bug in the software.

Query:
SELECT Comment_Username,Comment_IP,Comment_Text,Comment_Date,UNIX_TIMESTAMP(Comment_Date) AS timestamp,Comment_user_id,CommentID,IFNULL(Comment_Plus_Count - Comment_Minus_Count,0) AS Comment_Score,Comment_Plus_Count AS CommentVotePlus,Comment_Minus_Count AS CommentVoteMinus,Comment_Parent_ID,CommentID FROM Comments WHERE Comment_Page_ID = '12' LIMIT 100
Function: Comment::getCommentList
Error: 1 no such function: UNIX_TIMESTAMP

Backtrace:

#0 /srv/www/htdocs/includes/db/Database.php(1123): DatabaseBase->reportQueryError('no such functio...', 1, 'SELECT Comment...', 'Comment::getCom...', false)
#1 /srv/www/htdocs/includes/db/Database.php(1590): DatabaseBase->query('SELECT Comment...', 'Comment::getCom...')
#2 /srv/www/htdocs/extensions/Comments/CommentClass.php(738): DatabaseBase->select(Array, Array, Array, 'Comment::getCom...', Array, Array)
#3 /srv/www/htdocs/extensions/Comments/CommentClass.php(1030): Comment->getCommentList(0)
#4 /srv/www/htdocs/extensions/Comments/CommentsHooks.php(89): Comment->display()
#5 [internal function]: CommentsHooks::displayComments(NULL, Array, Object(Parser), Object(PPFrame_DOM))
#6 /srv/www/htdocs/includes/parser/Parser.php(4012): call_user_func_array(Array, Array)
#7 /srv/www/htdocs/includes/parser/Preprocessor_DOM.php(1180): Parser->extensionSubstitution(Array, Object(PPFrame_DOM))
#8 /srv/www/htdocs/includes/parser/Parser.php(3147): PPFrame_DOM->expand(Object(PPNode_DOM), 0)
#9 /srv/www/htdocs/includes/parser/Parser.php(1212): Parser->replaceVariables('Test 3?3?<comme...')
#10 /srv/www/htdocs/includes/parser/Parser.php(395): Parser->internalParse('Test 3?3?<comme...')
#11 /srv/www/htdocs/includes/content/WikitextContent.php(319): Parser->parse('Test 3?3?<comme...', Object(Title), Object(ParserOptions), true, true, NULL)
#12 /srv/www/htdocs/includes/WikiPage.php(2072): WikitextContent->getParserOutput(Object(Title), NULL, Object(ParserOptions))
#13 /srv/www/htdocs/includes/WikiPage.php(1755): WikiPage->prepareContentForEdit(Object(WikitextContent), NULL, Object(User), 'text/x-wiki')
#14 [internal function]: WikiPage->doEditContent(Object(WikitextContent), '', 98, false, NULL, 'text/x-wiki')
#15 /srv/www/htdocs/includes/Article.php(1966): call_user_func_array(Array, Array)
#16 /srv/www/htdocs/includes/EditPage.php(1811): Article->__call('doEditContent', Array)
#17 /srv/www/htdocs/includes/EditPage.php(1811): Article->doEditContent(Object(WikitextContent), '', 98, false, NULL, 'text/x-wiki')
#18 /srv/www/htdocs/includes/EditPage.php(1236): EditPage->internalAttemptSave(Array, false)
#19 /srv/www/htdocs/includes/EditPage.php(428): EditPage->attemptSave()
#20 /srv/www/htdocs/includes/actions/EditAction.php(50): EditPage->edit()
#21 /srv/www/htdocs/includes/actions/EditAction.php(74): EditAction->show()
#22 /srv/www/htdocs/includes/Wiki.php(428): SubmitAction->show()
#23 /srv/www/htdocs/includes/Wiki.php(292): MediaWiki->performAction(Object(Article), Object(Title))
#24 /srv/www/htdocs/includes/Wiki.php(586): MediaWiki->performRequest()
#25 /srv/www/htdocs/includes/Wiki.php(447): MediaWiki->main()
#26 /srv/www/htdocs/index.php(49): MediaWiki->run()
#27 /srv/www/htdocs/index.php5(24): require('/srv/www/htdocs...')
#28 {main}

Notice: Uncommitted DB writes (transaction from DatabaseBase::query (DatabaseBase::query)). in /srv/www/htdocs/includes/db/Database.php on line 4118


Version: unspecified
Severity: normal

Details

Reference
bz62708

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:54 AM
bzimport added a project: Comments.
bzimport set Reference to bz62708.
Rillke created this task.Mar 16 2014, 1:22 PM

Change 118988 had a related patch set uploaded by Rillke:
SQLite compatibility by adding UNIX_TMESTAMP shim

https://gerrit.wikimedia.org/r/118988

(In reply to Aaron Schulz from comment #1)
Until it is, everyone will tinker custom solutions.

Sorry but it is simply regrettable, that you cannot accept my patch; if I want to review code for this extension and test it locally, I will always have to patch it first just because ...

If you don't want collaborative coding, then host your stuff privately.

Well, maybe you come up with the proposal you describe more quickly than I think.

Change 118988 abandoned by Rillke:
SQLite compatibility by adding UNIX_TMESTAMP shim

Reason:
Not in line with extension maintainer's point of view.

https://gerrit.wikimedia.org/r/118988

I hope that perfect hasn't become the enemy of good here. :-/

Should this bug really be blocking block 20257? Isn't that bug for tracking SQLite support in core mediawiki?

If I'm reading Jack Phoenix's comment on gerrit right, there is indeed a limitation in core MW regarding timestamps, whose fixing would entail "convert[ing] the SQL schemas to use binary(14) instead of datetime to store the timestamp, as the standard MediaWiki convention is." But that ought to be a separate bug (which would then rightfully block 20257).

But I might be reading this incorrectly. Andre, can you clarify?

About blocking bug 20257; I don't care about core vs extensions too much - in the end I want to be able to find SQLite issues. :)

lcawte triaged this task as Low priority.Mar 9 2015, 9:50 PM
SamanthaNguyen moved this task from Backlog to Comments on the Social-Tools board.May 8 2016, 3:04 PM
SamanthaNguyen moved this task from Backlog to Bugs on the Comments board.May 8 2016, 4:17 PM

Change 332685 had a related patch set uploaded (by Krinkle; owner: Jack Phoenix):
[mediawiki/extensions/Comments@master] Use the PHP wfTimestamp() function instead of the DBMS-specific UNIX_TIMESTAMP function for converting timestamps

https://gerrit.wikimedia.org/r/332685

Change 332685 merged by jenkins-bot:
[mediawiki/extensions/Comments@master] Use the PHP wfTimestamp() function instead of the DBMS-specific UNIX_TIMESTAMP function for converting timestamps

https://gerrit.wikimedia.org/r/332685

Dereckson moved this task from Backlog to Schema needed on the SQLite board.May 20 2017, 10:18 AM
ashley closed this task as Resolved.Thu, Aug 8, 10:14 PM

Change 332685 merged by jenkins-bot:
[mediawiki/extensions/Comments@master] Use the PHP wfTimestamp() function instead of the DBMS-specific UNIX_TIMESTAMP function for converting timestamps
https://gerrit.wikimedia.org/r/332685

Given that this patchset got merged quite a while ago, I'm going to close this task.