Запрос mysql формируется, выводится, но через раз выходит ошибка, в чем проблема?
Запрос формируется, но постоянно ругается на запрос, в таблице данные есть, выходит через раз. Плиз, подскажите куда смотреть.
A Database Error Occurred
Error Number: 1356
View 'ru-rv-od.n0001_contract' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
SELECT COUNT(*) AS `numrows` FROM `n0001_contract` WHERE `lb0001_id` = '105' AND `lb0206_id` = 'ie' AND `lb0201_id` = 'CANCELED'
Filename: name/name.php
Line Number: 177
Это не таблица, это view, судя по ошибке - он сломан.
Если работает через раз - могу в режиме телепата предположить что у Вас sql кластер и view сломан только на одной из нод.
Нет у нас не кластер, но все подготовлено для этого, в данный момент, все находится в рамках одной базы в одном месте, данные во view нормально формируются ошибок нет. 10 раз выполняется нормально, 1 раз выходит ошибка.
('select `A`.`lb0003_id` AS `lb0003_id`,`CL2`.`lb0101_id` AS `lb0101_id`,`CL2`.`lb0101_name1` AS `lb0101_name1`,`CL2`.`lb0101_name2` AS `lb0101_name2`,`CL2`.`lb0101_name3` AS `lb0101_name3`,`CL2`.`lb0101_name1_alt` AS `lb0101_name1_alt`,`CL2`.`lb0101_name2_alt` AS `lb0101_name2_alt`,`CL2`.`lb0101_name3_alt` AS `lb0101_name3_alt`,`CL2`.`lb0101_dateOfBirth` AS `lb0101_dateOfBirth`,`CL2`.`lb0101_idn` AS `lb0101_idn`,`CL2`.`lb0101_idCard_no` AS `lb0101_idCard_no`,`CL2`.`lb0101_idCard_dateOfIssue` AS `lb0101_idCard_dateOfIssue`,`CL2`.`lb0101_idCard_issuedBy` AS `lb0101_idCard_issuedBy`,`CL2`.`lb0101_idCard_validity` AS `lb0101_idCard_validity`,`CL2`.`lb0101_passport_no` AS `lb0101_passport_no`,`CL2`.`lb0101_passport_dateOfIssue` AS `lb0101_passport_dateOfIssue`,`CL2`.`lb0101_passport_issuedBy` AS `lb0101_passport_issuedBy`,`CL2`.`lb0101_passport_validity` AS `lb0101_passport_validity`,`CL2`.`lb0101_location1` AS `lb0101_location1`,`CL2`.`lb0101_address1` AS `lb0101_address1`,`CL2`.`lb0101_phone_home` AS `lb0101_phone_home`,`CL2`.`lb0101_phone_mobile1` AS `lb0101_phone_mobile1`,`CL2`.`lb0101_phone_mobile2` AS `lb0101_phone_mobile2`,`CL2`.`lb0101_comments` AS `lb0101_comments`,`CL2`.`lb0101_email` AS `lb0101_email`,`CL2`.`lb0101_representative_name` AS `lb0101_representative_name`,`CL2`.`lb0101_representative_details` AS `lb0101_representative_details`,`CL2`.`lb0101_created` AS `lb0101_created`,`CL2`.`lb0101_createdby` AS `lb0101_createdby`,`CL2`.`lb0101_deleted` AS `lb0101_deleted`,`C`.`tr0001_id` AS `tr0001_id`,`C`.`tr0001_lb0206_id` AS `tr0001_lb0206_id`,`C`.`tr0001_date` AS `tr0001_date`,`C`.`tr0001_amount` AS `tr0001_amount`,`C`.`tr0001_amount_ticket` AS `tr0001_amount_ticket`,`C`.`tr0001_amount_visa` AS `tr0001_amount_visa`,`C`.`tr0001_amount_hotel` AS `tr0001_amount_hotel`,`C`.`tr0001_amount_operator` AS `tr0001_amount_operator`,`C`.`tr0001_amount_insurance` AS `tr0001_amount_insurance`,`C`.`tr0001_fullypaid_ticket` AS `tr0001_fullypaid_ticket`,`C`.`tr0001_fullypaid_visa` AS `tr0001_fullypaid_visa`,`C`.`tr0001_fullypaid_hotel` AS `tr0001_fullypaid_hotel`,`C`.`tr0001_fullypaid_operator` AS `tr0001_fullypaid_operator`,`C`.`tr0001_fullypaid_insurance` AS `tr0001_fullypaid_insurance`,`C`.`tr0001_fullypaid_ticket_by` AS `tr0001_fullypaid_ticket_by`,`C`.`tr0001_fullypaid_visa_by` AS `tr0001_fullypaid_visa_by`,`C`.`tr0001_fullypaid_hotel_by` AS `tr0001_fullypaid_hotel_by`,`C`.`tr0001_fullypaid_operator_by` AS `tr0001_fullypaid_operator_by`,`C`.`tr0001_fullypaid_insurance_by` AS `tr0001_fullypaid_insurance_by`,`C`.`tr0001_ccy_ticket` AS `tr0001_ccy_ticket`,`C`.`tr0001_ccy_visa` AS `tr0001_ccy_visa`,`C`.`tr0001_ccy_hotel` AS `tr0001_ccy_hotel`,`C`.`tr0001_ccy_operator` AS `tr0001_ccy_operator`,`C`.`tr0001_ccy_insurance` AS `tr0001_ccy_insurance`,`C`.`tr0001_prepayment` AS `tr0001_prepayment`,`C`.`tr0001_fullpaymentbefore` AS `tr0001_fullpaymentbefore`,`C`.`tr0001_lb0201_id` AS `tr0001_lb0201_id`,`C`.`tr0001_dest_lb0014_id` AS `tr0001_dest_lb0014_id`,`C`.`tr0001_dest_location` AS `tr0001_dest_location`,`C`.`tr0001_dest_datefrom` AS `tr0001_dest_datefrom`,`C`.`tr0001_dest_dateto` AS `tr0001_dest_dateto`,`C`.`tr0001_lb0203_id` AS `tr0001_lb0203_id`,`C`.`tr0001_lb0204_id` AS `tr0001_lb0204_id`,`C`.`tr0001_lb0202_id` AS `tr0001_lb0202_id`,`C`.`tr0001_ticketto_airline` AS `tr0001_ticketto_airline`,`C`.`tr0001_ticketto_flight` AS `tr0001_ticketto_flight`,`C`.`tr0001_ticketto_lb0014_id` AS `tr0001_ticketto_lb0014_id`,`C`.`tr0001_ticketto_location` AS `tr0001_ticketto_location`,`C`.`tr0001_ticketto_datetimeofdeparture` AS `tr0001_ticketto_datetimeofdeparture`,`C`.`tr0001_ticketto_datetimeofarrival` AS `tr0001_ticketto_datetimeofarrival`,`C`.`tr0001_ticketfrom_airline` AS `tr0001_ticketfrom_airline`,`C`.`tr0001_ticketfrom_flight` AS `tr0001_ticketfrom_flight`,`C`.`tr0001_ticketfrom_lb0014_id` AS `tr0001_ticketfrom_lb0014_id`,`C`.`tr0001_ticketfrom_location` AS `tr0001_ticketfrom_location`,`C`.`tr0001_ticketfrom_datetimeofdeparture` AS `tr0001_ticketfrom_datetimeofdeparture`,`C`.`tr0001_ticketfrom_datetimeofarrival` AS `tr0001_ticketfrom_datetimeofarrival`,`C`.`tr0001_features_visa` AS `tr0001_features_visa`,`C`.`tr0001_features_includedexcursions` AS `tr0001_features_includedexcursions`,`C`.`tr0001_features_earlybooking` AS `tr0001_features_earlybooking`,`C`.`tr0001_features_refusalofinsurance` AS `tr0001_features_refusalofinsurance`,`C`.`tr0001_features_includinginsurance` AS `tr0001_features_includinginsurance`,`C`.`tr0001_features_highseason` AS `tr0001_features_highseason`,`C`.`tr0001_features_roomWithBalcony` AS `tr0001_features_roomWithBalcony`,`C`.`tr0001_features_nonSmokingRooms` AS `tr0001_features_nonSmokingRooms`,`C`.`tr0001_features_roomOn1stFloor` AS `tr0001_features_roomOn1stFloor`,`C`.`tr0001_placement_hotel` AS `tr0001_placement_hotel`,`C`.`tr0001_placement_hotelcat` AS `tr0001_placement_hotelcat`,`C`.`tr0001_placement_condition` AS `tr0001_placement_condition`,`C`.`tr0001_placement_typeoffood` AS `tr0001_placement_typeoffood`,`C`.`tr0001_placement_lb0013_id` AS `tr0001_placement_lb0013_id`,`C`.`tr0001_tr0002_id` AS `tr0001_tr0002_id`,`C`.`tr0001_comments` AS `tr0001_comments`,`C`.`tr0001_lb0101_id` AS `tr0001_lb0101_id`,`C`.`tr0001_primary_lb0101_id` AS `tr0001_primary_lb0101_id`,`C`.`tr0001_primary_isrepresentative` AS `tr0001_primary_isrepresentative`,`C`.`tr0001_primary_istourist` AS `tr0001_primary_istourist`,`C`.`tr0001_created` AS `tr0001_created`,`C`.`tr0001_createdby` AS `tr0001_createdby`,`C`.`tr0001_deleted` AS `tr0001_deleted`,`CS`.`lb0201_rec_id` AS `lb0201_rec_id`,`CS`.`lb0201_id` AS `lb0201_id`,`CS`.`lb0201_name_en` AS `lb0201_name_en`,`CS`.`lb0201_name_ru` AS `lb0201_name_ru`,`CS`.`lb0201_name_ru` AS `lb0201_name_ru`,`CS`.`lb0201_htmlattr1` AS `lb0201_htmlattr1`,`CS`.`lb0201_created` AS `lb0201_created`,`CS`.`lb0201_createdby` AS `lb0201_createdby`,`CS`.`lb0201_disabled` AS `lb0201_disabled`,`CS`.`lb0201_deleted` AS `lb0201_deleted`,`P`.`lb0203_rec_id` AS `lb0203_rec_id`,`P`.`lb0203_id` AS `lb0203_id`,`P`.`lb0203_lb0002_id` AS `lb0203_lb0002_id`,`P`.`lb0203_name_en` AS `lb0203_name_en`,`P`.`lb0203_name_ru` AS `lb0203_name_ru`,`P`.`lb0203_name_ru` AS `lb0203_name_ru`,`P`.`lb0203_contract` AS `lb0203_contract`,`P`.`lb0203_created` AS `lb0203_created`,`P`.`lb0203_createdby` AS `lb0203_createdby`,`P`.`lb0203_disabled` AS `lb0203_disabled`,`P`.`lb0203_deleted` AS `lb0203_deleted`,`BS`.`lb0202_rec_id` AS `lb0202_rec_id`,`BS`.`lb0202_id` AS `lb0202_id`,`BS`.`lb0202_name_en` AS `lb0202_name_en`,`BS`.`lb0202_name_ru` AS `lb0202_name_ru`,`BS`.`lb0202_name_ru` AS `lb0202_name_ru`,`BS`.`lb0202_htmlattr1` AS `lb0202_htmlattr1`,`BS`.`lb0202_created` AS `lb0202_created`,`BS`.`lb0202_createdby` AS `lb0202_createdby`,`BS`.`lb0202_disabled` AS `lb0202_disabled`,`BS`.`lb0202_deleted` AS `lb0202_deleted`,`CT`.`lb0206_id` AS `lb0206_id`,`CT`.`lb0206_name_en` AS `lb0206_name_en`,`CT`.`lb0206_name_ru` AS `lb0206_name_ru`,`CT`.`lb0206_name_ru` AS `lb0206_name_ru`,`CT`.`lb0206_tpl_contract` AS `lb0206_tpl_contract`,`CT`.`lb0206_tpl_contractno` AS `lb0206_tpl_contractno`,`CT`.`lb0206_form` AS `lb0206_form`,`CT`.`lb0206_created` AS `lb0206_created`,`CT`.`lb0206_createdby` AS `lb0206_createdby`,`CT`.`lb0206_disabled` AS `lb0206_disabled`,`CT`.`lb0206_deleted` AS `lb0206_deleted`,ifnull(`PTS`.`prepaymentsTotalSum`,0) AS `prepaymentsTotalSum`,concat(\',\',`C`.`tr0001_lb0101_id`,\',\') AS `tr0001_lb0101_id_search` from (((((((`ru-rv-od`.`tr0001_contracts` `C` join `ru-rv-od`.`vw_tr0001_contractsbyaccess_union` `A` on((convert(`A`.`target_lb0003_id` using utf8) = `C`.`tr0001_createdby`))) left join `ru-rv-od`.`lb0101_client` `CL2` on((`CL2`.`lb0101_id` = `C`.`tr0001_primary_lb0101_id`))) left join `ru-rv-od`.`vw_lb0201_contract_statuses` `CS` on((`CS`.`lb0201_id` = `C`.`tr0001_lb0201_id`))) left join `ru-rv-od`.`lb0206_contractTypes` `CT` on((`CT`.`lb0206_id` = `C`.`tr0001_lb0206_id`))) left join `ru-rv-od`.`vw_lb0202_booking_statuses` `BS` on((`BS`.`lb0202_id` = `C`.`tr0001_lb0202_id`))) left join `ru-rv-od`.`vw_lb0203_partners` `P` on((`P`.`lb0203_id` = `C`.`tr0001_lb0203_id`))) left join `ru-rv-od`.`vw_tr0101_cashreceipts_sum` `PTS` on((`PTS`.`tr0101_tr0001_id` = `C`.`tr0001_id`)))');