Вылет mysql при синхронизации топиков

druid

Пользователь
Начал вылетать запрос
Код:
DB()->query("
UPDATE
$tmp_sync_topics tmp, ". BB_TOPICS ." t
SET
t.topic_replies        = tmp.total_posts - 1,
t.topic_first_post_id  = tmp.topic_first_post_id,
t.topic_last_post_id   = tmp.topic_last_post_id,
t.topic_last_post_time = tmp.topic_last_post_time,
t.topic_attachment     = tmp.topic_attachment
WHERE
t.topic_id = tmp.topic_id
");
в includes/functions_admin.php(102) с ошибкой #001690 BIGINT UNSIGNED value is out of range in '(`<db_name>`.`tmp`.`total_posts` - 1'
**************************************
Кто-нибудь сталкивался с такой проблемой? Как решили?
 

druid

Пользователь
Отвечу сам себе же:

При создании одной из тем произошел сбой БД, после которого запись в bb_topics ссылалась на несуществующую запись в bb_posts
Находится такая запись запросом:
Код:
SELECT * FROM `bb_topics` WHERE topic_first_post_id NOT IN (SELECT post_id FROM bb_posts)
Лечение: удалить эту запись из bb_topics
 

Elymas

Пользователь
[22-Mar-2012 23:18:05] PHP Fatal error: DB Error [includes/functions_admin.php(113)] in /var/www/sergey/data/www/******.org/includes/db/mysql.php on line 803
DB()->query("
UPDATE
$tmp_sync_topics tmp, ". BB_TOPICS ." t
SET
t.topic_replies = tmp.total_posts - 1,
t.topic_first_post_id = tmp.topic_first_post_id,
t.topic_last_post_id = tmp.topic_last_post_id,
t.topic_last_post_time = tmp.topic_last_post_time,
t.topic_attachment = tmp.topic_attachment
WHERE
t.topic_id = tmp.topic_id
");
При нажатии кнопки синхронизация топиков вот такая бага!!!!​
"); - 113 строчка
Помогите с ошибкой????
 

Elymas

Пользователь
#001690 BIGINT UNSIGNED value is out of range in '(`auto`.`tmp`.`total_posts` - 1)'

UPDATE tmp_sync_topics tmp, bb_topics t SET t.topic_replies = tmp.total_posts - 1, t.topic_first_post_id = tmp.topic_first_post_id, t.topic_last_post_id = tmp.topic_last_post_id, t.topic_last_post_time = tmp.topic_last_post_time, t.topic_attachment = tmp.topic_attachment WHERE t.topic_id = tmp.topic_id

Source : includes/functions_admin.php(113) :: db1.auto
IP : 178.89.195.182
Date : 2012-03-22 23:50:06
Agent : Opera/9.80 (Windows NT 5.1; U; ru) Presto/2.10.229 Version/11.60
Req_URI : /admin/index.php?sync_topics=1
Referer :

Please Login or Register to view hidden text.


Method : GET
PID : 10981
Request : Array
(
[sync_topics] => 1
[bb_data] => a:3:{s:2:"uk";s:12:"OWP1mrE31Ks5";s:3:"uid";i:2;s:3:"sid";s:20:"IwS1L1OPviYnPZ6JJxB5";}
[bb_dbg] => 1
)
 
J

jivodristik

Гость
Тоже появляется такая же ошибка
Код:
04-18 | 01:47:34 | 122 | 1    | 06253 | INSERT INTO tmp_sync_topics SELECT t.topic_id, COUNT(p.post_id) AS total_posts, MIN(p.post_id) AS topic_first_post_id, MAX(p.post_id) AS topic_last_post_id, MAX(p.post_time) AS topic_last_post_time, IF(MAX(a.attach_id), 1, 0) AS topic_attachment FROM bb_topics t LEFT JOIN bb_posts p ON(p.topic_id = t.topic_id) LEFT JOIN bb_attachments a ON(a.post_id = p.post_id) WHERE t.topic_status != 2 GROUP BY t.topic_id # Records: 7925 Duplicates: 0 Warnings: 0 # includes/functions_admin.php(102)

но такой запрос SELECT * FROM `bb_topics` WHERE topic_first_post_id NOT IN (SELECT post_id FROM bb_posts) мне не помог. Что делать?
 
J

jivodristik

Гость
druid спасибо что откликнулся, и в правда не так все понял. А как удалить не подскажешь?
 
J

jivodristik

Гость
MySQL вернула пустой результат (т.е. ноль строк). ( запрос занял 0.0266 сек. )
Код:
SELECT *
FROM `bb_topics`
WHERE topic_first_post_id NOT
IN (

SELECT post_id
FROM bb_posts
)
LIMIT 0 , 50

http://torrentpier.com/threads/Вылет-mysql-при-синхронизации-топиков.1108/ Подскажите пожалуйста что конкретно нужно удалять и как это сделать, я в этом новенький и пока не знаю как это сделать.
 
Сверху