Mantis Bugtracker          
testlink.org

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0008409TestLinkDatabase Generalpublic2018-10-11 07:162018-10-22 11:28
Reporterandreea.biosan 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusnewResolutionopen 
PlatformOSOS Version
Product Version 
Fixed in Version 
Summary0008409: Database error is received when adding relation between test cases
Description
Database error it's received when trying to establish a relation in the "Relations" section between two Test Cases.

 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.
Steps To ReproduceGo to:
Test Case -> Relations Section

In the "Prefix Add" add the ID of a Test Case and press button "ADD".
The attached error appears:
TagsNo tags attached.
Database (MySQL,Postgres,etc)MySQL
Browser
PHP Version
TestCaseID
QA Team - Task Workflow Status
Attached Filesdocx file icon DB Access Error -relations.docx [^] (35,967 bytes) 2018-10-11 07:16
docx file icon DB Access Error -22.10.docx [^] (45,290 bytes) 2018-10-22 11:28

- Relationships

-  Notes
(0027988)
fman (administrator)
2018-10-11 09:49

ok, going to check
(0027989)
fman (administrator)
2018-10-11 09:51

are you able to run this sql on a mysql client, and provide me the message you get?
INSERT INTO testcase_relations (source_id, destination_id, relation_type, author_id, creation_ts) values (79907,78870, 3, 11, '2018-10-11 00:03:24')

thanks
(0027995)
hughkay (reporter)
2018-10-12 10:52
edited on: 2018-10-12 10:53

@fman
When I try to execute your query on the mysql client with the latest code, I get following error:
 1364 - Field 'tcase_source_id' doesn't have a default value

Seems that the there's no default value defined for this field.
Maybe you should define a default value inside the following file:
"install/sql/alter_tables/1.9.18/mysql/DB.1.9.18/step1/db_schema_update.sql"

Furthermore, I wonder why the fields "tcase_source_id" and "tcase_destination_id" are not defined in file "install/sql/mysql/testlink_create_tables.sql" for table "testcase_relations"?

This means, if you upgrade from 1.9.17 to 1.9.18 those two columns are added to "testcase_relations" DB table, but if you do a fresh install of 1.9.18 those two columns do not exist...weird!

The question is now: are those two columns really necessary or were they added by mistake in the update script?

(0027996)
hughkay (reporter)
2018-10-12 10:58

One additional thought:
The two added columns also do only exist for mySQL database version. They're not added for PostGres.
Furthermore, for MSSQL the file "install/sql/alter_tables/1.9.18/mssql/DB.1.9.18/step1/db_schema_update.sql" does not exist at all.
(0027997)
fman (administrator)
2018-10-12 18:04

some mistake, because IMHO I've added these colums into a BACKUP TABLE to manage migration
going to check.
Thanks a lot for your help.
(0027999)
fman (administrator)
2018-10-13 08:05

@andreea.biosan
1. Fresh install with gitlab.com branch releas04CR
2. create test project
3. create test suite TS-100
4. create 4 test cases: with titles: TC-1A,TC-1B,TC-1C,TC-1D
5. create relation between TC-1B e TC-1A with default settings
6. no errors
(0028012)
fman (administrator)
2018-10-13 18:09

@hughkay
Going to fix 1.9.18, meanwhile
get 1.9.17 and use it's migration sql from 1.9.16 to 1.9.17
the get 1.9.18 and use migration sql from 1.9.17 to 1.9.18
all will work.

next time please does not use a ticket that does not have same context that your problem
(0028026)
e.p. (developer)
2018-10-17 08:55

From Dominika:
I had installed release04CR on October 3rd. I didn't detect any changes since then, correct?
(0028036)
d.daellenbach (developer)
2018-10-18 15:10

changed the following timestamp columns to use CURRENT_TIMESTAMP (were still on '0000-00-00 00:00:00'):

db_version.upgrade_ts
inventory.modification_ts
req_specs_revisions.modification_ts
(milestones.start_date has also a default '0000-00-00', of which I'm not sure, if it will be accepted by MySQL - did not yet change)

These are all I found
(0028037)
d.daellenbach (developer)
2018-10-18 15:11

Further I found the following line in the log file (tcase_source_id and tcase_dstination_id cannot be null!):

    [18/Oct/18 11:13:56][ERROR][9nhkvnp1gr0uetta5lh1ldglk4][DATABASE]
        ERROR ON exec_query() - database.class.php
1364 - Field 'tcase_source_id' doesn't have a default value - /* Class:testcase - Method: addRelation */ INSERT INTO testcase_relations (source_id, destination_id, relation_type, author_id, creation_ts) values (139488,126551, 3, 11, '2018-10-18 04:13:56')
THE MESSAGE : /* Class:testcase - Method: addRelation */ INSERT INTO testcase_relations (source_id, destination_id, relation_type, author_id, creation_ts) values (139488,126551, 3, 11, '2018-10-18 04:13:56')
Query failed: errorcode[1364]
    errormsg:Field 'tcase_source_id' doesn't have a default value
(0028040)
fman (administrator)
2018-10-19 05:42

Hi
my fault with definition of two support columns

quick & dirty solution
AFTER MIGRATION
drop following columns from testcase_relations table
tcase_source_id
and tcase_destination_id
(0028056)
andreea.biosan (reporter)
2018-10-22 11:27

This issue it's still recreating

- Issue History
Date Modified Username Field Change
2018-10-11 07:16 andreea.biosan New Issue
2018-10-11 07:16 andreea.biosan File Added: DB Access Error -relations.docx
2018-10-11 09:49 fman Note Added: 0027988
2018-10-11 09:51 fman Note Added: 0027989
2018-10-12 10:52 hughkay Note Added: 0027995
2018-10-12 10:53 hughkay Note Edited: 0027995 View Revisions
2018-10-12 10:58 hughkay Note Added: 0027996
2018-10-12 18:04 fman Note Added: 0027997
2018-10-13 08:05 fman Note Added: 0027999
2018-10-13 18:09 fman Note Added: 0028012
2018-10-17 08:55 e.p. Note Added: 0028026
2018-10-18 15:10 d.daellenbach Note Added: 0028036
2018-10-18 15:11 d.daellenbach Note Added: 0028037
2018-10-19 05:42 fman Note Added: 0028040
2018-10-22 11:27 andreea.biosan Note Added: 0028056
2018-10-22 11:28 andreea.biosan File Added: DB Access Error -22.10.docx



Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker