Problem/Motivation
Static queries should have the field names bracket-encapsulated. In that way static queries cannot fail on a database, because a field name is a reserved keyword for the given database. For more info: https://www.drupal.org/node/2986894.
Proposed resolution
Bracket-encapsulated field names for all static queries located in the directory "core/lib/Drupal/Core" and its sub-directories, but not in the directory "core/lib/Drupal/Core/Database". Static queries can be found by doing a search for "->query(" and "->queryRange(" in the directory "core/lib/Drupal/Core" and its sub-directories, but not in the directory "core/lib/Drupal/Core/Database".
What needs to be changed:
From:
$connection->query('SELECT nid FROM {node} WHERE nid = :id', [':id' => 1']);
To:
$connection->query('SELECT [nid] FROM {node} WHERE [nid] = :id', [':id' => 1']);
Remaining tasks
TBD
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
TBD

Comments
Comment #2
rik-dev commentedComment #3
rik-dev commentedComment #4
rik-dev commentedComment #5
matroskeen@rik-dev, please take a look into task description:
It seems that only a small part of your patch covers the actual scope of this task (see the screenshot).
Comment #6
daffie commentedThe field "item_id" also needs square brackets.
Also is @Matroskeen right about his comment #5.
Comment #7
daffie commentedThe parent issue is a "bug report", therefore this issue is one too.
Comment #8
Lal_Comment #9
Lal_Comment #10
daffie commentedThe patch is now a lot better.
This change is not correct. It should be
COUNT([item_id]).Still open are: #6.2, #6.5, #6.8, #6.9, #6.10.
Comment #11
Lal_@daffie made the changes
Comment #13
daffie commented@Lal_: Thanks for working on the patch. It look good, only we have missed a query in "core/lib/Drupal/Core/Session/SessionHandler.php".
Comment #14
Lal_I hope this is it @daffie
Comment #16
daffie commentedAll fields are now encapsulated by square brackets.
All code changes look good.
The testbot is happy for all 3 by core supported databases.
For me it is RTBC.
Thank you for working on this issue: @Lal_, @rik-dev and @Matroskeen.
Comment #17
rik-dev commentedComment #19
catchCommitted 638f25e and pushed to 9.1.x. Thanks!