MantisBT - TestLink
View Issue Details
0008876TestLinkDatabase MySQLpublic2020-02-28 16:462020-03-08 11:26
jnam 
fman 
normalmajoralways
resolvedno change required 
Ubuntu
1.9.20 
 
MySQL 5.7
Chrome
7.3
TBD
0008876: INSTALL - DB Access Error - table: baseline_l1l2_context
After I follow the Steps To Reproduce, I got this message
[UI]
TestLink setup will now attempt to setup the database:

Creating connection to Database Server:OK!

Connecting to database `testlink`:OK!
Creating Testlink DB user `admin`:OK! (ok - user_exists ok - grant assignment)
Dropping all TL existent tables:
Droping
... (tables names omitted)
Done!
Processing:sql/mysql/testlink_create_tables.sql

 ==============================================================================
 DB Access Error - debug_print_backtrace() OUTPUT START
 ATTENTION: Enabling more debug info will produce path disclosure weakness (CWE-200)
            Having this additional Information could be useful for reporting
            issue to development TEAM.
 ==============================================================================
#0 database->exec_query() called at [/var/www/html/testlink/install/sqlParser.class.php:98]
#1 SqlParser->process() called at [/var/www/html/testlink/install/installNewDB.php:469]

[userlog0.log]
Creating default object from empty value - in /var/www/html/testlink/install/installUtils.php - Line 555
    [20/Feb/27 23:52:50][ERROR][<nosession>][DATABASE]
        ERROR ON exec_query() - database.class.php
1067 - Invalid default value for 'end_exec_ts' - CREATE TABLE /*prefix*/baseline_l1l2_context (
  id int(10) unsigned NOT NULL AUTO_INCREMENT,
  testplan_id int(10) unsigned NOT NULL DEFAULT '0',
  platform_id int(10) unsigned NOT NULL DEFAULT '0',
  being_exec_ts timestamp NOT NULL,
  end_exec_ts timestamp NOT NULL, /*NOT NULL DEFAULT '2100-01-01 00:00:01',*/
  creation_ts timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (id),
  UNIQUE KEY udx1 (testplan_id,platform_id,creation_ts)
) DEFAULT CHARSET=utf8
THE MESSAGE : CREATE TABLE /*prefix*/baseline_l1l2_context (
  id int(10) unsigned NOT NULL AUTO_INCREMENT,
  testplan_id int(10) unsigned NOT NULL DEFAULT '0',
  platform_id int(10) unsigned NOT NULL DEFAULT '0',
  being_exec_ts timestamp NOT NULL,
  end_exec_ts timestamp NOT NULL, /*NOT NULL DEFAULT '2100-01-01 00:00:01',*/
  creation_ts timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (id),
  UNIQUE KEY udx1 (testplan_id,platform_id,creation_ts)
) DEFAULT CHARSET=utf8
Query failed: errorcode[1067]
    errormsg:Invalid default value for 'end_exec_ts'
1. <<IP Address>>/testlink/install/index.php (I am running this in remote server)
2. 'Definition of DB Access' -> Enter data into fields
3. Click 'Process Tesklink Set-up!' button
* install/sql/mysql/testlink_create_tables.sql :
CREATE TABLE /*prefix*/baseline_l1l2_context (
  id int(10) unsigned NOT NULL AUTO_INCREMENT,
  testplan_id int(10) unsigned NOT NULL DEFAULT '0',
  platform_id int(10) unsigned NOT NULL DEFAULT '0',
  begin_exec_ts timestamp NOT NULL,
  end_exec_ts timestamp NOT NULL,
  creation_ts timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (id),
  UNIQUE KEY udx1 (testplan_id,platform_id,creation_ts)
) DEFAULT CHARSET=utf8;

==> I changed "end_exec_ts timestamp NOT NULL," to "end_exec_ts timestamp NOT NULL DEFAULT '2038-01-01 00:00:01'," and the issue was fixed.
==> My primary guess here is, default value for end_exec_ts field is either zero-date or invalid format since MySql 5.7~ does not allow zero-date for timestamp field.
==> I found github commits that might be related to this issue: https://github.com/TestLinkOpenSourceTRMS/testlink-code/pull/253/commits/9f25ed4429f14dc4f5d22caa261abeb9711d68e3 [^]
mysql compatibility, mysql configuration
Issue History
2020-02-28 16:46jnamNew Issue
2020-02-28 17:15fmanNote Added: 0029513
2020-02-28 17:40jnamNote Added: 0029515
2020-02-28 18:08fmanNote Added: 0029516
2020-02-28 18:27jnamNote Added: 0029517
2020-03-08 11:25fmanQA Team - Task Workflow Status => TBD
2020-03-08 11:25fmanSummaryDB Access Error - debug_print_backtrace() OUTPUT START => INSTALL - DB Access Error - table: baseline_l1l2_context
2020-03-08 11:25fmanTag Attached: mysql compatibility
2020-03-08 11:25fmanTag Attached: mysql configuration
2020-03-08 11:26fmanStatusnew => resolved
2020-03-08 11:26fmanResolutionopen => no change required
2020-03-08 11:26fmanAssigned To => fman

Notes
(0029513)
fman   
2020-02-28 17:15   
The issue depends on your MySQL configuration, then IMHO can not be considered an issue
(0029515)
jnam   
2020-02-28 17:40   
Thank you for the note :)
Do you think the change I made on 'end_exec_ts' field would impact the functionality of application in serious manner? Rather than taking any risks by changing MySQL configuration, I would like to stick to this code until new version is released.
(0029516)
fman   
2020-02-28 18:08   
These tables are used to save baselines, do not think the feature will suffer for your changes.
(0029517)
jnam   
2020-02-28 18:27   
Thanks a lot again fman.