Search code examples
mysqlcronmariadb

Syntax error or access violation: 1630 FUNCTION dbparty.DATE_FORMAT does not exist


i have on my site 7 cron jobs that automatically do commands (y'all know cron purpose but..:)* but they all throw out the same Error..

this is the cron jobs:

*/4 * * * *  /usr/bin/php7.3 /var/www/Symfony/bin/console --env=prod cocorico:bookings:alertImminent >> /var/www/Alerts/log.log 2>&1
*/5 * * * *  /usr/bin/php7.3 /var/www/Symfony/bin/console --env=prod cocorico:bookings:expire >> /var/www/Alerts/log.log 2>&1
*/5 * * * *  /usr/bin/php7.3 /var/www/Symfony/bin/console --env=prod cocorico:bookings:validate >> /var/www/Alerts/log.log 2>&1
*/5 * * * *  /usr/bin/php7.3 /var/www/Symfony/bin/console --env=prod cocorico:bookings:alertExpiring >> /var/www/Alerts/log.log 2>&1
10 */1 * * * /usr/bin/php7.3 /var/www/Symfony/bin/console --env=prod cocorico:bookings:checkBankWires >> /var/www/Alerts/log.log 2>&1
30 17 * * *  /usr/bin/php7.3 /var/www/Symfony/bin/console --env=prod cocorico:currency:update >> /var/www/Alerts/log.log 2>&1
30 2 * * *   /usr/bin/php7.3 /var/www/Symfony/bin/console --env=prod cocorico_listing_search:computeNotation >> /var/www/Alerts/log.log 2>&1
0 0 27 * *   /usr/bin/php7.3 /var/www/Symfony/bin/console --env=prod cocorico:listings:alertUpdateCalendars >> /var/www/Alerts/log.log 2>&1

Here what's i get in the log..:

13:50:02 ERROR     [console] Error thrown while running command "--env=prod cocorico:bookings:alertExpiring". Message: "An exception occurred while executing '

    SELECT  b0_.id AS id_0, b0_.start AS start_1, b0_.end AS end_2,
            b0_.start_time AS start_time_3, b0_.end_time AS end_time_4,
            b0_.status AS status_5, b0_.validated AS validated_6,
            b0_.amount AS amount_7, b0_.amount_fee_as_asker AS amount_fee_as_asker_8,
            b0_.amount_fee_as_offerer AS amount_fee_as_offerer_9,
            b0_.amount_total AS amount_total_10, b0_.cancellation_policy AS cancellation_policy_11,
            b0_.new_booking_at AS new_booking_at_12, b0_.payed_booking_at AS payed_booking_at_13,
            b0_.refused_booking_at AS refused_booking_at_14, b0_.canceled_asker_booking_at AS canceled_asker_booking_at_15,
            b0_.alerted_expiring AS alerted_expiring_16, b0_.alerted_imminent AS alerted_imminent_17,
            b0_.invoice_number AS invoice_number_18, b0_.refund_invoice_number AS refund_invoice_number_19,
            b0_.message AS message_20, b0_.time_zone_asker AS time_zone_asker_21,
            b0_.time_zone_offerer AS time_zone_offerer_22, b0_.mangopay_card_id AS mangopay_card_id_23,
            b0_.mangopay_card_pre_auth_id AS mangopay_card_pre_auth_id_24,
            b0_.mangopay_payin_pre_auth_id AS mangopay_payin_pre_auth_id_25,
            b0_.url_draft AS url_draft_26, b0_.amount_options AS amount_options_27,
            b0_.created_at AS created_at_28, b0_.updated_at AS updated_at_29,
            u1_.username AS username_30, u1_.username_canonical AS username_canonical_31,
            u1_.email AS email_32, u1_.email_canonical AS email_canonical_33,
            u1_.enabled AS enabled_34, u1_.salt AS salt_35, u1_.password AS password_36,
            u1_.last_login AS last_login_37, u1_.confirmation_token AS confirmation_token_38,
            u1_.password_requested_at AS password_requested_at_39,
            u1_.roles AS roles_40, u1_.id AS id_41, u1_.person_type AS person_type_42,
            u1_.user_type AS user_type_43, u1_.company_name AS company_name_44,
            u1_.last_name AS last_name_45, u1_.first_name AS first_name_46,
            u1_.phone_prefix AS phone_prefix_47, u1_.phone AS phone_48,
            u1_.birthday AS birthday_49, u1_.nationality AS nationality_50,
            u1_.country_of_residence AS country_of_residence_51, u1_.profession AS profession_52,
            u1_.iban AS iban_53, u1_.bic AS bic_54, u1_.bank_owner_name AS bank_owner_name_55,
            u1_.bank_owner_address AS bank_owner_address_56, u1_.annual_income AS annual_income_57,
            u1_.phone_verified AS phone_verified_58, u1_.email_verified AS email_verified_59,
            u1_.id_card_verified AS id_card_verified_60, u1_.nb_bookings_offerer AS nb_bookings_offerer_61, u1_.nb_bookings_asker AS nb_bookings_asker_62, u1_.fee_as_asker AS fee_as_asker_63, u1_.fee_as_offerer AS fee_as_offerer_64, u1_.average_rating_as_asker AS average_rating_as_asker_65, u1_.average_rating_as_offerer AS average_rating_as_offerer_66, u1_.mother_tongue AS mother_tongue_67, u1_.answer_delay AS answer_delay_68, u1_.time_zone AS time_zone_69, u1_.mangopay_id AS mangopay_id_70, u1_.mangopay_wallet_id AS mangopay_wallet_id_71, u1_.mangopay_bank_account_id AS mangopay_bank_account_id_72, u1_.created_at AS created_at_73, u1_.updated_at AS updated_at_74, u1_.slug AS slug_75, u2_.id AS id_76, u2_.facebook_id AS facebook_id_77, u2_.link AS link_78, u2_.last_name AS last_name_79, u2_.first_name AS first_name_80, u2_.birthday AS birthday_81, u2_.address AS address_82, u2_.verified AS verified_83, u2_.location AS location_84, u2_.location_id AS location_id_85, u2_.hometown AS hometown_86, u2_.hometown_id AS hometown_id_87, u2_.gender AS gender_88, u2_.locale AS locale_89, u2_.timezone AS timezone_90, u2_.nb_friends AS nb_friends_91, u2_.picture AS picture_92, u2_.created_at AS created_at_93, u2_.updated_at AS updated_at_94, l3_.id AS id_95, l3_.status AS status_96, l3_.type AS type_97, l3_.price AS price_98, l3_.certified AS certified_99, l3_.min_duration AS min_duration_100, l3_.max_duration AS max_duration_101, l3_.cancellation_policy AS cancellation_policy_102, l3_.average_rating AS average_rating_103, l3_.comment_count AS comment_count_104, l3_.admin_notation AS admin_notation_105, l3_.availabilities_updated_at AS availabilities_updated_at_106, l3_.platform_notation AS platform_notation_107, l3_.created_at AS created_at_108, l3_.updated_at AS updated_at_109, b4_.id AS id_110, b4_.status AS status_111, b4_.amount AS amount_112, b4_.payed_at AS payed_at_113, b4_.mangopay_transfer_id AS mangopay_transfer_id_114, b4_.mangopay_payout_id AS mangopay_payout_id_115, b4_.created_at AS created_at_116, b4_.updated_at AS updated_at_117, b5_.id AS id_118, b5_.status AS status_119, b5_.amount AS amount_120, b5_.payed_at AS payed_at_121, b5_.mangopay_refund_id AS mangopay_refund_id_122, b5_.created_at AS created_at_123, b5_.updated_at AS updated_at_124, m6_.subject AS subject_125, m6_.created_at AS created_at_126, m6_.is_spam AS is_spam_127, m6_.id AS id_128, l7_.title AS title_129, l7_.description AS description_130, l7_.rules AS rules_131, l7_.locale AS locale_132, l7_.id AS id_133, l7_.slug AS slug_134, u8_.username AS username_135, u8_.username_canonical AS username_canonical_136, u8_.email AS email_137, u8_.email_canonical AS email_canonical_138, u8_.enabled AS enabled_139, u8_.salt AS salt_140, u8_.password AS password_141, u8_.last_login AS last_login_142, u8_.confirmation_token AS confirmation_token_143, u8_.password_requested_at AS password_requested_at_144, u8_.roles AS roles_145, u8_.id AS id_146, u8_.person_type AS person_type_147, u8_.user_type AS user_type_148, u8_.company_name AS company_name_149, u8_.last_name AS last_name_150, u8_.first_name AS first_name_151, u8_.phone_prefix AS phone_prefix_152, u8_.phone AS phone_153, u8_.birthday AS birthday_154, u8_.nationality AS nationality_155, u8_.country_of_residence AS country_of_residence_156, u8_.profession AS profession_157, u8_.iban AS iban_158, u8_.bic AS bic_159, u8_.bank_owner_name AS bank_owner_name_160, u8_.bank_owner_address AS bank_owner_address_161, u8_.annual_income AS annual_income_162, u8_.phone_verified AS phone_verified_163, u8_.email_verified AS email_verified_164, u8_.id_card_verified AS id_card_verified_165, u8_.nb_bookings_offerer AS nb_bookings_offerer_166, u8_.nb_bookings_asker AS nb_bookings_asker_167, u8_.fee_as_asker AS fee_as_asker_168, u8_.fee_as_offerer AS fee_as_offerer_169, u8_.average_rating_as_asker AS average_rating_as_asker_170, u8_.average_rating_as_offerer AS average_rating_as_offerer_171, u8_.mother_tongue AS mother_tongue_172, u8_.answer_delay AS answer_delay_173, u8_.time_zone AS time_zone_174, u8_.mangopay_id AS mangopay_id_175, u8_.mangopay_wallet_id AS mangopay_wallet_id_176, u8_.mangopay_bank_account_id AS mangopay_bank_account_id_177, u8_.created_at AS created_at_178, u8_.updated_at AS updated_at_179, u8_.slug AS slug_180, u9_.id AS id_181, u9_.facebook_id AS facebook_id_182, u9_.link AS link_183, u9_.last_name AS last_name_184, u9_.first_name AS first_name_185, u9_.birthday AS birthday_186, u9_.address AS address_187, u9_.verified AS verified_188, u9_.location AS location_189, u9_.location_id AS location_id_190, u9_.hometown AS hometown_191, u9_.hometown_id AS hometown_id_192, u9_.gender AS gender_193, u9_.locale AS locale_194, u9_.timezone AS timezone_195, u9_.nb_friends AS nb_friends_196, u9_.picture AS picture_197, u9_.created_at AS created_at_198, u9_.updated_at AS updated_at_199, b0_.user_id AS user_id_200, b0_.listing_id AS listing_id_201, u2_.user_id AS user_id_202, l3_.user_id AS user_id_203, l3_.location_id AS location_id_204, b4_.user_id AS user_id_205, b4_.booking_id AS booking_id_206, b5_.user_id AS user_id_207, b5_.booking_id AS booking_id_208, m6_.created_by_id AS created_by_id_209, m6_.listing_id AS listing_id_210, m6_.booking_id AS booking_id_211, l7_.translatable_id AS translatable_id_212, u9_.user_id AS user_id_213
        FROM  booking b0_
        LEFT JOIN  `user` u1_  ON b0_.user_id = u1_.id
        LEFT JOIN  `user_facebook` u2_  ON u1_.id = u2_.user_id
        LEFT JOIN  listing l3_  ON b0_.listing_id = l3_.id
        LEFT JOIN  booking_bank_wire b4_  ON b0_.id = b4_.booking_id
        LEFT JOIN  booking_payin_refund b5_  ON b0_.id = b5_.booking_id
        LEFT JOIN  message_thread m6_  ON b0_.id = m6_.booking_id
        LEFT JOIN  listing_translation l7_  ON l3_.id = l7_.translatable_id
        LEFT JOIN  `user` u8_  ON l3_.user_id = u8_.id
        LEFT JOIN  `user_facebook` u9_  ON u8_.id = u9_.user_id
        WHERE  b0_.status IN (?)
          AND  (b0_.new_booking_at <= ?
                  OR  CONCAT(DATE_FORMAT (b0_.start,'%Y-%m-%d'), ' ',
                             DATE_FORMAT (b0_.start_time, '%H:%i:%s')) <= ?
               )
          AND  b0_.alerted_expiring = ?'

 with params [1, "2019-10-02 15:50:02", "2019-10-04 19:50:02", 0]:

And :


  SQLSTATE[42000]: Syntax error or access violation: 1630 FUNCTION dbparty.DA
  TE_FORMAT does not exist. Check the 'Function Name Parsing and Resolution'
  section in the Reference Manual


In PDOStatement.php line 144:

  SQLSTATE[42000]: Syntax error or access violation: 1630 FUNCTION dbparty.DA
  TE_FORMAT does not exist. Check the 'Function Name Parsing and Resolution'
  section in the Reference Manual


In PDOStatement.php line 142:

  SQLSTATE[42000]: Syntax error or access violation: 1630 FUNCTION dbparty.DA
  TE_FORMAT does not exist. Check the 'Function Name Parsing and Resolution'
  section in the Reference Manual

Solution

  • Remove the space after the DATE_FORMAT.

    From:

    DATE_FORMAT (b0_.start,'%Y-%m-%d')
    

    To:

    DATE_FORMAT(b0_.start,'%Y-%m-%d')
    

    From the documentation.

    By default, there must be no whitespace between a function name and the parenthesis following it. This helps the MySQL parser distinguish between function calls and references to tables or columns that happen to have the same name as a function. However, spaces around function arguments are permitted.

    To tell the MySQL server to accept spaces after function names by starting it with the --sql-mode=IGNORE_SPACE option. (See Section 7.1.11, “Server SQL Modes”.) Individual client programs can request this behavior by using the CLIENT_IGNORE_SPACE option for mysql_real_connect(). In either case, all function names become reserved words.