[
https://issues.apache.org/jira/browse/VCL-898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15366621#comment-15366621
]
Andy Kurth commented on VCL-898:
--------------------------------
We need to make sure that everything that inserts into the request table does
not set request.logid to 0. It should be set to NULL. The schema currently
has NULL for the default value of the column so it doesn't need to be specified
in an insert statement if not relevant.
We also need to check the constraints in vcl.sql and update-vcl.sql. I think
we can leave the request.logid --> log.id constraint as long as we first check
for any existing requests with request.logid = 0. These need to be set to NULL
first, and then the constraint can be altered if necessary.
> Update schema to allow NULL request.logid
> -----------------------------------------
>
> Key: VCL-898
> URL: https://issues.apache.org/jira/browse/VCL-898
> Project: VCL
> Issue Type: Sub-task
> Components: database, project website (Apache CMS), vcld (backend)
> Reporter: Andy Kurth
> Assignee: Andy Kurth
> Fix For: 2.5
>
>
> A constraint was (_correctly_) added to _request.logid_ which causes
> *utils.pm::insert_request* to fail. *insert_request* is called from:
> * *image.pm::setup_capture_base_image*
> * *utils.pm::insert_reload_request*
> *insert_request* does not currently attempt to insert an entry to the log
> table before inserting into the request table but it does accept a _log.id_
> argument. However, _log.id_ is specified as 0 in both locations where it is
> called. Since there is no entry in the log table with id=0, the following
> error is generated when attempting to insert into the request table:
> {panel}
> Cannot add or update a child row: a foreign key constraint fails
> (`vcl`.`request`, CONSTRAINT `request_ibfk_18` FOREIGN KEY (`logid`)
> REFERENCES `log` (`id`) ON UPDATE CASCADE)
> {panel}
> *insert_request* either needs to be updated to first add a row to the log
> table or the request table needs to be modified to allow NULL logid values.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)