craftcms / craftcms/cms

Error when deleting parent entry in structure section when child depth > 1

Open
#4,474 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

Description

SQL error issued when trying to delete entries that have structure based children with a depth greater than 1. When selecting entries with a depth < 2 deleting works without issue. Individual entries can be deleted fine too.

The data in the structure was imported with Feed Me (version below).

Steps to reproduce

Select a parent entry to delete within a structure section with a child depth of at least 2.

i.e. this:

[*] parent
    -> child level 1
        -> child level 2

and not this:

[*] parent
    -> child level 1

The resulting AJAX request produces an error:

{"error":"SQLSTATE[22003]: Numeric value out of range: 1690 BIGINT UNSIGNED value is out of range in '(`[dbname]`.`structureelements`.`level` - 2)'\nThe SQL being executed was: UPDATE `structureelements` SET `level`=`level`-2, `dateUpdated`='2019-07-01 15:35:18' WHERE ((`lft` >= 4102) AND (`rgt` <= 4103)) AND (`root`=698)"}
Additional info
  • Craft version: 3.1.32.1
  • PHP version: 7.2.19
  • Database driver & version: MySQL 5.7.26
  • Plugins & versions:
    AsyncQueue 2.0.0
    CP Field Inspect 1.0.5
    Dumper 2.0.0
    Feed Me 4.1.0
    Imager v2.1.10
    Queue Manager 1.1.0
    Redactor 2.3.3.2
    Redirect plugin for Craft 3 1.0.23
    Tags 1.0.5
    Template Select 2.0.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the deletion from the issue using a structure with a parent and two child levels, then inspect the SQL generated by the AJAX request. Done means deleting the parent succeeds without the BIGINT UNSIGNED error while deletion of shallower structures continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.