The website encountered an unexpected error. Please try again later. Drupal\Core\Entity\EntityStorageException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL

Created on 11 January 2024, 6 months ago
Updated 13 May 2024, about 2 months ago

After commerce Paypal payment having website encounter issue

The website encountered an unexpected error. Please try again later.

Drupal\Core\Entity\EntityStorageException: 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 '"generated" AS "generated" FROM commerce_number_pattern_sequence cnps WHERE (ent' at line 1: SELECT cnps.store_id AS store_id, cnps.number AS number, cnps."generated" AS "generated" FROM {commerce_number_pattern_sequence} cnps WHERE (entity_id = :db_condition_placeholder_0) AND (store_id = :db_condition_placeholder_1) FOR UPDATE; Array ( [:db_condition_placeholder_0] => order_default [:db_condition_placeholder_1] => 1 ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 846 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php). 
🐛 Bug report
Status

Closed: cannot reproduce

Version

2.28

Component

Payment

Created by

🇮🇳India Madhu Kumar M E

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

Comments & Activities

  • Issue created by @Madhu Kumar M E
  • 🇮🇱Israel jsacksick

    I never experienced this... Are you on MYSQL? Which version? Any extra information would be helpful.

  • Status changed to Closed: cannot reproduce 5 months ago
  • 🇮🇳India Madhu Kumar M E

    Hi @jsacksick ,
    Please find attached screenshot where we can see mysql version and other details.

  • Status changed to Needs work 5 months ago
  • Status changed to Active 5 months ago
  • 🇮🇱Israel jsacksick

    "Needs work" is for issues with patches... There's no patch here..
    Do you need sequential order numbers? Otherwise just disable this feature from the order type settings.

  • 🇮🇳India Madhu Kumar M E

    Hi @jsacksick,

    The root cause of this issue has been identified. The commerce module utilizes the 'commerce_number_pattern_sequence' table to manage this process.

    Within this table, there is a field named 'generated' where we update the timestamp.

    During the payment process completion, our code selects the last record from this table and attempts to update the value. However, the query fails due to the 'generated' field.

  • Status changed to Closed: cannot reproduce about 2 months ago
  • 🇮🇱Israel jsacksick

    During the payment process completion, our code selects the last record from this table and attempts to update the value. However, the query fails due to the 'generated' field.

    So is this due to your custom code? Can we close this?

Production build 0.69.0 2024