SQLSTATE[42000] on adding new field in Content Types

Created on 4 September 2023, 10 months ago
Updated 5 September 2023, 10 months ago

Problem/Motivation

I found this error message when i was trying to add new field in a certain Content Types:

There was a problem creating field GST Flag: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{field_data_field_gst_flag} ( `entity_type` VARCHAR(128) NOT NULL DEFAULT '' COM' at line 1

Steps to reproduce

- Go to Structure / Content Types, click on any Content Types
- Go to Manage fields tab
- Try to add new field

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ› Bug report
Status

Postponed: needs info

Version

7.0 โšฐ๏ธ

Component
Fieldย  โ†’

Last updated about 12 hours ago

Created by

๐Ÿ‡ธ๐Ÿ‡ฌSingapore snarf5

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @snarf5
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States DamienMcKenna NH, USA

    I'm sorry you're running into that error. However, it seems like the problem is with Drupal core, or maybe another contributed module or custom code somewhere, not with Views. I'm moving the issue to the Drupal core issue queue, maybe someone there will be able to help you get to the bottom of the problem.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia AditiVB

    Aditi Saraf โ†’ made their first commit to this issueโ€™s fork.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia AditiVB

    i am working on it .

  • Assigned to AditiVB
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia AditiVB
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia AditiVB
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States cilefen
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia AditiVB

    i am not getting this issue . Attaching screenshot here . I am able to add field without any error .

  • Issue was unassigned.
  • Status changed to Needs review 10 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia AditiVB
  • Status changed to Postponed: needs info 10 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States cilefen
  • ๐Ÿ‡ธ๐Ÿ‡ฐSlovakia poker10

    @snarf5 Can you please provide more information about the field you tried to add - what was the field type? Was the field type created by any contributed module you have installed on your site? Thanks!

  • ๐Ÿ‡ธ๐Ÿ‡ฌSingapore snarf5

    Hi everyone,

    i am getting the error message as per attached file.

    so the field name is gst_flag. As for the field type, it is the standard one, i tried with 'integer' and 'text' and yet both are giving the same error message.

    i am guessing that there might be an issue in another module/code like what @damianmckenna mentioned. But i just couldn't see any error in the error report page nor the php log file itself. Is there any way that i can debug this somehow?

  • ๐Ÿ‡ธ๐Ÿ‡ฌSingapore snarf5

    Hi everyone,

    i have figured out the root cause of this issue.

    i had to debug the SQL and tested it. Apparently the hosting vendor updated mysql version (and some other stuff), so the issue was because the code in database' schema file is still using bracket {} for all of the table names in the sql statement. After i updated it all into ``, the issue is gone.

Production build 0.69.0 2024