Views preview query contains double quotes and curly brackets

Created on 4 August 2020, over 4 years ago
Updated 5 October 2023, about 1 year ago

Problem/Motivation

In D9 (not D8) the Query preview now shows double quotes around a lot of tables, aliases and fields. This makes it really hard to read (and to copy/paste into a query browser)

D8

D9

First instinct is to point at πŸ› Database reserved keywords need to be quoted as per the ANSI standard Fixed

Steps to reproduce

Enable showing Query in the preview
Go to a View.
Click preview.

Proposed resolution

Go back to the way it was in D8

Remaining tasks

User interface changes

API changes

Release notes snippet

πŸ› Bug report
Status

Needs work

Version

9.1

Component
Views UIΒ  β†’

Last updated 21 days ago

Created by

πŸ‡³πŸ‡±Netherlands Lendude Amsterdam

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

  • Needs subsystem maintainer review

    It is used to alert the maintainer(s) of a particular core subsystem that an issue significantly impacts their subsystem, and their signoff is needed (see the governance policy draft for more information). Also, if you use this tag, make sure the issue component is set to the correct subsystem. If an issue significantly impacts more than one subsystem, use needs framework manager review instead.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    I'd like to reopen this for reconsideration - assuming that the preview query is intended to be used for debugging purposes outside Drupal, eg. in an SQL client.

    Drupal runs some init_commands at the start of the request, including SET sql_mode = 'ANSI,TRADITIONAL', which makes MySQL interpret a double quote as an identifier quote. When running queries in an SQL client, these init_commands don't run and the query fails. I think it makes more sense to use the default identifier quotes which are backticks. Additionally, the curly brackets around table names should be stripped. As far as I know that's a Drupalism and no query with those will run outside Drupal.

  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels
  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels
Production build 0.71.5 2024