Friday 15 May 2015

MySQL UPDATE with INNER JOIN has warnings but will not show them -



MySQL UPDATE with INNER JOIN has warnings but will not show them -

i'm getting warnings when updating table warnings not showing. through tedious , lengthy trial-and-error, cause of warnings has been tracked downwards inner join. need improve way debug warning.

setup ok. know warnings on because mysql command prompt started alternative '--show-warnings' , warnings turned on warnings '\w':

mysql> \w show warnings enabled. mysql> show variables '%warn%'; +---------------+-------+ | variable_name | value | +---------------+-------+ | log_warnings | 0 | | sql_warnings | on | | warning_count | 0 | +---------------+-------+ 3 rows in set (0.01 sec)

to create sure warnings on, forced truncating warning on varchar(255) field:

mysql> update course of study -> set course.transcript_title = 'field transcript_title varchar(255). on 255 characters forcefulness truncating warning. field transcript_title varchar(255). on 255 characters forcefulness truncating warning. field transcript_title varchar(255). on 255 characters forcefulness truncating warning.' -> course.title '%slp%' -> , course.year = 2008 -> , course.gid = 35; query ok, 104 rows affected, 104 warnings (0.19 sec) rows matched: 104 changed: 104 warnings: 104 warning (code 1265): info truncated column 'transcript_title' @ row 1 warning (code 1265): info truncated column 'transcript_title' @ row 2 .... etc.

i want warning type of query:

mysql> update course of study -> inner bring together group_info on course.gid = group_info.id -> set course.description = 'foo.' -> course.title '%slp%' -> , course.year = 2008 , group_info.id = 35; query ok, 0 rows affected (0.02 sec) rows matched: 104 changed: 0 warnings: 104 mysql> show warnings; empty set (0.00 sec)

from trial , error, know error having inner bring together clause. if remove inner bring together , straight utilize gid (group id) field in course of study table, no warnings:

mysql> update course of study -> set course.description = 'bar.' -> course.title '%slp%' -> , course.year = 2008 -> , course.gid = 35; query ok, 104 rows affected (0.01 sec) rows matched: 104 changed: 104 warnings: 0

but need inner bring together clause because want utilize more friendly 'name' field in joined 'group_info' table:

update course of study inner bring together group_info on course.gid = group_info.id set course.description = 'foo.' course.title '%slp%' , course.year = 2008 , group_info.name = 'one-to-one meeting time';

i've been googling, reading, , debugging warning on 1 hour. i've searched answers or explanations why not show warnings no luck.

how warnings show inner bring together type of update?

mysql join sql-update

No comments:

Post a Comment