craftcms / craftcms/query

Error reporting on element deletion

Open
#9 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
16
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Description

After running a DELETE query an error of the following kind is reported:

SQLSTATE[HY000]: General error

…but it seems the delete runs fine.

Steps to reproduce

I am Executing the following pattern:

DELETE FROM craft_elements
WHERE `type` = 'craft\\elements\\User'
AND `id` NOT IN (n,m … z)

…where n through z is a comma separated list of user IDs to retain.

Additional info
  • Craft version: 3.6.4.1
  • PHP version: 7.3.1
  • Database driver & version: MySQL 5.7.25

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

No files, tests, or entry points are identified. Start by reproducing the DELETE query against MySQL 5.7.25 with the reported Craft and PHP versions, then trace where the query's error is reported. Done means a successful deletion no longer produces the misleading SQLSTATE[HY000] error.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.